]> git.ipfire.org Git - thirdparty/linux.git/commit
KVM: x86: Virtualize AMD CPUID faulting
authorJim Mattson <jmattson@google.com>
Wed, 27 May 2026 17:43:46 +0000 (10:43 -0700)
committerSean Christopherson <seanjc@google.com>
Wed, 27 May 2026 18:21:41 +0000 (11:21 -0700)
commite93a93f11490992a477546d38d3a37b9b8dc6a5f
tree933f821ecf65a12b7abc738a0ff07b29488b95c4
parentd1bc99885a59d89e408f52f4c147b07bca9a686f
KVM: x86: Virtualize AMD CPUID faulting

On AMD CPUs, CPUID faulting support is advertised via
CPUID.80000021H:EAX.CpuidUserDis[bit 17] and enabled by setting
HWCR.CpuidUserDis[bit 35].

Advertise the feature to userspace regardless of host CPU support. Allow
writes to HWCR to set bit 35 when the guest CPUID advertises
CpuidUserDis. Update cpuid_fault_enabled() to check HWCR.CpuidUserDis as
well as MSR_FEATURE_ENABLES.CPUID_GP_ON_CPL_GT_0.

Unlike VMX, SVM prioritizes the CPUID intercept over the #GP induced by
CPUID faulting.[1] This behavior has been confirmed on a Turin CPU (F/M/S
1AH/2/1).

Link: https://lore.kernel.org/r/DS7PR12MB82011943131DF5415365E19E940B2@DS7PR12MB8201.namprd12.prod.outlook.com
Signed-off-by: Jim Mattson <jmattson@google.com>
Link: https://patch.msgid.link/20260527174347.2356165-5-jmattson@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/include/asm/msr-index.h
arch/x86/kvm/cpuid.c
arch/x86/kvm/cpuid.h
arch/x86/kvm/x86.c