KVM: x86 (and a PPC) fixes for 7.0-rc3+
Sean Christopherson
reviewerPlease pull a larger-than-normal set of fixes for 7.0. The PMU fix from Namhyung is the only one that absolutely _needs_ to get into 7.0 (only because no one cares about PPC e500). The rest are fairly urgent stable@ fixes (and most of 'em _just_ missed the merge window).
The following changes since commit 11439c4635edd669ae435eec308f4ab8a0804808:
Linux 7.0-rc2 (2026-03-01 15:39:31 -0800)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-fixes-7.0-rc3
for you to fetch changes up to 3271085a7f1030ba9897cab60452acd370423ff1:
KVM: PPC: e500: Rip out "struct tlbe_ref" (2026-03-03 12:29:07 -0800)
----------------------------------------------------------------
KVM x86 (and PPC e500) fixes for 7.0-rc3+
- Synthesize features into KVM's set of supported CPU caps if and only if the feature is actually "enabled" by the kernel.
- Validate _all_ GVAs when processing a range of GVAs for a PV Hyper-V TLB flush, not just the first GVA.
- Fix a brown paper bug add_atomic_switch_msr().
- Use hlist_for_each_entry_srcu() when traversing mask_notifier_list to fix a lockdep warning (KVM doesn't hold RCU, just irq_srcu).
- Ensure AVIC VMCB fields are initialized if the VM has an in-kernel local APIC (and AVIC is enabled at the module level).
- Update CR8 write interception when AVIC is (de)activated to fix a bug where KVM can run with the CR8 intercept in perpetuity.
- Add a quirk to skip the consistency check on FREEZE_IN_SMM, i.e. to allow L1 hypervisors to set FREEZE_IN_SMM to provide some amount of backwards compatibility with setups where L1 was freezing PMCs on VM-Entry to L2.
- Increase the maximum number of NUMA nodes in the guest_memfd selftest to 64 (from 8).
- Fix a PPC e500 build error due to a long-standing wart that was exposed by the recent conversion to kmalloc_obj(), and rip out the underlying ugliness that led to the wart.
----------------------------------------------------------------
Carlos López (1):
KVM: x86: synthesize CPUID bits only if CPU capability is set
Jim Mattson (1):
KVM: x86: Introduce KVM_X86_QUIRK_VMCS12_FREEZE_IN_SMM_CC
Kai Huang (1):
KVM: selftests: Increase 'maxnode' for guest_memfd tests
Li RongQing (1):
KVM: x86: Fix SRCU list traversal in kvm_fire_mask_notifiers()
Manuel Andreas (1):
KVM: x86: hyper-v: Validate all GVAs during PV TLB flush
Namhyung Kim (1):
KVM: VMX: Fix a wrong MSR update in add_atomic_switch_msr()
Sean Christopherson (4):
KVM: SVM: Initialize AVIC VMCB fields if AVIC is enabled with in-kernel APIC
KVM: SVM: Set/clear CR8 write interception when AVIC is (de)activated
KVM: PPC: e500: Fix build error due to using kmalloc_obj() with wrong type
KVM: PPC: e500: Rip out "struct tlbe_ref"
Documentation/virt/kvm/api.rst | 8 ++++++++ arch/powerpc/kvm/e500.h | 6 +----- arch/powerpc/kvm/e500_mmu.c | 4 ++-- arch/powerpc/kvm/e500_mmu_host.c | 91 ++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------- arch/x86/include/asm/kvm_host.h | 3 ++- arch/x86/include/uapi/asm/kvm.h | 1 + arch/x86/kvm/cpuid.c | 5 ++++- arch/x86/kvm/hyperv.c | 9 +++++---- arch/x86/kvm/ioapic.c | 3 ++- arch/x86/kvm/svm/avic.c | 8 +++++--- arch/x86/kvm/svm/svm.c | 11 ++++++----- arch/x86/kvm/vmx/nested.c | 22 ++++++++++++++++++---- arch/x86/kvm/vmx/vmx.c | 2 +- tools/testing/selftests/kvm/guest_memfd_test.c | 2 +- 14 files changed, 100 insertions(+), 75 deletions(-)
Sean Christopherson
reviewerQuoted 2 lines · Sean Christopherson
- Update CR8 write interception when AVIC is (de)activated to fix a bug where KVM can run with the CR8 intercept in perpetuity.
...
Quoted 3 lines
Sean Christopherson (4):
KVM: SVM: Initialize AVIC VMCB fields if AVIC is enabled with in-kernel APIC
KVM: SVM: Set/clear CR8 write interception when AVIC is (de)activated
The CR8 write patch broke SEV-ES guests. If you haven't already prepared the PULL request for Linus, can you apply the fix directly?
Thanks!
Paolo Bonzini
maintainerQuoted 5 lines · Sean Christopherson
Quoted 2 lines · Sean Christopherson
- Update CR8 write interception when AVIC is (de)activated to fix a bug where KVM can run with the CR8 intercept in perpetuity.
Quoted 8 lines
...
Quoted 3 lines
Sean Christopherson (4):
KVM: SVM: Initialize AVIC VMCB fields if AVIC is enabled with in-kernel APIC
KVM: SVM: Set/clear CR8 write interception when AVIC is (de)activatedThe CR8 write patch broke SEV-ES guests. If you haven't already prepared the PULL request for Linus, can you apply the fix directly?
Done. I also took the occasion to rename KVM_X86_QUIRK_VMCS12_ALLOW_FREEZE_IN_SMM because not having a verb was quite confusing.
More boringly, I changed one of the entries in the tag description like this:
- Fix cases where CPUID mitigation features were incorrectly marked as available whenever the kernel used scattered feature words for them.
Paolo
Quoted 5 lines
Thanks!
Sean Christopherson
reviewerQuoted 8 lines · Paolo Bonzini
Quoted 7 lines · Sean Christopherson
Quoted 2 lines · Sean Christopherson
- Update CR8 write interception when AVIC is (de)activated to fix a bug where KVM can run with the CR8 intercept in perpetuity.
...
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Sean Christopherson (4):
KVM: SVM: Initialize AVIC VMCB fields if AVIC is enabled with in-kernel APIC
KVM: SVM: Set/clear CR8 write interception when AVIC is (de)activatedThe CR8 write patch broke SEV-ES guests. If you haven't already prepared the PULL request for Linus, can you apply the fix directly?
Done.
No? I see the pull request in kvm.git, but not the below fix-to-the-fix.
Quoted 1 line
Quoted 1 line
Paolo Bonzini
maintainerQuoted 14 lines · Sean Christopherson
Quoted 12 lines · Paolo Bonzini
Quoted 11 lines · Sean Christopherson
Quoted 2 lines · Sean Christopherson
- Update CR8 write interception when AVIC is (de)activated to fix a bug where KVM can run with the CR8 intercept in perpetuity.
...
Quoted 3 lines
Sean Christopherson (4):
KVM: SVM: Initialize AVIC VMCB fields if AVIC is enabled with in-kernel APIC
KVM: SVM: Set/clear CR8 write interception when AVIC is (de)activated
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
The CR8 write patch broke SEV-ES guests. If you haven't already prepared the PULL request for Linus, can you apply the fix directly?
Done.
No? I see the pull request in kvm.git, but not the below fix-to-the-fix.
Ah, I had squashed it in directly from the original thread. I have now added on top the testcase.
Paolo
Sean Christopherson
reviewerQuoted 15 lines · Paolo Bonzini
Quoted 14 lines · Sean Christopherson
Quoted 12 lines · Paolo Bonzini
Quoted 11 lines · Sean Christopherson
Quoted 2 lines · Sean Christopherson
- Update CR8 write interception when AVIC is (de)activated to fix a bug where KVM can run with the CR8 intercept in perpetuity.
...
Quoted 3 lines
Sean Christopherson (4):
KVM: SVM: Initialize AVIC VMCB fields if AVIC is enabled with in-kernel APIC
KVM: SVM: Set/clear CR8 write interception when AVIC is (de)activated
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
The CR8 write patch broke SEV-ES guests. If you haven't already prepared the PULL request for Linus, can you apply the fix directly?
Done.
No? I see the pull request in kvm.git, but not the below fix-to-the-fix.
Ah, I had squashed it in directly from the original thread.
OMG, -ENOCOFFEE x2. I even looked at commit 87d0f901a9bd from your tree, and the lack of a merge commit for fixes should have been a big clue.
Quoted 1 line
I have now added on top the testcase.
Thanks much!