1. Jun 13, 2024
    • Richard Henderson's avatar
      Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging · 36c1febe
      Richard Henderson authored
      Block layer patches
      
      - crypto: Fix crash when used with multiqueue devices
      - linux-aio: add IO_CMD_FDSYNC command support
      - copy-before-write: Avoid integer overflows for timeout > 4s
      - Fix crash with QMP block_resize and iothreads
      - qemu-io: add cvtnum() error handling for zone commands
      - Code cleanup
      
      # -----BEGIN PGP SIGNATURE-----
      #
      # iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmZoitoRHGt3b2xmQHJl
      # ZGhhdC5jb20ACgkQfwmycsiPL9Z2ng/+KVz0P1M6fjdI0yJSwAla3PVRfB0BjZ+k
      # pwoUaHholVB4lmhU8OhtUHgEPK/jIZVdgwfG2se8WHR3eAzEVTWqt5mRIjOVUX4b
      # N29G6gTHt8p64YKSbiqnyK2IC7qhY/o3hQ+d8frk+tqstc2tzFHDtjkWtYROdl/X
      # iNW6zXy1rz5qIyJ80QWvBs7CfQuvElzK0GN2QusSZDEUJYiLhVS6QfjNmRfJI5yT
      # /eDoHAjMJycxy+8YpEj1QEdEcFV7dS0BCr6qeWeAg50Gej1xlDeknejG+Cro2A1z
      # MJu4blqMhzzjG9YIS90wCDOxXYdifa1VQSIpV6zpU1ExToXFOVtF3h06Hu0aHiBu
      # hU4UnTsQSLmlQXbSbFwlVgRdGfAxvIxp6EuWtPteSAfnxAlxoQbqnV6uN/RsFnsr
      # R+zSiNx+20IDj4befzcQWNWpWNnTloRR01/iucncEpZZEu0/E58Y4bFAWBexMOhz
      # MgYTXTVgR+WPuyR8FXyXX32dQBQMb5grSnseXwOBhi3ULrMqjLinR60B+XbWgy/g
      # mE/oLc+uttAk1EbHH/8od8vjvtDHdl9FrfsPaPDlJTiexqNZHxiDE3WVdhvaPsTF
      # wJ0CB7pdvrWIAVwmSpfksVoyL2HQx2ILjGSQbKPvYEZqSoUMr7+7Z0SkTQ1i706b
      # xODS2wm+h0Q=
      # =hMLb
      # -----END PGP SIGNATURE-----
      # gpg: Signature made Tue 11 Jun 2024 10:35:22 AM PDT
      # gpg:                using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6
      # gpg:                issuer "kwolf@redhat.com"
      # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full]
      
      * tag 'for-upstream' of https://repo.or.cz/qemu/kevin
      
      :
        crypto/block: drop qcrypto_block_open() n_threads argument
        block/crypto: create ciphers on demand
        linux-aio: add IO_CMD_FDSYNC command support
        block/copy-before-write: use uint64_t for timeout in nanoseconds
        qemu-io: add cvtnum() error handling for zone commands
        aio: warn about iohandler_ctx special casing
        Revert "monitor: use aio_co_reschedule_self()"
        block: drop force_dup parameter of raw_reconfigure_getfd()
      
      Signed-off-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      36c1febe
    • Richard Henderson's avatar
      Merge tag 'tracing-pull-request' of https://gitlab.com/stefanha/qemu into staging · f3e8cc47
      Richard Henderson authored
      Pull request
      
      Cleanups from Philippe Mathieu-Daudé.
      
      # -----BEGIN PGP SIGNATURE-----
      #
      # iQEzBAABCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmZnNCQACgkQnKSrs4Gr
      # c8hRQgf/WDNO0IvplK4U9PO5+Zm165xqY6lttfgniJzT2jb4p/dg0LiNOSqHx53Q
      # 2eM/YJl7GxSXwnIESqNVuVxixh8DvExmOtM8RJm3HyJWtZoKfgMOV/dzHEhST3xj
      # PglIEwL5Cm14skhQAVhJXzFlDjZ8seoz+YCbLhcYWk2B3an+5PvFySbp4iHS9cXJ
      # lZUZx/aa9xjviwzMbsMxzFt3rA22pgNaxemV40FBIMWC0H+jP5pgBdZXE2n8jJvB
      # 9eXZyG1kdkJKXO2DMhPYuG4rEEWOhV6dckXzmxCQEbHlGTH7X3Pn1F5B3+agi9g3
      # 39U1Z+WFb8JFLOQMCQ3jlcbkIfULzQ==
      # =wqXR
      # -----END PGP SIGNATURE-----
      # gpg: Signature made Mon 10 Jun 2024 10:13:08 AM PDT
      # gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
      # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
      # gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]
      
      * tag 'tracing-pull-request' of https://gitlab.com/stefanha/qemu
      
      :
        tracetool: Forbid newline character in event format
        hw/vfio: Remove newline character in trace events
        hw/usb: Remove newline character in trace events
        hw/sh4: Remove newline character in trace events
        backends/tpm: Remove newline character in trace event
        tracetool: Remove unused vcpu.py script
      
      Signed-off-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      f3e8cc47
  2. Jun 11, 2024
  3. Jun 10, 2024
  4. Jun 09, 2024
  5. Jun 08, 2024
    • Richard Henderson's avatar
      Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging · 3e246da2
      Richard Henderson authored
      * scsi-disk: Don't silently truncate serial number
      * backends/hostmem: Report error on unavailable qemu_madvise() features or unaligned memory sizes
      * target/i386: fixes and documentation for INHIBIT_IRQ/TF/RF and debugging
      * i386/hvf: Adds support for INVTSC cpuid bit
      * i386/hvf: Fixes for dirty memory tracking
      * i386/hvf: Use hv_vcpu_interrupt() and hv_vcpu_run_until()
      * hvf: Cleanups
      * stubs: fixes for --disable-system build
      * i386/kvm: support for FRED
      * i386/kvm: fix MCE handling on AMD hosts
      
      # -----BEGIN PGP SIGNATURE-----
      #
      # iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmZkF2oUHHBib256aW5p
      # QHJlZGhhdC5jb20ACgkQv/vSX3jHroPNlQf+N9y6Eh0nMEEQ69twtV8ytglTY+uX
      # FsogvnsXHNMVubOWmmeItM6kFXTAkR9cmFaL8dqI1Gs03xEQdQXbF1KejJZOAZVl
      # RQMOW8Fg2Afr+0lwqCXHvhsmZ4hr5yUkRndyucA/E9AO2uGrtgwsWGDBGaHJOZIA
      # lAsEMOZgKjXHZnefXjhMrvpk/QNovjEV6f1RHX3oKZjKSI5/G4IqGSmwNYToot8p
      # 2fgs4Qti4+1gNyM2oBLq7cCMjMS61tSxOMH4uqVoIisjyckPlAFRvc+DXtKsUAAs
      # 9AgM++pNgpB0IXv67czRUNdRoK7OI8I0ULhI4qHXi6Yg2QYAHqpQ6WL4Lg==
      # =RP7U
      # -----END PGP SIGNATURE-----
      # gpg: Signature made Sat 08 Jun 2024 01:33:46 AM PDT
      # gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
      # gpg:                issuer "pbonzini@redhat.com"
      # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
      # gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
      
      * tag 'for-upstream' of https://gitlab.com/bonzini/qemu
      
      : (42 commits)
        python: mkvenv: remove ensure command
        Revert "python: use vendored tomli"
        i386: Add support for overflow recovery
        i386: Add support for SUCCOR feature
        i386: Fix MCE support for AMD hosts
        docs: i386: pc: Avoid mentioning limit of maximum vCPUs
        target/i386: Add get/set/migrate support for FRED MSRs
        target/i386: enumerate VMX nested-exception support
        vmxcap: add support for VMX FRED controls
        target/i386: mark CR4.FRED not reserved
        target/i386: add support for FRED in CPUID enumeration
        hvf: Makes assert_hvf_ok report failed expression
        i386/hvf: Updates API usage to use modern vCPU run function
        i386/hvf: In kick_vcpu use hv_vcpu_interrupt to force exit
        i386/hvf: Fixes dirty memory tracking by page granularity RX->RWX change
        hvf: Consistent types for vCPU handles
        i386/hvf: Fixes some compilation warnings
        i386/hvf: Adds support for INVTSC cpuid bit
        stubs/meson: Fix qemuutil build when --disable-system
        scsi-disk: Don't silently truncate serial number
        ...
      
      Signed-off-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      3e246da2
    • Paolo Bonzini's avatar
      python: mkvenv: remove ensure command · fc00123f
      Paolo Bonzini authored
      
      
      This was used to bootstrap the venv with a TOML parser, after which
      ensuregroup is used.  Now that we expect it to be present as a system
      package (either tomli or, for Python 3.11, tomllib), it is not needed
      anymore.
      
      Note that this means that, when implemented, the hypothetical "isolated"
      mode that does not use any system packages will only work with Python
      3.11+.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      fc00123f
    • Paolo Bonzini's avatar
      Revert "python: use vendored tomli" · 1f97715c
      Paolo Bonzini authored
      
      
      Now that Ubuntu 20.04 is not included anymore, there is no need to ship
      it as part of QEMU; Ubuntu 22.04 includes it and Leap users anyway
      need to install all the required dependencies from PyPI.
      
      This mostly reverts commit ec77ee7634de123b7c899739711000fd21dab68b,
      with just some changes to the wording.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      1f97715c
    • John Allen's avatar
      i386: Add support for overflow recovery · 1ea14321
      John Allen authored
      
      
      Add cpuid bit definition for overflow recovery. This is needed in the case
      where a deferred error has been sent to the guest, a guest process accesses the
      poisoned memory, but the machine_check_poll function has not yet handled the
      original deferred error. If overflow recovery is not set in this case, when we
      handle the uncorrected error from the poisoned memory access, the overflow bit
      will be set and will result in the guest being shut down.
      
      By the time the MCE reaches the guest, the overflow has been handled
      by the host and has not caused a shutdown, so include the bit unconditionally.
      
      Signed-off-by: default avatarJohn Allen <john.allen@amd.com>
      Message-ID: <20240603193622.47156-4-john.allen@amd.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      1ea14321
    • John Allen's avatar
      i386: Add support for SUCCOR feature · 2ba8b7ee
      John Allen authored
      
      
      Add cpuid bit definition for the SUCCOR feature. This cpuid bit is required to
      be exposed to guests to allow them to handle machine check exceptions on AMD
      hosts.
      
      ----
      v2:
        - Add "succor" feature word.
        - Add case to kvm_arch_get_supported_cpuid for the SUCCOR feature.
      
      Reported-by: default avatarWilliam Roche <william.roche@oracle.com>
      Reviewed-by: default avatarJoao Martins <joao.m.martins@oracle.com>
      Signed-off-by: default avatarJohn Allen <john.allen@amd.com>
      Message-ID: <20240603193622.47156-3-john.allen@amd.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      2ba8b7ee
    • John Allen's avatar
      i386: Fix MCE support for AMD hosts · 4b77512b
      John Allen authored
      
      
      For the most part, AMD hosts can use the same MCE injection code as Intel, but
      there are instances where the qemu implementation is Intel specific. First, MCE
      delivery works differently on AMD and does not support broadcast. Second,
      kvm_mce_inject generates MCEs that include a number of Intel specific status
      bits. Modify kvm_mce_inject to properly generate MCEs on AMD platforms.
      
      Reported-by: default avatarWilliam Roche <william.roche@oracle.com>
      Signed-off-by: default avatarJohn Allen <john.allen@amd.com>
      Message-ID: <20240603193622.47156-2-john.allen@amd.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      4b77512b
    • Zhao Liu's avatar
      docs: i386: pc: Avoid mentioning limit of maximum vCPUs · 888788dd
      Zhao Liu authored
      
      
      Different versions of PC machine support different maximum vCPUs, and
      even different features have limits on the maximum number of vCPUs (
      For example, if x2apic is not enabled in the TCG case, the maximum of
      255 vCPUs are supported).
      
      It is difficult to list the maximum vCPUs under all restrictions. Thus,
      to avoid confusion, avoid mentioning specific maximum vCPU number
      limitations here.
      
      Suggested-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      Signed-off-by: default avatarZhao Liu <zhao1.liu@intel.com>
      Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      Message-ID: <20240606085436.2028900-1-zhao1.liu@intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      888788dd
    • Xin Li's avatar
      target/i386: Add get/set/migrate support for FRED MSRs · 4ebd98eb
      Xin Li authored
      
      
      FRED CPU states are managed in 9 new FRED MSRs, in addtion to a few
      existing CPU registers and MSRs, e.g., CR4.FRED and MSR_IA32_PL0_SSP.
      
      Save/restore/migrate FRED MSRs if FRED is exposed to the guest.
      
      Tested-by: default avatarShan Kang <shan.kang@intel.com>
      Signed-off-by: default avatarXin Li <xin3.li@intel.com>
      Message-ID: <20231109072012.8078-7-xin3.li@intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      4ebd98eb
    • Xin Li's avatar
      target/i386: enumerate VMX nested-exception support · ef202d64
      Xin Li authored
      
      
      Allow VMX nested-exception support to be exposed in KVM guests, thus
      nested KVM guests can enumerate it.
      
      Tested-by: default avatarShan Kang <shan.kang@intel.com>
      Signed-off-by: default avatarXin Li <xin3.li@intel.com>
      Message-ID: <20231109072012.8078-6-xin3.li@intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      ef202d64
    • Xin Li's avatar
      vmxcap: add support for VMX FRED controls · 2e641870
      Xin Li authored
      
      
      Report secondary vm-exit controls and the VMX controls used to
      save/load FRED MSRs.
      
      Tested-by: default avatarShan Kang <shan.kang@intel.com>
      Signed-off-by: default avatarXin Li <xin3.li@intel.com>
      Message-ID: <20231109072012.8078-5-xin3.li@intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      2e641870
    • Xin Li's avatar
      target/i386: mark CR4.FRED not reserved · f88ddc40
      Xin Li authored
      
      
      The CR4.FRED bit, i.e., CR4[32], is no longer a reserved bit when FRED
      is exposed to guests, otherwise it is still a reserved bit.
      
      Tested-by: default avatarShan Kang <shan.kang@intel.com>
      Signed-off-by: default avatarXin Li <xin3.li@intel.com>
      Reviewed-by: default avatarZhao Liu <zhao1.liu@intel.com>
      Message-ID: <20231109072012.8078-3-xin3.li@intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      f88ddc40
    • Xin Li's avatar
      target/i386: add support for FRED in CPUID enumeration · c1acad9f
      Xin Li authored
      
      
      FRED, i.e., the Intel flexible return and event delivery architecture,
      defines simple new transitions that change privilege level (ring
      transitions).
      
      The new transitions defined by the FRED architecture are FRED event
      delivery and, for returning from events, two FRED return instructions.
      FRED event delivery can effect a transition from ring 3 to ring 0, but
      it is used also to deliver events incident to ring 0.  One FRED
      instruction (ERETU) effects a return from ring 0 to ring 3, while the
      other (ERETS) returns while remaining in ring 0.  Collectively, FRED
      event delivery and the FRED return instructions are FRED transitions.
      
      In addition to these transitions, the FRED architecture defines a new
      instruction (LKGS) for managing the state of the GS segment register.
      The LKGS instruction can be used by 64-bit operating systems that do
      not use the new FRED transitions.
      
      WRMSRNS is an instruction that behaves exactly like WRMSR, with the
      only difference being that it is not a serializing instruction by
      default.  Under certain conditions, WRMSRNS may replace WRMSR to improve
      performance.  FRED uses it to switch RSP0 in a faster manner.
      
      Search for the latest FRED spec in most search engines with this search
      pattern:
      
        site:intel.com FRED (flexible return and event delivery) specification
      
      The CPUID feature flag CPUID.(EAX=7,ECX=1):EAX[17] enumerates FRED, and
      the CPUID feature flag CPUID.(EAX=7,ECX=1):EAX[18] enumerates LKGS, and
      the CPUID feature flag CPUID.(EAX=7,ECX=1):EAX[19] enumerates WRMSRNS.
      
      Add CPUID definitions for FRED/LKGS/WRMSRNS, and expose them to KVM guests.
      
      Because FRED relies on LKGS and WRMSRNS, add that to feature dependency
      map.
      
      Tested-by: default avatarShan Kang <shan.kang@intel.com>
      Signed-off-by: default avatarXin Li <xin3.li@intel.com>
      Message-ID: <20231109072012.8078-2-xin3.li@intel.com>
      [Fix order of dependencies, add dependencies from LM to FRED. - Paolo]
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      c1acad9f
    • Phil Dennis-Jordan's avatar
      hvf: Makes assert_hvf_ok report failed expression · a3c67dfc
      Phil Dennis-Jordan authored
      
      
      When a macOS Hypervisor.framework call fails which is checked by
      assert_hvf_ok(), Qemu exits printing the error value, but not the
      location
      in the code, as regular assert() macro expansions would.
      
      This change turns assert_hvf_ok() into a macro similar to other
      assertions, which expands to a call to the corresponding _impl()
      function together with information about the expression that failed
      the assertion and its location in the code.
      
      Additionally, stringifying the numeric hv_return_t code is factored
      into a helper function that can be reused for diagnostics and debugging
      outside of assertions.
      
      Signed-off-by: default avatarPhil Dennis-Jordan <phil@philjordan.eu>
      Message-ID: <20240605112556.43193-8-phil@philjordan.eu>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      a3c67dfc