]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: x86: Consolidate CPUID fault handling for emulator and interception logic
authorSean Christopherson <seanjc@google.com>
Wed, 27 May 2026 17:43:43 +0000 (10:43 -0700)
committerSean Christopherson <seanjc@google.com>
Wed, 27 May 2026 18:21:41 +0000 (11:21 -0700)
commitcf7d65d1d6f50daadfe7c475f0c2b1bfdc288b56
treeaa444973cff4ffa65085944874914a38a65a09a6
parent986833d381d2c48bdfa52652006f445570aea0e4
KVM: x86: Consolidate CPUID fault handling for emulator and interception logic

Extract the logic for emulating CPUID faulting (where CPUID #GPs at CPL>0
outside of SMM) into a dedicated helper and use the helper for both the
full emulator and the intercepted-CPUID paths.

Opportunistically drop kvm_require_cpl(), as kvm_emulate_cpuid() was the
one and only user.

No functional change intended.

[jim: Add EXPORT_STATIC_CALL_GPL(kvm_x86_get_cpl) so that KVM vendor
modules can call kvm_is_cpuid_allowed(). Fix typo in commit message.]

Signed-off-by: Jim Mattson <jmattson@google.com>
Reviewed-by: Binbin Wu <binbin.wu@linux.intel.com>
Link: https://patch.msgid.link/20260527174347.2356165-2-jmattson@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/cpuid.c
arch/x86/kvm/cpuid.h
arch/x86/kvm/emulate.c
arch/x86/kvm/kvm_emulate.h
arch/x86/kvm/x86.c