Skip to content

KVM: x86: CPUID faulting fixes and AMD CPUID faulting virtualization

Anil Altinay kvm stable 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 1 replyIn review
  2. v16 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- Include KVM maintainers and [email protected] on Cc across the series (omitted in v1 due to --suppress-cc=all).
- Link to v1: https://lore.kernel.org/stable/[email protected]/

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6KVM: x86: Ignore cpuid faulting in SMMarch/x86/kvm/cpuid.c arch/x86/kvm/emulate.c+5 -40 replies
2/6KVM: x86: Consolidate CPUID fault handling for emulator and interception logicarch/x86/include/asm/kvm_host.h arch/x86/kvm/cpuid.c arch/x86/kvm/cpuid.h +3 more+20 -200 replies
3/6KVM: x86: Prioritize CPUID faulting over CPUID VM-exits in nested VMXarch/x86/kvm/vmx/nested.c+2 -00 replies
4/6KVM: x86: Remove supports_cpuid_fault() helperarch/x86/kvm/cpuid.h arch/x86/kvm/x86.c+1 -60 replies
5/6KVM: x86: Virtualize AMD CPUID faultingarch/x86/include/asm/msr-index.h arch/x86/kvm/cpuid.c arch/x86/kvm/cpuid.h +1 more+17 -90 replies
6/6KVM: selftests: Update hwcr_msr_test for CPUID faulting bittools/testing/selftests/kvm/include/x86/processor.h tools/testing/selftests/kvm/x86/hwcr_msr_test.c+8 -20 replies

Reviews trailers per patch

2 of 6 patches have a Reviewed-by or Acked-by.

PatchBinbin Wu
1/6
2/6R-b
3/6
4/6R-b
5/6
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH 6.18.y v2 0/6] KVM: x86: CPUID faulting fixes and AMD CPUID faulting virtualization

Please backport the following 6 upstream commits to the 6.18.y stable tree:

1. 690dc03859e7 ("KVM: x86: Ignore cpuid faulting in SMM") [v7.1-rc1]
2. cf7d65d1d6f5 ("KVM: x86: Consolidate CPUID fault handling for emulator and interception logic") [v7.2-rc1]
3. be7fd7c3e8bc ("KVM: x86: Prioritize CPUID faulting over CPUID VM-exits in nested VMX") [v7.2-rc1]
4. d1bc99885a59 ("KVM: x86: Remove supports_cpuid_fault() helper") [v7.2-rc1]
5. e93a93f11490 ("KVM: x86: Virtualize AMD CPUID faulting") [v7.2-rc1]
6. b16c2aca369d ("KVM: selftests: Update hwcr_msr_test for CPUID faulting bit") [v7.2-rc1]

Patches 1 and 3 fix bugs in KVM's CPUID faulting virtualization (Fixes:
db2336a80489 ("KVM: x86: virtualize cpuid faulting")), ensuring that CPUID does not fault in SMM and that CPUID faulting takes precedence over CPUID VM-exits in nested VMX. Patch 2 is a non-functional refactoring prerequisite for patch 3.

Patches 4-6 extend KVM's CPUID faulting virtualization (already supported by KVM on Intel CPUs and by 6.18 host kernels on AMD CPUs via 65f55a301766 ("x86/CPU/AMD: Add CPUID faulting support")) to AMD guests via CPUID.80000021H:EAX.CpuidUserDis[bit 17] and HWCR.CpuidUserDis[bit 35], allowing guests and container runtimes that rely on arch_prctl(ARCH_SET_CPUID) to work uniformly across Intel and AMD KVM hosts, along with the corresponding KVM selftest update.

All patches cherry-pick cleanly to 6.18.y except for a minor context conflict in patch 2 (arch/x86/include/asm/kvm_host.h) and a u64 vs. uint64_t type adjustment in patch 6 (tools/testing/selftests/kvm/x86/hwcr_msr_test.c).

Changes in v2:
- Include KVM maintainers and [email protected] on Cc across the series (omitted in v1 due to --suppress-cc=all).
- Link to v1: https://lore.kernel.org/stable/[email protected]/

Jim Mattson (5):
KVM: x86: Ignore cpuid faulting in SMM
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

Sean Christopherson (1):
KVM: x86: Consolidate CPUID fault handling for emulator and
interception logic

 arch/x86/include/asm/kvm_host.h               |  1 -
 arch/x86/include/asm/msr-index.h              |  1 +
 arch/x86/kvm/cpuid.c                          |  6 ++-
 arch/x86/kvm/cpuid.h                          | 14 ++++---
 arch/x86/kvm/emulate.c                        |  6 +--
 arch/x86/kvm/kvm_emulate.h                    |  1 +
 arch/x86/kvm/vmx/nested.c                     |  2 +
 arch/x86/kvm/x86.c                            | 39 ++++++++++---------
 .../selftests/kvm/include/x86/processor.h     |  1 +
 .../testing/selftests/kvm/x86/hwcr_msr_test.c |  9 ++++-
 10 files changed, 46 insertions(+), 34 deletions(-)
Signature · 1 line
2.56.0.385.gd3acb90ef8-goog