KVM: x86 pull requests 6.19
Subsystems (4)
Sean Christopherson
maintainerI don't think there are any notable anomolies this time around?
The guest_memfd,misc, and svm pulls have conflicts. Details in the guest_memfd and svm requests (only the guest_memfd one is non-trivial).
Sean Christopherson
maintainer[GIT PULL] KVM: Generic changes for 6.19
A tweak to account for an upcoming API change, and a doc fix.
The following changes since commit 3a8660878839faadb4f1a6dd72c3179c1df56787:
Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-generic-6.19
for you to fetch changes up to 04fd067b770d19fee39759d994c4bfa2fb332d9f:
KVM: Fix VM exit code for full dirty ring in API documentation (2025-10-14 15:19:05 -0700)
----------------------------------------------------------------
KVM generic changes for 6.19:
- Use the recently-added WQ_PERCPU when creating the per-CPU workqueue for irqfd cleanup.
- Fix a goof in the dirty ring documentation.
----------------------------------------------------------------
Leonardo Bras (1):
KVM: Fix VM exit code for full dirty ring in API documentation
Marco Crivellari (1):
KVM: Explicitly allocate/setup irqfd cleanup as per-CPU workqueue
Documentation/virt/kvm/api.rst | 2 +- virt/kvm/eventfd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Paolo Bonzini
maintainerRe: [GIT PULL] KVM: Generic changes for 6.19
Quoted 7 lines · Sean Christopherson
A tweak to account for an upcoming API change, and a doc fix.
The following changes since commit
3a8660878839faadb4f1a6dd72c3179c1df56787:Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)
Quoted 7 lines
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-generic-6.19
for you to fetch changes up to
04fd067b770d19fee39759d994c4bfa2fb332d9f:KVM: Fix VM exit code for full dirty ring in API documentation (2025-10-14 15:19:05 -0700)
This could have been even 6.18 material, so I pulled it first just in case. Though it's pretty late now so probably not.
Thanks,
Paolo
Quoted 19 lines
----------------------------------------------------------------
KVM generic changes for 6.19:- Use the recently-added
WQ_PERCPUwhen creating the per-CPU workqueue for irqfd cleanup.- Fix a goof in the dirty ring documentation.
----------------------------------------------------------------
Leonardo Bras (1):
KVM: Fix VM exit code for full dirty ring in API documentationMarco Crivellari (1):
KVM: Explicitly allocate/setup irqfd cleanup as per-CPU workqueueDocumentation/virt/kvm/api.rst | 2 +- virt/kvm/eventfd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Sean Christopherson
maintainer[GIT PULL] KVM: guest_memfd: NUMA support and other changes for 6.19
In reply to Sean ChristophersonPlease pull NUMA mempolicy guest_memfd support, along with a handful of guest_memfd cleanups and some tangentially related additions to KVM selftests infrastructure.
This will conflict with kvm/master due to commit ae431059e75d ("KVM:guest_memfd: Remove bindings on memslot deletion when gmem is dying"). The resolution I've been using for linux-next is below.
--
virt/kvm/guest_memfd.c +0 -0
@@@ -623,53 -708,31 +708,49 @@@ errreturn r; } - static void __kvm_gmem_unbind(struct kvm_memory_slot *slot, struct kvm_gmem *gmem) -void kvm_gmem_unbind(struct kvm_memory_slot *slot) ++static void __kvm_gmem_unbind(struct kvm_memory_slot *slot, struct gmem_file *f) {unsigned long start = slot->gmem.pgoff;unsigned long end = start + slot->npages; - struct gmem_file *f; -xa_store_range (&gmem->bindings, start, end -1 ,NULL ,GFP_KERNEL ); -/* - * Nothing to do if the underlying file was already closed (or is being - * closed right now), kvm_gmem_release() invalidates all bindings. - */ -CLASS (gmem_get_file, file)(slot); - if (!file) - return; - - f = file->private_data; - -filemap_invalidate_lock (file->f_mapping); +xa_store_range (&f->bindings, start, end -1 ,NULL ,GFP_KERNEL );/* * synchronize_srcu(&kvm->srcu) ensured that kvm_gmem_get_pfn() * cannot see this memslot. */ WRITE_ONCE (slot->gmem.file,NULL ); +} + +void kvm_gmem_unbind(struct kvm_memory_slot *slot) +{ - struct file *file; - +/* + * Nothing to do if the underlying file was _already_ closed, as + * kvm_gmem_release() invalidates and nullifies all bindings. + */ + if (!slot->gmem.file) + return; + - file =kvm_gmem_get_file (slot); ++CLASS (gmem_get_file, file)(slot); + +/* + * However, if the file is _being_ closed, then the bindings need to be + * removed as kvm_gmem_release() might not run until after the memslot + * is freed. Note, modifying the bindings is safe even though the file + * is dying as kvm_gmem_release() nullifies slot->gmem.file under + * slots_lock, and only puts its reference to KVM after destroying all + * bindings. I.e. reaching this point means kvm_gmem_release() hasn't + * yet destroyed the bindings or freed the gmem_file, and can't do so + * until the caller drops slots_lock. + */ + if (!file) { +__kvm_gmem_unbind (slot, slot->gmem.file->private_data); + return; + } + +filemap_invalidate_lock (file->f_mapping); +__kvm_gmem_unbind (slot, file->private_data);filemap_invalidate_unlock (file->f_mapping); - -fput (file); }/* Returns a locked folio on success. */
The following changes since commit 211ddde0823f1442e4ad052a2f30f050145ccada:
Linux 6.18-rc2 (2025-10-19 15:19:16 -1000)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-gmem-6.19
for you to fetch changes up to 83e0e12219a402bf7b8fdef067e51f945a92fd26:
KVM: selftests: Rename "guest_paddr" variables to "gpa" (2025-11-03 12:54:21 -0800)
----------------------------------------------------------------
KVM guest_memfd changes for 6.19:
- Add NUMA mempolicy support for guest_memfd, and clean up a variety of rough edges in guest_memfd along the way.
- Define a CLASS to automatically handle get+put when grabbing a guest_memfd from a memslot to make it harder to leak references.
- Enhance KVM selftests to make it easer to develop and debug selftests like those added for guest_memfd NUMA support, e.g. where test and/or KVM bugs often result in hard-to-debug SIGBUS errors.
- Misc cleanups.
----------------------------------------------------------------
Ackerley Tng (1):
KVM: guest_memfd: Use guest mem inodes instead of anonymous inodes
Matthew Wilcox (2):
mm/filemap: Add NUMA mempolicy support to filemap_alloc_folio() mm/filemap: Extend __filemap_get_folio() to support NUMA memory policies
Pedro Demarchi Gomes (1):
KVM: guest_memfd: use folio_nr_pages() instead of shift operation
Sean Christopherson (10):
KVM: guest_memfd: Drop a superfluous local var in kvm_gmem_fault_user_mapping()
KVM: guest_memfd: Rename "struct kvm_gmem" to "struct gmem_file"
KVM: guest_memfd: Add macro to iterate over gmem_files for a mapping/inode
KVM: selftests: Define wrappers for common syscalls to assert success
KVM: selftests: Report stacktraces SIGBUS, SIGSEGV, SIGILL, and SIGFPE by default
KVM: selftests: Add additional equivalents to libnuma APIs in KVM's numaif.h
KVM: selftests: Use proper uAPI headers to pick up mempolicy.h definitions
KVM: guest_memfd: Add gmem_inode.flags field instead of using i_private
KVM: guest_memfd: Define a CLASS to get+put guest_memfd file from a memslot
KVM: selftests: Rename "guest_paddr" variables to "gpa"
Shivank Garg (7):
mm/mempolicy: Export memory policy symbols
KVM: guest_memfd: move kvm_gmem_get_index() and use in kvm_gmem_prepare_folio()
KVM: guest_memfd: remove redundant gmem variable initialization
KVM: guest_memfd: Add slab-allocated inode cache
KVM: guest_memfd: Enforce NUMA mempolicy using shared policy
KVM: selftests: Add helpers to probe for NUMA support, and multi-node systems
KVM: selftests: Add guest_memfd tests for mmap and NUMA policy support
fs/btrfs/compression.c | 4 +- fs/btrfs/verity.c | 2 +- fs/erofs/zdata.c | 2 +- fs/f2fs/compress.c | 2 +- include/linux/pagemap.h | 18 +++-- include/uapi/linux/magic.h | 1 + mm/filemap.c | 23 ++++--- mm/mempolicy.c | 6 ++ mm/readahead.c | 2 +- tools/testing/selftests/kvm/arm64/vgic_irq.c | 2 +- tools/testing/selftests/kvm/guest_memfd_test.c | 98 +++++++++++++++++++++++++++ tools/testing/selftests/kvm/include/kvm_syscalls.h | 81 ++++++++++++++++++++++ tools/testing/selftests/kvm/include/kvm_util.h | 39 ++--------- tools/testing/selftests/kvm/include/numaif.h | 110 ++++++++++++++++++------------ tools/testing/selftests/kvm/kvm_binary_stats_test.c | 4 +- tools/testing/selftests/kvm/lib/kvm_util.c | 101 +++++++++++++++------------- tools/testing/selftests/kvm/x86/private_mem_conversions_test.c | 9 +-- tools/testing/selftests/kvm/x86/xapic_ipi_test.c | 5 +- virt/kvm/guest_memfd.c | 374 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------- virt/kvm/kvm_main.c | 7 +- virt/kvm/kvm_mm.h | 9 +-- 21 files changed, 646 insertions(+), 253 deletions(-) create mode 100644 tools/testing/selftests/kvm/include/kvm_syscalls.h
Paolo Bonzini
maintainerRe: [GIT PULL] KVM: guest_memfd: NUMA support and other changes for 6.19
Quoted 8 lines · Sean Christopherson
Please pull NUMA mempolicy
guest_memfdsupport, along with a handful ofguest_memfdcleanups and some tangentially related additions to KVM selftests infrastructure.This will conflict with kvm/master due to commit
ae431059e75d("KVM:guest_memfd: Remove bindings on memslot deletion when gmem is dying"). The resolution I've been using for linux-next is below.
Pulled, thanks.
Paolo
Quoted 160 lines
--
virt/kvm/guest_memfd.c +3
-7@@@ -623,53 -708,31 +708,49 @@@ errreturn r; } - static void __kvm_gmem_unbind(struct kvm_memory_slot *slot, struct kvm_gmem *gmem) -void kvm_gmem_unbind(struct kvm_memory_slot *slot) ++static void __kvm_gmem_unbind(struct kvm_memory_slot *slot, struct gmem_file *f) {unsigned long start = slot->gmem.pgoff;unsigned long end = start + slot->npages; - struct gmem_file *f; -xa_store_range (&gmem->bindings, start, end -1 ,NULL ,GFP_KERNEL ); -/* - * Nothing to do if the underlying file was already closed (or is being - * closed right now), kvm_gmem_release() invalidates all bindings. - */ -CLASS (gmem_get_file, file)(slot); - if (!file) - return; - - f = file->private_data; - -filemap_invalidate_lock (file->f_mapping); +xa_store_range (&f->bindings, start, end -1 ,NULL ,GFP_KERNEL );/* * synchronize_srcu(&kvm->srcu) ensured that kvm_gmem_get_pfn() * cannot see this memslot. */ WRITE_ONCE (slot->gmem.file,NULL ); +} + +void kvm_gmem_unbind(struct kvm_memory_slot *slot) +{ - struct file *file; - +/* + * Nothing to do if the underlying file was _already_ closed, as + * kvm_gmem_release() invalidates and nullifies all bindings. + */ + if (!slot->gmem.file) + return; + - file =kvm_gmem_get_file (slot); ++CLASS (gmem_get_file, file)(slot); + +/* + * However, if the file is _being_ closed, then the bindings need to be + * removed as kvm_gmem_release() might not run until after the memslot + * is freed. Note, modifying the bindings is safe even though the file + * is dying as kvm_gmem_release() nullifies slot->gmem.file under + * slots_lock, and only puts its reference to KVM after destroying all + * bindings. I.e. reaching this point means kvm_gmem_release() hasn't + * yet destroyed the bindings or freed the gmem_file, and can't do so + * until the caller drops slots_lock. + */ + if (!file) { +__kvm_gmem_unbind (slot, slot->gmem.file->private_data); + return; + } + +filemap_invalidate_lock (file->f_mapping); +__kvm_gmem_unbind (slot, file->private_data);filemap_invalidate_unlock (file->f_mapping); - -fput (file); }/* Returns a locked folio on success. */ The following changes since commit
211ddde0823f1442e4ad052a2f30f050145ccada:Linux 6.18-rc2 (2025-10-19 15:19:16 -1000)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-gmem-6.19
for you to fetch changes up to
83e0e12219a402bf7b8fdef067e51f945a92fd26:KVM: selftests: Rename "
guest_paddr" variables to "gpa" (2025-11-03 12:54:21 -0800)----------------------------------------------------------------
KVMguest_memfdchanges for 6.19:- Add NUMA mempolicy support for
guest_memfd, and clean up a variety of rough edges inguest_memfdalong the way.- Define a CLASS to automatically handle get+put when grabbing a
guest_memfdfrom a memslot to make it harder to leak references.- Enhance KVM selftests to make it easer to develop and debug selftests like those added for
guest_memfdNUMA support, e.g. where test and/or KVM bugs often result in hard-to-debug SIGBUS errors.- Misc cleanups.
----------------------------------------------------------------
Ackerley Tng (1):
KVM:guest_memfd: Use guest mem inodes instead of anonymous inodesMatthew Wilcox (2):
mm/filemap: Add NUMA mempolicy support tofilemap_alloc_folio()mm/filemap: Extend__filemap_get_folio()to support NUMA memory policiesPedro Demarchi Gomes (1):
KVM:guest_memfd: usefolio_nr_pages()instead of shift operationSean Christopherson (10):
KVM:guest_memfd: Drop a superfluous local var inkvm_gmem_fault_user_mapping()
KVM:guest_memfd: Rename "structkvm_gmem" to "structgmem_file"
KVM:guest_memfd: Add macro to iterate overgmem_filesfor a mapping/inode
KVM: selftests: Define wrappers for common syscalls to assert success
KVM: selftests: Report stacktraces SIGBUS, SIGSEGV, SIGILL, and SIGFPE by default
KVM: selftests: Add additional equivalents to libnuma APIs in KVM'snumaif.h
KVM: selftests: Use proper uAPI headers to pick upmempolicy.hdefinitions
KVM:guest_memfd: Add gmem_inode.flags field instead of usingi_private
KVM:guest_memfd: Define a CLASS to get+putguest_memfdfile from a memslot
KVM: selftests: Rename "guest_paddr" variables to "gpa"Shivank Garg (7):
mm/mempolicy: Export memory policy symbols
KVM:guest_memfd: movekvm_gmem_get_index()and use inkvm_gmem_prepare_folio()
KVM:guest_memfd: remove redundant gmem variable initialization
KVM:guest_memfd: Add slab-allocated inode cache
KVM:guest_memfd: Enforce NUMA mempolicy using shared policy
KVM: selftests: Add helpers to probe for NUMA support, and multi-node systems
KVM: selftests: Addguest_memfdtests for mmap and NUMA policy supportfs/btrfs/compression.c | 4 +- fs/btrfs/verity.c | 2 +- fs/erofs/zdata.c | 2 +- fs/f2fs/compress.c | 2 +- include/linux/pagemap.h | 18 +++-- include/uapi/linux/magic.h | 1 + mm/filemap.c | 23 ++++--- mm/mempolicy.c | 6 ++ mm/readahead.c | 2 +- tools/testing/selftests/kvm/arm64/vgic_irq.c | 2 +- tools/testing/selftests/kvm/guest_memfd_test.c | 98 +++++++++++++++++++++++++++ tools/testing/selftests/kvm/include/kvm_syscalls.h | 81 ++++++++++++++++++++++ tools/testing/selftests/kvm/include/kvm_util.h | 39 ++--------- tools/testing/selftests/kvm/include/numaif.h | 110 ++++++++++++++++++------------ tools/testing/selftests/kvm/kvm_binary_stats_test.c | 4 +- tools/testing/selftests/kvm/lib/kvm_util.c | 101 +++++++++++++++------------- tools/testing/selftests/kvm/x86/private_mem_conversions_test.c | 9 +-- tools/testing/selftests/kvm/x86/xapic_ipi_test.c | 5 +- virt/kvm/guest_memfd.c | 374 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------- virt/kvm/kvm_main.c | 7 +- virt/kvm/kvm_mm.h | 9 +-- 21 files changed, 646 insertions(+), 253 deletions(-) create mode 100644 tools/testing/selftests/kvm/include/kvm_syscalls.h
Sean Christopherson
maintainer[GIT PULL] KVM: x86: Misc changes for 6.19
In reply to Sean ChristophersonThe bulk of the vendor agnostic x86 changes for 6.19. There are multiple noteworthy changes, though nothing stands out as being _that_ much more interesting than the rest.
The following changes since commit 211ddde0823f1442e4ad052a2f30f050145ccada:
Linux 6.18-rc2 (2025-10-19 15:19:16 -1000)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-misc-6.19
for you to fetch changes up to c09816f2afce0f89f176c4bc58dc57ec9f204998:
KVM: x86: Remove unused declaration kvm_mmu_may_ignore_guest_pat() (2025-11-20 07:26:35 -0800)
----------------------------------------------------------------
KVM x86 misc changes for 6.19:
- Fix an async #PF bug where KVM would clear the completion queue when the guest transitioned in and out of paging mode, e.g. when handling an SMI and then returning to paged mode via RSM.
- Fix a bug where TDX would effectively corrupt user-return MSR values if the TDX Module rejects VP.ENTER and thus doesn't clobber host MSRs as expected.
- Leave the user-return notifier used to restore MSRs registered when disabling virtualization, and instead pin kvm.ko. Restoring host MSRs via IPI callback is either pointless (clean reboot) or dangerous (forced reboot) since KVM has no idea what code it's interrupting.
- Use the checked version of {get,put}_user(), as Linus wants to kill them off, and they're measurably faster on modern CPUs due to the unchecked versions containing an LFENCE.
- Fix a long-lurking bug where KVM's lack of catch-up logic for periodic APIC timers can result in a hard lockup in the host.
- Revert the periodic kvmclock sync logic now that KVM doesn't use a clocksource that's subject to NPT corrections.
- Clean up KVM's handling of MMIO Stale Data and L1TF, and bury the latter behind CONFIG_CPU_MITIGATIONS.
- Context switch XCR0, XSS, and PKRU outside of the entry/exit fastpath as the only reason they were handled in the faspath was to paper of a bug in the core #MC code that has long since been fixed.
- Add emulator support for AVX MOV instructions to play nice with emulated devices whose PCI BARs guest drivers like to access with large multi-byte instructions.
----------------------------------------------------------------
Binbin Wu (1):
KVM: x86: Add a helper to dedup loading guest/host XCR0 and XSS
Brendan Jackman (1):
KVM: x86: Unify L1TF flushing under per-CPU variable
Chang S. Bae (1):
KVM: x86: Refactor REX prefix handling in instruction emulation
Chao Gao (1):
KVM: x86: Allocate/free user_return_msrs at kvm.ko (un)loading time
Hou Wenlong (1):
KVM: x86: Don't disable IRQs when unregistering user-return notifier
Lei Chen (3):
Revert "x86: kvm: introduce periodic global clock updates" Revert "x86: kvm: rate-limit global clock updates"
KVM: x86: remove comment about ntp correction sync for
Maxim Levitsky (2):
KVM: x86: Fix a semi theoretical bug in kvm_arch_async_page_present_queued()
KVM: x86: Don't clear async #PF queue when CR0.PG is disabled (e.g. on #SMI)
Paolo Bonzini (9):
KVM: x86: Add support for emulating MOVNTDQA
KVM: x86: Move Src2Shift up one bit (use bits 36:32 for Src2 in the emulator)
KVM: x86: Improve formatting of the emulator's flags table
KVM: x86: Move op_prefix to struct x86_emulate_ctxt (from x86_decode_insn())
KVM: x86: Share emulator's common register decoding code
KVM: x86: Add x86_emulate_ops.get_xcr() callback
KVM: x86: Add AVX support to the emulator's register fetch and writeback
KVM: x86: Add emulator support for decoding VEX prefixes
KVM: x86: Enable support for emulating AVX MOV instructions
Pawan Gupta (1):
x86/bugs: Use VM_CLEAR_CPU_BUFFERS in VMX as well
Sean Christopherson (18):
KVM: x86: Add a helper to dedup reporting of unhandled VM-Exits
KVM: TDX: Explicitly set user-return MSRs that *may* be clobbered by the TDX-Module
KVM: x86: WARN if user-return MSR notifier is registered on exit
KVM: x86: Leave user-return notifier registered on reboot/shutdown
KVM: x86: Use "checked" versions of get_user() and put_user()
KVM: x86: WARN if hrtimer callback for periodic APIC timer fires with period=0
KVM: x86: Grab lapic_timer in a local variable to cleanup periodic code
KVM: VMX: Use on-stack copy of @flags in __vmx_vcpu_run()
x86/bugs: Decouple ALTERNATIVE usage from VERW macro definition x86/bugs: Use an x86 feature to track the MMIO Stale Data mitigation
KVM: VMX: Handle MMIO Stale Data in VM-Enter assembly via ALTERNATIVES_2 x86/bugs: KVM: Move VM_CLEAR_CPU_BUFFERS into SVM as SVM_CLEAR_CPU_BUFFERS
KVM: VMX: Bundle all L1 data cache flush mitigation code together
KVM: VMX: Disable L1TF L1 data cache flush if CONFIG_CPU_MITIGATIONS=n
KVM: SVM: Handle #MCs in guest outside of fastpath
KVM: VMX: Handle #MCs on VM-Enter/TD-Enter outside of the fastpath
KVM: x86: Load guest/host XCR0 and XSS outside of the fastpath run loop
KVM: x86: Load guest/host PKRU outside of the fastpath run loop
Yue Haibing (1):
KVM: x86: Remove unused declaration kvm_mmu_may_ignore_guest_pat()
fuqiang wang (2):
KVM: x86: Explicitly set new periodic hrtimer expiration in apic_timer_fn()
KVM: x86: Fix VM hard lockup after prolonged inactivity with periodic HV timer
arch/x86/include/asm/cpufeatures.h | 5 ++ arch/x86/include/asm/hardirq.h | 4 +- arch/x86/include/asm/kvm_host.h | 7 +-- arch/x86/include/asm/nospec-branch.h | 30 ++++++------ arch/x86/kernel/cpu/bugs.c | 22 ++++----- arch/x86/kvm/emulate.c | 319 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------- arch/x86/kvm/fpu.h | 66 +++++++++++++++++++++++++++ arch/x86/kvm/hyperv.c | 2 +- arch/x86/kvm/kvm_emulate.h | 20 ++++++-- arch/x86/kvm/lapic.c | 44 ++++++++++++------ arch/x86/kvm/mmu.h | 2 - arch/x86/kvm/mmu/mmu.c | 2 +- arch/x86/kvm/mmu/paging_tmpl.h | 2 +- arch/x86/kvm/mmu/spte.c | 2 +- arch/x86/kvm/svm/svm.c | 27 ++++------- arch/x86/kvm/svm/vmenter.S | 6 ++- arch/x86/kvm/vmx/nested.c | 2 +- arch/x86/kvm/vmx/run_flags.h | 10 ++-- arch/x86/kvm/vmx/tdx.c | 65 ++++++++++---------------- arch/x86/kvm/vmx/tdx.h | 1 - arch/x86/kvm/vmx/vmenter.S | 29 +++++++----- arch/x86/kvm/vmx/vmx.c | 264 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------- arch/x86/kvm/x86.c | 259 +++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------- arch/x86/kvm/x86.h | 16 ++++++- 24 files changed, 706 insertions(+), 500 deletions(-)
Paolo Bonzini
maintainerRe: [GIT PULL] KVM: x86: Misc changes for 6.19
Quoted 9 lines · Sean Christopherson
The bulk of the vendor agnostic x86 changes for 6.19. There are multiple noteworthy changes, though nothing stands out as being _that_ much more interesting than the rest.
The following changes since commit
211ddde0823f1442e4ad052a2f30f050145ccada:Linux 6.18-rc2 (2025-10-19 15:19:16 -1000)
Quoted 7 lines
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-misc-6.19
for you to fetch changes up to
c09816f2afce0f89f176c4bc58dc57ec9f204998:KVM: x86: Remove unused declaration
kvm_mmu_may_ignore_guest_pat()(2025-11-20 07:26:35 -0800)
Pulled, thanks.
Paolo
Quoted 128 lines
----------------------------------------------------------------
KVM x86 misc changes for 6.19:- Fix an async #PF bug where KVM would clear the completion queue when the guest transitioned in and out of paging mode, e.g. when handling an SMI and then returning to paged mode via RSM.
- Fix a bug where TDX would effectively corrupt user-return MSR values if the TDX Module rejects VP.ENTER and thus doesn't clobber host MSRs as expected.
- Leave the user-return notifier used to restore MSRs registered when disabling virtualization, and instead pin kvm.ko. Restoring host MSRs via IPI callback is either pointless (clean reboot) or dangerous (forced reboot) since KVM has no idea what code it's interrupting.
- Use the checked version of {get,put}_user(), as Linus wants to kill them off, and they're measurably faster on modern CPUs due to the unchecked versions containing an LFENCE.
- Fix a long-lurking bug where KVM's lack of catch-up logic for periodic APIC timers can result in a hard lockup in the host.
- Revert the periodic kvmclock sync logic now that KVM doesn't use a clocksource that's subject to NPT corrections.
- Clean up KVM's handling of MMIO Stale Data and L1TF, and bury the latter behind
CONFIG_CPU_MITIGATIONS.- Context switch XCR0, XSS, and PKRU outside of the entry/exit fastpath as the only reason they were handled in the faspath was to paper of a bug in the core #MC code that has long since been fixed.
- Add emulator support for AVX MOV instructions to play nice with emulated devices whose PCI BARs guest drivers like to access with large multi-byte instructions.
----------------------------------------------------------------
Binbin Wu (1):
KVM: x86: Add a helper to dedup loading guest/host XCR0 and XSSBrendan Jackman (1):
KVM: x86: Unify L1TF flushing under per-CPU variableChang S. Bae (1):
KVM: x86: Refactor REX prefix handling in instruction emulationChao Gao (1):
KVM: x86: Allocate/freeuser_return_msrsat kvm.ko (un)loading timeHou Wenlong (1):
KVM: x86: Don't disable IRQs when unregistering user-return notifierLei Chen (3):
Revert "x86: kvm: introduce periodic global clock updates" Revert "x86: kvm: rate-limit global clock updates"
KVM: x86: remove comment about ntp correction sync forMaxim Levitsky (2):
KVM: x86: Fix a semi theoretical bug inkvm_arch_async_page_present_queued()
KVM: x86: Don't clear async #PF queue when CR0.PG is disabled (e.g. on #SMI)Paolo Bonzini (9):
KVM: x86: Add support for emulating MOVNTDQA
KVM: x86: Move Src2Shift up one bit (use bits 36:32 for Src2 in the emulator)
KVM: x86: Improve formatting of the emulator's flags table
KVM: x86: Moveop_prefixto structx86_emulate_ctxt(fromx86_decode_insn())
KVM: x86: Share emulator's common register decoding code
KVM: x86: Addx86_emulate_ops.get_xcr()callback
KVM: x86: Add AVX support to the emulator's register fetch and writeback
KVM: x86: Add emulator support for decoding VEX prefixes
KVM: x86: Enable support for emulating AVX MOV instructionsPawan Gupta (1):
x86/bugs: UseVM_CLEAR_CPU_BUFFERSin VMX as wellSean Christopherson (18):
KVM: x86: Add a helper to dedup reporting of unhandled VM-Exits
KVM: TDX: Explicitly set user-return MSRs that *may* be clobbered by the TDX-Module
KVM: x86: WARN if user-return MSR notifier is registered on exit
KVM: x86: Leave user-return notifier registered on reboot/shutdown
KVM: x86: Use "checked" versions ofget_user()andput_user()
KVM: x86: WARN if hrtimer callback for periodic APIC timer fires with period=0
KVM: x86: Grablapic_timerin a local variable to cleanup periodic code
KVM: VMX: Use on-stack copy of @flags in__vmx_vcpu_run()
x86/bugs: Decouple ALTERNATIVE usage from VERW macro definition x86/bugs: Use an x86 feature to track the MMIO Stale Data mitigation
KVM: VMX: Handle MMIO Stale Data in VM-Enter assembly viaALTERNATIVES_2x86/bugs: KVM: MoveVM_CLEAR_CPU_BUFFERSinto SVM asSVM_CLEAR_CPU_BUFFERS
KVM: VMX: Bundle all L1 data cache flush mitigation code together
KVM: VMX: Disable L1TF L1 data cache flush ifCONFIG_CPU_MITIGATIONS=n
KVM: SVM: Handle #MCs in guest outside of fastpath
KVM: VMX: Handle #MCs on VM-Enter/TD-Enter outside of the fastpath
KVM: x86: Load guest/host XCR0 and XSS outside of the fastpath run loop
KVM: x86: Load guest/host PKRU outside of the fastpath run loopYue Haibing (1):
KVM: x86: Remove unused declarationkvm_mmu_may_ignore_guest_pat()fuqiang wang (2):
KVM: x86: Explicitly set new periodic hrtimer expiration inapic_timer_fn()
KVM: x86: Fix VM hard lockup after prolonged inactivity with periodic HV timerarch/x86/include/asm/cpufeatures.h | 5 ++ arch/x86/include/asm/hardirq.h | 4 +- arch/x86/include/asm/kvm_host.h | 7 +-- arch/x86/include/asm/nospec-branch.h | 30 ++++++------ arch/x86/kernel/cpu/bugs.c | 22 ++++----- arch/x86/kvm/emulate.c | 319 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------- arch/x86/kvm/fpu.h | 66 +++++++++++++++++++++++++++ arch/x86/kvm/hyperv.c | 2 +- arch/x86/kvm/kvm_emulate.h | 20 ++++++-- arch/x86/kvm/lapic.c | 44 ++++++++++++------ arch/x86/kvm/mmu.h | 2 - arch/x86/kvm/mmu/mmu.c | 2 +- arch/x86/kvm/mmu/paging_tmpl.h | 2 +- arch/x86/kvm/mmu/spte.c | 2 +- arch/x86/kvm/svm/svm.c | 27 ++++------- arch/x86/kvm/svm/vmenter.S | 6 ++- arch/x86/kvm/vmx/nested.c | 2 +- arch/x86/kvm/vmx/run_flags.h | 10 ++-- arch/x86/kvm/vmx/tdx.c | 65 ++++++++++---------------- arch/x86/kvm/vmx/tdx.h | 1 - arch/x86/kvm/vmx/vmenter.S | 29 +++++++----- arch/x86/kvm/vmx/vmx.c | 264 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------- arch/x86/kvm/x86.c | 259 +++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------- arch/x86/kvm/x86.h | 16 ++++++- 24 files changed, 706 insertions(+), 500 deletions(-)
Sean Christopherson
maintainer[GIT PULL] KVM: x86: MMU changes for 6.19
In reply to Sean ChristophersonAn optimization for enable_mmio_caching=0 and a minor cleanup.
The following changes since commit 3a8660878839faadb4f1a6dd72c3179c1df56787:
Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-mmu-6.19
for you to fetch changes up to 6422060aa9c7bb2039b23948db5d4e8194036657:
KVM: x86/mmu: Move the misplaced export of kvm_zap_gfn_range() (2025-11-04 09:51:06 -0800)
----------------------------------------------------------------
KVM x86 MMU changes for 6.19:
- Skip the costly "zap all SPTEs" on an MMIO generation wrap if MMIO SPTE caching is disabled, as there can't be any relevant SPTEs to zap.
- Relocate a misplace export.
----------------------------------------------------------------
Dmytro Maluka (1):
KVM: x86/mmu: Skip MMIO SPTE invalidation if enable_mmio_caching=0
Kai Huang (1):
KVM: x86/mmu: Move the misplaced export of kvm_zap_gfn_range()
arch/x86/kvm/mmu/mmu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Paolo Bonzini
maintainerRe: [GIT PULL] KVM: x86: MMU changes for 6.19
Quoted 7 lines · Sean Christopherson
An optimization for enable_mmio_caching=0 and a minor cleanup.
The following changes since commit
3a8660878839faadb4f1a6dd72c3179c1df56787:Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)
Quoted 7 lines
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-mmu-6.19
for you to fetch changes up to
6422060aa9c7bb2039b23948db5d4e8194036657:KVM: x86/mmu: Move the misplaced export of
kvm_zap_gfn_range()(2025-11-04 09:51:06 -0800)
Pulled, thanks.
Paolo
Quoted 18 lines
----------------------------------------------------------------
KVM x86 MMU changes for 6.19:- Skip the costly "zap all SPTEs" on an MMIO generation wrap if MMIO SPTE caching is disabled, as there can't be any relevant SPTEs to zap.
- Relocate a misplace export.
----------------------------------------------------------------
Dmytro Maluka (1):
KVM: x86/mmu: Skip MMIO SPTE invalidation if enable_mmio_caching=0Kai Huang (1):
KVM: x86/mmu: Move the misplaced export ofkvm_zap_gfn_range()arch/x86/kvm/mmu/mmu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Sean Christopherson
maintainer[GIT PULL] KVM: x86: Selftests changes for 6.19
In reply to Sean ChristophersonThe highlights are Jim's LA57 nested VMX test, and Yosry's many changes to extend nested VMX tests to also cover nested SVM.
The following changes since commit 211ddde0823f1442e4ad052a2f30f050145ccada:
Linux 6.18-rc2 (2025-10-19 15:19:16 -1000)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-selftests-6.19
for you to fetch changes up to d2e50389ab44acfa05e72604d701a70b234f9938:
KVM: selftests: Make sure vm->vpages_mapped is always up-to-date (2025-11-21 10:17:05 -0800)
----------------------------------------------------------------
KVM selftests changes for 6.19:
- Fix a math goof in mmu_stress_test when running on a single-CPU system/VM.
- Forcefully override ARCH from x86_64 to x86 to play nice with specifying ARCH=x86_64 on the command line.
- Extend a bunch of nested VMX to validate nested SVM as well.
- Add support for LA57 in the core VM_MODE_xxx macro, and add a test to verify KVM can save/restore nested VMX state when L1 is using 5-level paging, but L2 is not.
- Clean up the guest paging code in anticipation of sharing the core logic for nested EPT and nested NPT.
----------------------------------------------------------------
Brendan Jackman (1):
KVM: selftests: Don't fall over in mmu_stress_test when only one CPU is present
Jim Mattson (4):
KVM: selftests: Use a loop to create guest page tables
KVM: selftests: Use a loop to walk guest page tables
KVM: selftests: Change VM_MODE_PXXV48_4K to VM_MODE_PXXVYY_4K
KVM: selftests: Add a VMX test for LA57 nested state
Sean Christopherson (2):
KVM: selftests: Forcefully override ARCH from x86_64 to x86
KVM: selftests: Use "gpa" and "gva" for local variable names in pre-fault test
Yosry Ahmed (9):
KVM: selftests: Extend vmx_close_while_nested_test to cover SVM
KVM: selftests: Extend vmx_nested_tsc_scaling_test to cover SVM
KVM: selftests: Move nested invalid CR3 check to its own test
KVM: selftests: Extend nested_invalid_cr3_test to cover SVM
KVM: selftests: Extend vmx_tsc_adjust_test to cover SVM
KVM: selftests: Stop hardcoding PAGE_SIZE in x86 selftests
KVM: selftests: Remove the unused argument to prepare_eptp()
KVM: selftests: Stop using __virt_pg_map() directly in tests
KVM: selftests: Make sure vm->vpages_mapped is always up-to-date
tools/testing/selftests/kvm/Makefile | 2 +-
tools/testing/selftests/kvm/Makefile.kvm | 8 +-
tools/testing/selftests/kvm/include/kvm_util.h | 5 +-
.../testing/selftests/kvm/include/x86/processor.h | 2 +-
tools/testing/selftests/kvm/include/x86/vmx.h | 3 +-
tools/testing/selftests/kvm/lib/arm64/processor.c | 2 +-
tools/testing/selftests/kvm/lib/kvm_util.c | 33 +++---
tools/testing/selftests/kvm/lib/x86/memstress.c | 2 +-
tools/testing/selftests/kvm/lib/x86/processor.c | 84 ++++++-------
tools/testing/selftests/kvm/lib/x86/vmx.c | 9 +-
tools/testing/selftests/kvm/mmu_stress_test.c | 10 +-
.../testing/selftests/kvm/pre_fault_memory_test.c | 32 +++--
tools/testing/selftests/kvm/x86/hyperv_features.c | 2 +-
tools/testing/selftests/kvm/x86/hyperv_ipi.c | 18 +--
tools/testing/selftests/kvm/x86/hyperv_tlb_flush.c | 2 +-
...while_nested_test.c => nested_close_kvm_test.c} | 42 +++++--
.../selftests/kvm/x86/nested_invalid_cr3_test.c | 116 ++++++++++++++++++
..._tsc_adjust_test.c => nested_tsc_adjust_test.c} | 73 +++++++-----
...sc_scaling_test.c => nested_tsc_scaling_test.c} | 48 +++++++-
tools/testing/selftests/kvm/x86/sev_smoke_test.c | 2 +-
tools/testing/selftests/kvm/x86/state_test.c | 2 +-
.../testing/selftests/kvm/x86/userspace_io_test.c | 2 +-
.../testing/selftests/kvm/x86/vmx_dirty_log_test.c | 12 +-
.../selftests/kvm/x86/vmx_nested_la57_state_test.c | 132 +++++++++++++++++++++
24 files changed, 479 insertions(+), 164 deletions(-)
rename tools/testing/selftests/kvm/x86/{vmx_close_while_nested_test.c => nested_close_kvm_test.c} (64%)
create mode 100644 tools/testing/selftests/kvm/x86/nested_invalid_cr3_test.c
rename tools/testing/selftests/kvm/x86/{vmx_tsc_adjust_test.c => nested_tsc_adjust_test.c} (61%)
rename tools/testing/selftests/kvm/x86/{vmx_nested_tsc_scaling_test.c => nested_tsc_scaling_test.c} (83%)
create mode 100644 tools/testing/selftests/kvm/x86/vmx_nested_la57_state_test.cPaolo Bonzini
maintainerRe: [GIT PULL] KVM: x86: Selftests changes for 6.19
Quoted 8 lines · Sean Christopherson
The highlights are Jim's LA57 nested VMX test, and Yosry's many changes to extend nested VMX tests to also cover nested SVM.
The following changes since commit
211ddde0823f1442e4ad052a2f30f050145ccada:Linux 6.18-rc2 (2025-10-19 15:19:16 -1000)
Quoted 7 lines
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-selftests-6.19
for you to fetch changes up to
d2e50389ab44acfa05e72604d701a70b234f9938:KVM: selftests: Make sure
vm->vpages_mappedis always up-to-date (2025-11-21 10:17:05 -0800)
Pulled, thanks.
Paolo
Quoted 73 lines
----------------------------------------------------------------
KVM selftests changes for 6.19:- Fix a math goof in
mmu_stress_testwhen running on a single-CPU system/VM.- Forcefully override ARCH from
x86_64to x86 to play nice with specifying ARCH=x86_64 on the command line.- Extend a bunch of nested VMX to validate nested SVM as well.
- Add support for LA57 in the core
VM_MODE_xxxmacro, and add a test to verify KVM can save/restore nested VMX state when L1 is using 5-level paging, but L2 is not.- Clean up the guest paging code in anticipation of sharing the core logic for nested EPT and nested NPT.
----------------------------------------------------------------
Brendan Jackman (1):
KVM: selftests: Don't fall over inmmu_stress_testwhen only one CPU is presentJim Mattson (4):
KVM: selftests: Use a loop to create guest page tables
KVM: selftests: Use a loop to walk guest page tables
KVM: selftests: ChangeVM_MODE_PXXV48_4KtoVM_MODE_PXXVYY_4K
KVM: selftests: Add a VMX test for LA57 nested stateSean Christopherson (2):
KVM: selftests: Forcefully override ARCH fromx86_64to x86
KVM: selftests: Use "gpa" and "gva" for local variable names in pre-fault testYosry Ahmed (9):
KVM: selftests: Extendvmx_close_while_nested_testto cover SVM
KVM: selftests: Extendvmx_nested_tsc_scaling_testto cover SVM
KVM: selftests: Move nested invalid CR3 check to its own test
KVM: selftests: Extendnested_invalid_cr3_testto cover SVM
KVM: selftests: Extendvmx_tsc_adjust_testto cover SVM
KVM: selftests: Stop hardcodingPAGE_SIZEin x86 selftests
KVM: selftests: Remove the unused argument toprepare_eptp()
KVM: selftests: Stop using__virt_pg_map()directly in tests
KVM: selftests: Make surevm->vpages_mappedis always up-to-datetools/testing/selftests/kvm/Makefile | 2 +- tools/testing/selftests/kvm/Makefile.kvm | 8 +- tools/testing/selftests/kvm/include/kvm_util.h | 5 +- .../testing/selftests/kvm/include/x86/processor.h | 2 +- tools/testing/selftests/kvm/include/x86/vmx.h | 3 +- tools/testing/selftests/kvm/lib/arm64/processor.c | 2 +- tools/testing/selftests/kvm/lib/kvm_util.c | 33 +++--- tools/testing/selftests/kvm/lib/x86/memstress.c | 2 +- tools/testing/selftests/kvm/lib/x86/processor.c | 84 ++++++------- tools/testing/selftests/kvm/lib/x86/vmx.c | 9 +- tools/testing/selftests/kvm/mmu_stress_test.c | 10 +- .../testing/selftests/kvm/pre_fault_memory_test.c | 32 +++-- tools/testing/selftests/kvm/x86/hyperv_features.c | 2 +- tools/testing/selftests/kvm/x86/hyperv_ipi.c | 18 +-- tools/testing/selftests/kvm/x86/hyperv_tlb_flush.c | 2 +- ...while_nested_test.c => nested_close_kvm_test.c} | 42 +++++-- .../selftests/kvm/x86/nested_invalid_cr3_test.c | 116 ++++++++++++++++++ ..._tsc_adjust_test.c => nested_tsc_adjust_test.c} | 73 +++++++----- ...sc_scaling_test.c => nested_tsc_scaling_test.c} | 48 +++++++- tools/testing/selftests/kvm/x86/sev_smoke_test.c | 2 +- tools/testing/selftests/kvm/x86/state_test.c | 2 +- .../testing/selftests/kvm/x86/userspace_io_test.c | 2 +- .../testing/selftests/kvm/x86/vmx_dirty_log_test.c | 12 +- .../selftests/kvm/x86/vmx_nested_la57_state_test.c | 132 +++++++++++++++++++++ 24 files changed, 479 insertions(+), 164 deletions(-) rename tools/testing/selftests/kvm/x86/{vmx_close_while_nested_test.c => nested_close_kvm_test.c} (64%) create mode 100644 tools/testing/selftests/kvm/x86/nested_invalid_cr3_test.c rename tools/testing/selftests/kvm/x86/{vmx_tsc_adjust_test.c => nested_tsc_adjust_test.c} (61%) rename tools/testing/selftests/kvm/x86/{vmx_nested_tsc_scaling_test.c => nested_tsc_scaling_test.c} (83%) create mode 100644 tools/testing/selftests/kvm/x86/vmx_nested_la57_state_test.c
Sean Christopherson
maintainer[GIT PULL] KVM: x86: SVM changes for 6.19
In reply to Sean ChristophersonA handful of lowish priority nSVM fixes, AVIC support for 4k vCPUs, and new uAPI to advertise SNP policy bits to userspace.
Side topic, this pull request is finally proof that I don't just merge my own stuff :-D
There's a minor conflict in svm.h due to the removal of the avic_ga_log_notifier() declaration in kvm/master:
arch/x86/kvm/svm/svm.h +0 -0
@@@ -806,7 -802,8 +803,8 @@@ extern struct kvm_x86_nested_ops svm_ne )bool __init avic_hardware_setup (void ); -int avic_ga_log_notifier(u32 ga_tag); +void avic_hardware_unsetup(void); +int avic_alloc_physical_id_table (struct kvm *kvm);void avic_vm_destroy (struct kvm *kvm);int avic_vm_init (struct kvm *kvm);void avic_init_vmcb (struct vcpu_svm *svm,struct vmcb *vmcb);
And a conflict in cpufeatures.h with the "misc" pull request. This (and the change from "misc") will also conflict with new features being added via the tip-tree. Boris is aware and presumably will give Linus a heads up. Merging on top of "misc":
arch/x86/include/asm/cpufeatures.h +0 -0
@@@ -499,11 -500,7 +500,12 @@@#define X86_FEATURE_IBPB_EXIT_TO_USER (21*32+14)/* Use IBPB on exit-to-userspace, see VMSCAPE bug */ #define X86_FEATURE_ABMC (21*32+15)/* Assignable Bandwidth Monitoring Counters */ #define X86_FEATURE_MSR_IMM (21*32+16)/* MSR immediate form instructions */ -#define X86_FEATURE_CLEAR_CPU_BUF_VM_MMIO (21*32+17)/* +#define X86_FEATURE_X2AVIC_EXT (21*32+17)/* AMD SVM x2AVIC support for 4k vCPUs */ ++#define X86_FEATURE_CLEAR_CPU_BUF_VM_MMIO (21*32+18) /*+ * Clear CPU buffers before VM-Enter if the vCPU + * can access host MMIO (ignored for all intents + * and purposes if CLEAR_CPU_BUF_VM is set). + */ /* * BUG word(s)
The following changes since commit 3a8660878839faadb4f1a6dd72c3179c1df56787:
Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-svm-6.19
for you to fetch changes up to 275d6d1189e6d5f8e7c1da43ffd4b09d7089f174:
KVM: SEV: Add known supported SEV-SNP policy bits (2025-11-14 10:30:12 -0800)
----------------------------------------------------------------
KVM SVM changes for 6.19:
- Fix a few missing "VMCB dirty" bugs.
- Fix the worst of KVM's lack of EFER.LMSLE emulation.
- Add AVIC support for addressing 4k vCPUs in x2AVIC mode.
- Fix incorrect handling of selective CR0 writes when checking intercepts during emulation of L2 instructions.
- Fix a currently-benign bug where KVM would clobber SPEC_CTRL[63:32] on VMRUN and #VMEXIT.
- Fix a bug where KVM corrupt the guest code stream when re-injecting a soft interrupt if the guest patched the underlying code after the VM-Exit, e.g. when Linux patches code with a temporary INT3.
- Add KVM_X86_SNP_POLICY_BITS to advertise supported SNP policy bits to userspace, and extend KVM "support" to all policy bits that don't require any actual support from KVM.
----------------------------------------------------------------
Jim Mattson (4):
KVM: SVM: Mark VMCB_PERM_MAP as dirty on nested VMRUN
KVM: SVM: Mark VMCB_NPT as dirty on nested VMRUN
KVM: x86: Advertise EferLmsleUnsupported to userspace
KVM: SVM: Disallow EFER.LMSLE when not supported by hardware
Naveen N Rao (7):
KVM: SVM: Limit AVIC physical max index based on configured max_vcpu_ids
KVM: SVM: Add a helper to look up the max physical ID for AVIC
KVM: SVM: Replace hard-coded value 0x1FF with the corresponding macro
KVM: SVM: Expand AVIC_PHYSICAL_MAX_INDEX_MASK to be a 12-bit field
KVM: SVM: Move AVIC Physical ID table allocation to vcpu_precreate() x86/cpufeatures: Add X86_FEATURE_X2AVIC_EXT
KVM: SVM: Add AVIC support for 4k vCPUs in x2AVIC mode
Omar Sandoval (1):
KVM: SVM: Don't skip unrelated instruction if INT3/INTO is replaced
Tom Lendacky (4):
KVM: SEV: Consolidate the SEV policy bits in a single header file
crypto: ccp - Add an API to return the supported SEV-SNP policy bits
KVM: SEV: Publish supported SEV-SNP policy bits
KVM: SEV: Add known supported SEV-SNP policy bits
Uros Bizjak (1):
KVM: SVM: Ensure SPEC_CTRL[63:32] is context switched between guest and host
Yosry Ahmed (4):
KVM: nSVM: Remove redundant cases in nested_svm_intercept()
KVM: nSVM: Propagate SVM_EXIT_CR0_SEL_WRITE correctly for LMSW emulation
KVM: nSVM: Avoid incorrect injection of SVM_EXIT_CR0_SEL_WRITE
KVM: x86: Document a virtualization gap for GIF on AMD CPUs
Documentation/virt/kvm/x86/errata.rst | 9 +++- arch/x86/include/asm/cpufeatures.h | 2 + arch/x86/include/asm/kvm_host.h | 9 ++++ arch/x86/include/asm/svm.h | 5 +- arch/x86/include/uapi/asm/kvm.h | 1 + arch/x86/kernel/cpu/scattered.c | 1 + arch/x86/kvm/cpuid.c | 1 + arch/x86/kvm/svm/avic.c | 86 ++++++++++++++++++++++++++++------- arch/x86/kvm/svm/nested.c | 12 +---- arch/x86/kvm/svm/sev.c | 45 +++++++++++------- arch/x86/kvm/svm/svm.c | 78 ++++++++++++++++++++----------- arch/x86/kvm/svm/svm.h | 4 +- arch/x86/kvm/svm/vmenter.S | 47 +++++++++++++++---- arch/x86/kvm/x86.c | 21 +++++++++ drivers/crypto/ccp/sev-dev.c | 37 +++++++++++++++ include/linux/psp-sev.h | 37 +++++++++++++++ 16 files changed, 310 insertions(+), 85 deletions(-)
Paolo Bonzini
maintainerRe: [GIT PULL] KVM: x86: SVM changes for 6.19
Quoted 6 lines · Sean Christopherson
A handful of lowish priority nSVM fixes, AVIC support for 4k vCPUs, and new uAPI to advertise SNP policy bits to userspace.
Side topic, this pull request is finally proof that I don't just merge my own stuff :-D
What do you mean? Is there anything you want me to review?
Paolo
Sean Christopherson
maintainerRe: [GIT PULL] KVM: x86: SVM changes for 6.19
Quoted 9 lines · Paolo Bonzini
Quoted 6 lines · Sean Christopherson
A handful of lowish priority nSVM fixes, AVIC support for 4k vCPUs, and new uAPI to advertise SNP policy bits to userspace.
Side topic, this pull request is finally proof that I don't just merge my own stuff :-D
What do you mean? Is there anything you want me to review?
Oh, it was purely a joke. I don't have any commits in this particular pull request, and that caught my eye when looking at the shortlog.
Sean Christopherson
maintainer[GIT PULL] KVM: x86: TDX changes for 6.19
In reply to Sean ChristophersonPlease pull a large overhaul of lock-related TDX code (particularly in the S-EPT and mirror SPTE code), along with a few fixes and cleanups.
*Huge* kudos to Rick, Yan, Binbin, Ira, and Kai (hopefully I didn't forget anyone) for their meticulous reviews, testing and debug, clever testcases, and help determining exactly what scenarios KVM needs to deal with in terms of avoiding lock contention in the TDX Module.
P.S. There are few one-off TDX changes in the "vmx" pull request. I don't
expect to have a dedicated TDX pull request for most releases, I created one this time around because of the scope of the overhaul.
The following changes since commit 6146a0f1dfae5d37442a9ddcba012add260bceb0:
Linux 6.18-rc4 (2025-11-02 11:28:02 -0800)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-tdx-6.19
for you to fetch changes up to 398180f93cf3c7bb0ee3f512b139ad01843f3ddf:
KVM: TDX: Use struct_size to simplify tdx_get_capabilities() (2025-11-13 08:30:07 -0800)
----------------------------------------------------------------
KVM TDX changes for 6.19:
- Overhaul the TDX code to address systemic races where KVM (acting on behalf of userspace) could inadvertantly trigger lock contention in the TDX-Module, which KVM was either working around in weird, ugly ways, or was simply oblivious to (as proven by Yan tripping several KVM_BUG_ON()s with clever selftests).
- Fix a bug where KVM could corrupt a vCPU's cpu_list when freeing a vCPU if creating said vCPU failed partway through.
- Fix a few sparse warnings (bad annotation, 0 != NULL).
- Use struct_size() to simplify copying capabilities to userspace.
----------------------------------------------------------------
Dave Hansen (2):
KVM: TDX: Remove __user annotation from kernel pointer
KVM: TDX: Fix sparse warnings from using 0 for NULL
Rick Edgecombe (1):
KVM: TDX: Take MMU lock around tdh_vp_init()
Sean Christopherson (27):
KVM: Make support for kvm_arch_vcpu_async_ioctl() mandatory
KVM: Rename kvm_arch_vcpu_async_ioctl() to kvm_arch_vcpu_unlocked_ioctl()
KVM: TDX: Drop PROVE_MMU=y sanity check on to-be-populated mappings
KVM: x86/mmu: Add dedicated API to map guest_memfd pfn into TDP MMU
KVM: x86/mmu: WARN if KVM attempts to map into an invalid TDP MMU root Revert "KVM: x86/tdp_mmu: Add a helper function to walk down the TDP MMU"
KVM: x86/mmu: Rename kvm_tdp_map_page() to kvm_tdp_page_prefault()
KVM: TDX: Return -EIO, not -EINVAL, on a KVM_BUG_ON() condition
KVM: TDX: Fold tdx_sept_drop_private_spte() into tdx_sept_remove_private_spte()
KVM: x86/mmu: Drop the return code from kvm_x86_ops.remove_external_spte()
KVM: TDX: WARN if mirror SPTE doesn't have full RWX when creating S-EPT mapping
KVM: TDX: Avoid a double-KVM_BUG_ON() in tdx_sept_zap_private_spte()
KVM: TDX: Use atomic64_dec_return() instead of a poor equivalent
KVM: TDX: Fold tdx_mem_page_record_premap_cnt() into its sole caller
KVM: TDX: ADD pages to the TD image while populating mirror EPT entries
KVM: TDX: Fold tdx_sept_zap_private_spte() into tdx_sept_remove_private_spte()
KVM: TDX: Combine KVM_BUG_ON + pr_tdx_error() into TDX_BUG_ON()
KVM: TDX: Derive error argument names from the local variable names
KVM: TDX: Assert that mmu_lock is held for write when removing S-EPT entries
KVM: TDX: Add macro to retry SEAMCALLs when forcing vCPUs out of guest
KVM: TDX: Add tdx_get_cmd() helper to get and validate sub-ioctl command
KVM: TDX: Convert INIT_MEM_REGION and INIT_VCPU to "unlocked" vCPU ioctl
KVM: TDX: Use guard() to acquire kvm->lock in tdx_vm_ioctl()
KVM: TDX: Don't copy "cmd" back to userspace for KVM_TDX_CAPABILITIES
KVM: TDX: Guard VM state transitions with "all" the locks
KVM: TDX: Bug the VM if extending the initial measurement fails
KVM: TDX: Use struct_size to simplify tdx_get_capabilities()
Thorsten Blum (1):
KVM: TDX: Check size of user's kvm_tdx_capabilities array before allocating
Yan Zhao (2):
KVM: TDX: Drop superfluous page pinning in S-EPT management
KVM: TDX: Fix list_add corruption during vcpu_load()
arch/arm64/kvm/arm.c | 6 + arch/loongarch/kvm/Kconfig | 1 - arch/loongarch/kvm/vcpu.c | 4 +- arch/mips/kvm/Kconfig | 1 - arch/mips/kvm/mips.c | 4 +- arch/powerpc/kvm/Kconfig | 1 - arch/powerpc/kvm/powerpc.c | 4 +- arch/riscv/kvm/Kconfig | 1 - arch/riscv/kvm/vcpu.c | 4 +- arch/s390/kvm/Kconfig | 1 - arch/s390/kvm/kvm-s390.c | 4 +- arch/x86/include/asm/kvm-x86-ops.h | 1 + arch/x86/include/asm/kvm_host.h | 7 +- arch/x86/kvm/mmu.h | 3 +- arch/x86/kvm/mmu/mmu.c | 87 ++++- arch/x86/kvm/mmu/tdp_mmu.c | 50 +-- arch/x86/kvm/vmx/main.c | 9 + arch/x86/kvm/vmx/tdx.c | 712 ++++++++++++++++++------------------- arch/x86/kvm/vmx/tdx.h | 8 +- arch/x86/kvm/vmx/x86_ops.h | 1 + arch/x86/kvm/x86.c | 13 + include/linux/kvm_host.h | 14 +- virt/kvm/Kconfig | 3 - virt/kvm/kvm_main.c | 6 +- 24 files changed, 496 insertions(+), 449 deletions(-)
Paolo Bonzini
maintainerRe: [GIT PULL] KVM: x86: TDX changes for 6.19
Quoted 17 lines · Sean Christopherson
Please pull a large overhaul of lock-related TDX code (particularly in the S-EPT and mirror SPTE code), along with a few fixes and cleanups.
*Huge* kudos to Rick, Yan, Binbin, Ira, and Kai (hopefully I didn't forget anyone) for their meticulous reviews, testing and debug, clever testcases, and help determining exactly what scenarios KVM needs to deal with in terms of avoiding lock contention in the TDX Module.
P.S. There are few one-off TDX changes in the "vmx" pull request. I don't
expect to have a dedicated TDX pull request for most releases, I created one this time around because of the scope of the overhaul.The following changes since commit
6146a0f1dfae5d37442a9ddcba012add260bceb0:Linux 6.18-rc4 (2025-11-02 11:28:02 -0800)
Quoted 7 lines
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-tdx-6.19
for you to fetch changes up to
398180f93cf3c7bb0ee3f512b139ad01843f3ddf:KVM: TDX: Use
struct_sizeto simplifytdx_get_capabilities()(2025-11-13 08:30:07 -0800)
Pulled, thanks.
Paolo
Quoted 86 lines
----------------------------------------------------------------
KVM TDX changes for 6.19:- Overhaul the TDX code to address systemic races where KVM (acting on behalf of userspace) could inadvertantly trigger lock contention in the TDX-Module, which KVM was either working around in weird, ugly ways, or was simply oblivious to (as proven by Yan tripping several KVM_BUG_ON()s with clever selftests).
- Fix a bug where KVM could corrupt a vCPU's
cpu_listwhen freeing a vCPU if creating said vCPU failed partway through.- Fix a few sparse warnings (bad annotation, 0 != NULL).
- Use
struct_size()to simplify copying capabilities to userspace.----------------------------------------------------------------
Dave Hansen (2):
KVM: TDX: Remove__userannotation from kernel pointer
KVM: TDX: Fix sparse warnings from using 0 for NULLRick Edgecombe (1):
KVM: TDX: Take MMU lock aroundtdh_vp_init()Sean Christopherson (27):
KVM: Make support forkvm_arch_vcpu_async_ioctl()mandatory
KVM: Renamekvm_arch_vcpu_async_ioctl()tokvm_arch_vcpu_unlocked_ioctl()
KVM: TDX: Drop PROVE_MMU=y sanity check on to-be-populated mappings
KVM: x86/mmu: Add dedicated API to mapguest_memfdpfn into TDP MMU
KVM: x86/mmu: WARN if KVM attempts to map into an invalid TDP MMU root Revert "KVM: x86/tdp_mmu: Add a helper function to walk down the TDP MMU"
KVM: x86/mmu: Renamekvm_tdp_map_page()tokvm_tdp_page_prefault()
KVM: TDX: Return-EIO, not-EINVAL, on aKVM_BUG_ON()condition
KVM: TDX: Foldtdx_sept_drop_private_spte()intotdx_sept_remove_private_spte()
KVM: x86/mmu: Drop the return code fromkvm_x86_ops.remove_external_spte()
KVM: TDX: WARN if mirror SPTE doesn't have full RWX when creating S-EPT mapping
KVM: TDX: Avoid a double-KVM_BUG_ON() intdx_sept_zap_private_spte()
KVM: TDX: Useatomic64_dec_return()instead of a poor equivalent
KVM: TDX: Foldtdx_mem_page_record_premap_cnt()into its sole caller
KVM: TDX: ADD pages to the TD image while populating mirror EPT entries
KVM: TDX: Foldtdx_sept_zap_private_spte()intotdx_sept_remove_private_spte()
KVM: TDX: CombineKVM_BUG_ON+pr_tdx_error()intoTDX_BUG_ON()
KVM: TDX: Derive error argument names from the local variable names
KVM: TDX: Assert thatmmu_lockis held for write when removing S-EPT entries
KVM: TDX: Add macro to retry SEAMCALLs when forcing vCPUs out of guest
KVM: TDX: Addtdx_get_cmd()helper to get and validate sub-ioctl command
KVM: TDX: ConvertINIT_MEM_REGIONandINIT_VCPUto "unlocked" vCPU ioctl
KVM: TDX: Useguard()to acquirekvm->lockintdx_vm_ioctl()
KVM: TDX: Don't copy "cmd" back to userspace forKVM_TDX_CAPABILITIES
KVM: TDX: Guard VM state transitions with "all" the locks
KVM: TDX: Bug the VM if extending the initial measurement fails
KVM: TDX: Usestruct_sizeto simplifytdx_get_capabilities()Thorsten Blum (1):
KVM: TDX: Check size of user'skvm_tdx_capabilitiesarray before allocatingYan Zhao (2):
KVM: TDX: Drop superfluous page pinning in S-EPT management
KVM: TDX: Fixlist_addcorruption duringvcpu_load()arch/arm64/kvm/arm.c | 6 + arch/loongarch/kvm/Kconfig | 1 - arch/loongarch/kvm/vcpu.c | 4 +- arch/mips/kvm/Kconfig | 1 - arch/mips/kvm/mips.c | 4 +- arch/powerpc/kvm/Kconfig | 1 - arch/powerpc/kvm/powerpc.c | 4 +- arch/riscv/kvm/Kconfig | 1 - arch/riscv/kvm/vcpu.c | 4 +- arch/s390/kvm/Kconfig | 1 - arch/s390/kvm/kvm-s390.c | 4 +- arch/x86/include/asm/kvm-x86-ops.h | 1 + arch/x86/include/asm/kvm_host.h | 7 +- arch/x86/kvm/mmu.h | 3 +- arch/x86/kvm/mmu/mmu.c | 87 ++++- arch/x86/kvm/mmu/tdp_mmu.c | 50 +-- arch/x86/kvm/vmx/main.c | 9 + arch/x86/kvm/vmx/tdx.c | 712 ++++++++++++++++++------------------- arch/x86/kvm/vmx/tdx.h | 8 +- arch/x86/kvm/vmx/x86_ops.h | 1 + arch/x86/kvm/x86.c | 13 + include/linux/kvm_host.h | 14 +- virt/kvm/Kconfig | 3 - virt/kvm/kvm_main.c | 6 +- 24 files changed, 496 insertions(+), 449 deletions(-)
Sean Christopherson
maintainer[GIT PULL] KVM: x86: VMX changes for 6.19
In reply to Sean ChristophersonThe highlight is EPTP construction cleanup that's worthwhile on its own, but is also a step toward eliding the EPT flushes that KVM does on pCPU migration, which are especially costly when running nested:
https://lore.kernel.org/all/[email protected]
The following changes since commit 3a8660878839faadb4f1a6dd72c3179c1df56787:
Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-vmx-6.19
for you to fetch changes up to dfd1572a64c90770a2bddfab9bbb69932217b1da:
KVM: VMX: Make loaded_vmcs_clear() static in vmx.c (2025-11-11 07:41:16 -0800)
----------------------------------------------------------------
KVM VMX changes for 6.19:
- Use the root role from kvm_mmu_page to construct EPTPs instead of the current vCPU state, partly as worthwhile cleanup, but mostly to pave the way for tracking per-root TLB flushes so that KVM can elide EPT flushes on pCPU migration if KVM has flushed the root at least once.
- Add a few missing nested consistency checks.
- Rip out support for doing "early" consistency checks via hardware as the functionality hasn't been used in years and is no longer useful in general, and replace it with an off-by-default module param to detected missed consistency checks (i.e. WARN if hardware finds a check that KVM does not).
- Fix a currently-benign bug where KVM would drop the guest's SPEC_CTRL[63:32] on VM-Enter.
- Misc cleanups.
----------------------------------------------------------------
Dmytro Maluka (1):
KVM: VMX: Remove stale vmx_set_dr6() declaration
Sean Christopherson (10):
KVM: VMX: Hoist construct_eptp() "up" in vmx.c
KVM: nVMX: Hardcode dummy EPTP used for early nested consistency checks
KVM: x86/mmu: Move "dummy root" helpers to spte.h
KVM: VMX: Use kvm_mmu_page role to construct EPTP, not current vCPU state
KVM: nVMX: Add consistency check for TPR_THRESHOLD[31:4]!=0 without VID
KVM: nVMX: Add consistency check for TSC_MULTIPLIER=0
KVM: nVMX: Stuff vmcs02.TSC_MULTIPLIER early on for nested early checks
KVM: nVMX: Remove support for "early" consistency checks via hardware
KVM: nVMX: Add an off-by-default module param to WARN on missed consistency checks
KVM: VMX: Make loaded_vmcs_clear() static in vmx.c
Thorsten Blum (1):
KVM: TDX: Replace kmalloc + copy_from_user with memdup_user in tdx_td_init()
Uros Bizjak (1):
KVM: VMX: Ensure guest's SPEC_CTRL[63:32] is loaded on VM-Enter
Xin Li (1):
KVM: nVMX: Use vcpu instead of vmx->vcpu when vcpu is available
arch/x86/kvm/mmu/mmu_internal.h | 10 --- arch/x86/kvm/mmu/spte.h | 10 +++ arch/x86/kvm/vmx/nested.c | 173 ++++++++++++++-------------------------- arch/x86/kvm/vmx/tdx.c | 30 +++---- arch/x86/kvm/vmx/vmenter.S | 20 +++-- arch/x86/kvm/vmx/vmx.c | 59 +++++++++----- arch/x86/kvm/vmx/vmx.h | 2 - arch/x86/kvm/vmx/x86_ops.h | 1 - 8 files changed, 135 insertions(+), 170 deletions(-)
Paolo Bonzini
maintainerRe: [GIT PULL] KVM: x86: VMX changes for 6.19
Quoted 11 lines · Sean Christopherson
The highlight is EPTP construction cleanup that's worthwhile on its own, but is also a step toward eliding the EPT flushes that KVM does on pCPU migration, which are especially costly when running nested:
https://lore.kernel.org/all/[email protected]
The following changes since commit
3a8660878839faadb4f1a6dd72c3179c1df56787:Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)
Quoted 7 lines
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-vmx-6.19
for you to fetch changes up to
dfd1572a64c90770a2bddfab9bbb69932217b1da:KVM: VMX: Make
loaded_vmcs_clear()static invmx.c(2025-11-11 07:41:16 -0800)
Pulled; there was another minor conflict due to the introduction of kvm_request_l1tf_flush_l1d().
Paolo
Quoted 55 lines
----------------------------------------------------------------
KVM VMX changes for 6.19:- Use the root role from
kvm_mmu_pageto construct EPTPs instead of the current vCPU state, partly as worthwhile cleanup, but mostly to pave the way for tracking per-root TLB flushes so that KVM can elide EPT flushes on pCPU migration if KVM has flushed the root at least once.- Add a few missing nested consistency checks.
- Rip out support for doing "early" consistency checks via hardware as the functionality hasn't been used in years and is no longer useful in general, and replace it with an off-by-default module param to detected missed consistency checks (i.e. WARN if hardware finds a check that KVM does not).
- Fix a currently-benign bug where KVM would drop the guest's SPEC_CTRL[63:32] on VM-Enter.
- Misc cleanups.
----------------------------------------------------------------
Dmytro Maluka (1):
KVM: VMX: Remove stalevmx_set_dr6()declarationSean Christopherson (10):
KVM: VMX: Hoistconstruct_eptp()"up" invmx.c
KVM: nVMX: Hardcode dummy EPTP used for early nested consistency checks
KVM: x86/mmu: Move "dummy root" helpers tospte.h
KVM: VMX: Usekvm_mmu_pagerole to construct EPTP, not current vCPU state
KVM: nVMX: Add consistency check for TPR_THRESHOLD[31:4]!=0 without VID
KVM: nVMX: Add consistency check for TSC_MULTIPLIER=0
KVM: nVMX: Stuff vmcs02.TSC_MULTIPLIER early on for nested early checks
KVM: nVMX: Remove support for "early" consistency checks via hardware
KVM: nVMX: Add an off-by-default module param to WARN on missed consistency checks
KVM: VMX: Makeloaded_vmcs_clear()static invmx.cThorsten Blum (1):
KVM: TDX: Replace kmalloc +copy_from_userwithmemdup_userintdx_td_init()Uros Bizjak (1):
KVM: VMX: Ensure guest's SPEC_CTRL[63:32] is loaded on VM-EnterXin Li (1):
KVM: nVMX: Use vcpu instead of vmx->vcpu when vcpu is availablearch/x86/kvm/mmu/mmu_internal.h | 10 --- arch/x86/kvm/mmu/spte.h | 10 +++ arch/x86/kvm/vmx/nested.c | 173 ++++++++++++++-------------------------- arch/x86/kvm/vmx/tdx.c | 30 +++---- arch/x86/kvm/vmx/vmenter.S | 20 +++-- arch/x86/kvm/vmx/vmx.c | 59 +++++++++----- arch/x86/kvm/vmx/vmx.h | 2 - arch/x86/kvm/vmx/x86_ops.h | 1 - 8 files changed, 135 insertions(+), 170 deletions(-)
Sean Christopherson
maintainerRe: [GIT PULL] KVM: x86: VMX changes for 6.19
Quoted 14 lines · Paolo Bonzini
Quoted 13 lines · Sean Christopherson
The highlight is EPTP construction cleanup that's worthwhile on its own, but is also a step toward eliding the EPT flushes that KVM does on pCPU migration, which are especially costly when running nested:
https://lore.kernel.org/all/[email protected]
The following changes since commit
3a8660878839faadb4f1a6dd72c3179c1df56787:Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)
are available in the Git repository at:
Quoted 8 lines
Quoted 5 lines
https://github.com/kvm-x86/linux.git tags/kvm-x86-vmx-6.19
for you to fetch changes up to
dfd1572a64c90770a2bddfab9bbb69932217b1da:KVM: VMX: Make
loaded_vmcs_clear()static invmx.c(2025-11-11 07:41:16 -0800)Pulled; there was another minor conflict due to the introduction of
kvm_request_l1tf_flush_l1d().
Shoot, sorry, forgot about that one (obviously).