mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Sean Christopherson <seanjc@google.com>
Subject: [GIT PULL] KVM: x86: Misc changes for 7.2
Date: Thu, 11 Jun 2026 17:47:48 -0700	[thread overview]
Message-ID: <20260612004755.349925-4-seanjc@google.com> (raw)
In-Reply-To: <20260612004755.349925-1-seanjc@google.com>

By patch count, the register API cleanup dominates, but the most notable change
here is the SNP and TDX hypercall return code handling from Vishal+Sagi.  To
allow userspace to tell the guest to "retry", the changes interpret the return
code from userspace as an errno value, and explicitly recognize only EAGAIN and
EINVAL.  All other errnos are now reserved.  This is a change in uABI, but as
far as we know, it won't break any VMMs that support SNP or TDX

The following changes since commit b7fbe9a1bf9ee6c967ef77d366ca58c35fcf1887:

  Merge branch 'kvm-apx-prepare' into HEAD (2026-05-13 12:38:31 -0400)

are available in the Git repository at:

  https://github.com/kvm-x86/linux.git tags/kvm-x86-misc-7.2

for you to fetch changes up to 65aa483f32ec674f0506658329d43403cafe5eb0:

  Documentation: KVM: Synchronize x86 VM types (2026-06-08 09:20:19 -0700)

----------------------------------------------------------------
KVM misc x86 changes for 7.2

 - Handle EXIT_FASTPATH_EXIT_USERSPACE in vendor code to ensure vendor code
   gets a chance to handle things like reaping the PML buffer.

 - Ensure KVM's copy of CR0 and CR3 are up-to-date on SVM prior to invoking
   fastpath handlers.

 - Update KVM's view of PV async enabling if and only if the MSR write fully
   succeeds.

 - Fix a variety of issues where the emulator doesn't honor guest-debug state,
   and clean up related code along the way.

 - Synthesize EPT Violation and #NPF "error code" bits when injecting faults
   into L1 that didn't originate in hardware (in which case the VMCS/VMCB
   doesn't hold relevant information).

 - Add support for virtualizing (well, emulating) AMD's flavor of CPL>0 CPUID
   faulting.

 - Clean up the GPR APIs so that KVM's use of "raw" is consistent, and fix a
   variety of minor bugs along the way.

 - Fix an OOB memory access due to not checking the VP ID when handling a
   Hyper-V PV TLB flush for L2.

 - Fix a bug in the mediated PMU's handling of fixed counters that allowed the
   guest to bypass the PMU event filter.

 - Allow userspace to return EAGAIN when handling SNP and TDX hypercalls, so
   the KVM can forward a "retry" status code to the guest, and reserve all
   unused error codes for future usage.

 - Misc fixes and cleanups.

----------------------------------------------------------------
Carlos López (2):
      KVM: x86: Take PIC lock on KVM_GET_IRQCHIP path
      Documentation: KVM: Synchronize x86 VM types

Ethan Yang (1):
      KVM: x86: Don't leave APF half-enabled on bad APF data GPA

Hou Wenlong (7):
      KVM: x86: Capture "struct x86_exception" in inject_emulated_exception()
      KVM: x86: Set guest DR6 by kvm_queue_exception_p() in instruction emulation
      KVM: x86: Honor KVM_GUESTDBG_USE_HW_BP when emulating MOV DR (in emulator)
      KVM: x86: Honor KVM_GUESTDBG_USE_HW_BP when checking for code breakpoints in emulation
      KVM: x86: Move KVM_GUESTDBG_SINGLESTEP handling into kvm_inject_emulated_db()
      KVM: selftests: Verify guest debug DR7.GD checking during instruction emulation
      KVM: selftests: Verify VMX's GUEST_PENDING_DBG_EXCEPTIONS.BS Consistency Check

Hyunwoo Kim (1):
      KVM: x86: hyper-v: Bound the bank index when querying sparse banks

Jim Mattson (4):
      KVM: x86: Prioritize CPUID faulting over CPUID VM-exits in nested VMX
      KVM: x86: Remove supports_cpuid_fault() helper
      KVM: x86: Virtualize AMD CPUID faulting
      KVM: selftests: Update hwcr_msr_test for CPUID faulting bit

Kai Huang (1):
      KVM: x86: Use <linux/lockdep.h> for lockdep header inclusion

Kevin Cheng (4):
      KVM: x86: Widen x86_exception's error_code to 64 bits
      KVM: SVM: Fix nested NPF injection of PFERR_GUEST_{PAGE,FINAL}_MASK bits
      KVM: VMX: Synthesize nested EPT violation GVA_IS_VALID/GVA_TRANSLATED bits
      KVM: selftests: Add nested page fault injection test

Krzysztof Kozlowski (1):
      MAINTAINERS: KVM: Include maintainer profile

Li RongQing (3):
      KVM: x86: Fix wrong return value type in guest_cpuid_has()
      KVM: x86: Use fls() instead of ffs() for rmaps histogram bucketing
      KVM: x86: ioapic: Use old_dest_mode consistently in ioapic_write_indirect()

Sagi Shahar (1):
      KVM: SEV: Restrict userspace return codes for KVM_HC_MAP_GPA_RANGE

Sean Christopherson (28):
      KVM: x86: Ensure vendor's exit handler runs before fastpath userspace exits
      KVM: SVM: Refresh vcpu->arch.cr{0,3} prior to invoking fastpath handler
      KVM: x86: Drop superfluous caching of KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT
      KVM: x86: Drop superfluous caching of KVM_ASYNC_PF_SEND_ALWAYS
      KVM: VMX: Refresh GUEST_PENDING_DBG_EXCEPTIONS.BS on all injected #DBs
      KVM: x86: Drop kvm_vcpu_do_singlestep() now that it's been gutted
      KVM: selftests: Add all (known) EFLAGS bit definitions
      KVM: x86: Remove unused X86EMUL_MODE_HOST define
      KVM: x86: Tell ->inject_page_fault() whether or a fault came from hardware
      KVM: x86: Consolidate CPUID fault handling for emulator and interception logic
      KVM: SVM: Truncate INVLPGA address in compatibility mode
      KVM: x86/xen: Bug the VM if 32-bit KVM observes a 64-bit mode hypercall
      KVM: x86/xen: Don't truncate RAX when handling hypercall from protected guest
      KVM: VMX: Read 32-bit GPR values for ENCLS instructions outside of 64-bit mode
      KVM: x86: Trace hypercall register *after* truncating values for 32-bit
      KVM: x86: Rename kvm_cache_regs.h => regs.h
      KVM: x86: Move inlined GPR, CR, and DR helpers from x86.h to regs.h
      KVM: x86: Add mode-aware versions of kvm_<reg>_{read,write}() helpers
      KVM: x86: Drop non-raw kvm_<reg>_write() helpers
      KVM: nSVM: Use kvm_rax_read() now that it's mode-aware
      Revert "KVM: VMX: Read 32-bit GPR values for ENCLS instructions outside of 64-bit mode"
      KVM: x86: Harden is_64_bit_hypercall() against bugs on 32-bit kernels
      KVM: x86: Move update_cr8_intercept() to lapic.c
      KVM: x86: Move async #PF helpers to x86.h (as inlines)
      KVM: x86: Drop defunct vcpu_tsc_khz() declaration
      KVM: x86: Remove defunct kvm_load_segment_descriptor() declaration.
      KVM: x86/pmu: Use hardware value when reprogramming for FIXED_CTR_CTRL changes
      KVM: selftests: Add regression test for mediated PMU fixed counter filter bug

Vishal Annapurve (2):
      KVM: x86: Treat KVM's virtual PMU as disabled for TDX VMs
      KVM: TDX: Allow userspace to return errors to guest for MAPGPA

 Documentation/virt/kvm/api.rst                     |   5 +
 MAINTAINERS                                        |   1 +
 arch/x86/include/asm/kvm_host.h                    |  27 +-
 arch/x86/include/asm/msr-index.h                   |   1 +
 arch/x86/kvm/cpuid.c                               |  21 +-
 arch/x86/kvm/cpuid.h                               |  20 +-
 arch/x86/kvm/debugfs.c                             |   2 +-
 arch/x86/kvm/emulate.c                             |  22 +-
 arch/x86/kvm/hyperv.c                              |  26 +-
 arch/x86/kvm/hyperv.h                              |   4 +-
 arch/x86/kvm/ioapic.c                              |   2 +-
 arch/x86/kvm/irq.c                                 |   4 +
 arch/x86/kvm/kvm_emulate.h                         |  17 +-
 arch/x86/kvm/lapic.c                               |  28 +-
 arch/x86/kvm/lapic.h                               |   1 +
 arch/x86/kvm/mmu.h                                 |   2 +-
 arch/x86/kvm/mmu/mmu.c                             |   2 +-
 arch/x86/kvm/mmu/paging_tmpl.h                     |  36 +-
 arch/x86/kvm/{kvm_cache_regs.h => regs.h}          | 198 +++++++++--
 arch/x86/kvm/smm.c                                 |   2 +-
 arch/x86/kvm/svm/nested.c                          |  46 ++-
 arch/x86/kvm/svm/sev.c                             |  12 +-
 arch/x86/kvm/svm/svm.c                             |  34 +-
 arch/x86/kvm/svm/svm.h                             |   2 +-
 arch/x86/kvm/vmx/nested.c                          |  39 ++-
 arch/x86/kvm/vmx/nested.h                          |   2 +-
 arch/x86/kvm/vmx/pmu_intel.c                       |  10 +-
 arch/x86/kvm/vmx/sgx.c                             |   6 +-
 arch/x86/kvm/vmx/tdx.c                             |  52 ++-
 arch/x86/kvm/vmx/vmx.c                             |  40 ++-
 arch/x86/kvm/vmx/vmx.h                             |   2 +-
 arch/x86/kvm/x86.c                                 | 374 +++++++++------------
 arch/x86/kvm/x86.h                                 | 134 ++------
 arch/x86/kvm/xen.c                                 |  39 ++-
 tools/testing/selftests/kvm/Makefile.kvm           |   1 +
 .../testing/selftests/kvm/include/x86/processor.h  |  29 +-
 tools/testing/selftests/kvm/lib/x86/processor.c    |   2 +-
 tools/testing/selftests/kvm/lib/x86/vmx.c          |   2 +-
 tools/testing/selftests/kvm/x86/debug_regs.c       |  88 ++++-
 tools/testing/selftests/kvm/x86/hwcr_msr_test.c    |   9 +-
 .../selftests/kvm/x86/nested_tdp_fault_test.c      | 313 +++++++++++++++++
 .../selftests/kvm/x86/pmu_event_filter_test.c      |   6 +
 42 files changed, 1116 insertions(+), 547 deletions(-)
 rename arch/x86/kvm/{kvm_cache_regs.h => regs.h} (59%)
 create mode 100644 tools/testing/selftests/kvm/x86/nested_tdp_fault_test.c

  parent reply	other threads:[~2026-06-12  0:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12  0:47 [GIT PULL] KVM: x86 pull requests " Sean Christopherson
2026-06-12  0:47 ` [GIT PULL] KVM: x86: Generic changes " Sean Christopherson
2026-06-12  8:07   ` Paolo Bonzini
2026-06-12  0:47 ` [GIT PULL] KVM: x86: guest_memfd " Sean Christopherson
2026-06-12  8:10   ` Paolo Bonzini
2026-06-12  0:47 ` Sean Christopherson [this message]
2026-06-12  8:14   ` [GIT PULL] KVM: x86: Misc " Paolo Bonzini
2026-06-12  0:47 ` [GIT PULL] KVM: x86: MMU " Sean Christopherson
2026-06-12  8:14   ` Paolo Bonzini
2026-06-12  0:47 ` [GIT PULL] KVM: x86: Selftests " Sean Christopherson
2026-06-12  8:12   ` Paolo Bonzini
2026-06-12  0:47 ` [GIT PULL] KVM: x86: SEV " Sean Christopherson
2026-06-12  8:13   ` Paolo Bonzini
2026-06-12  0:47 ` [GIT PULL] KVM: x86: SVM " Sean Christopherson
2026-06-12  0:47 ` [GIT PULL] KVM: VFIO " Sean Christopherson
2026-06-12  8:14   ` Paolo Bonzini
2026-06-12  0:47 ` [GIT PULL] KVM: x86: VMX " Sean Christopherson
2026-06-12  8:15   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260612004755.349925-4-seanjc@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®