]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: x86: Use kvm_cpu_cap_has() for EFER bits enablement checks
authorYosry Ahmed <yosry@kernel.org>
Sat, 7 Mar 2026 01:16:18 +0000 (01:16 +0000)
committerSean Christopherson <seanjc@google.com>
Thu, 12 Mar 2026 16:05:41 +0000 (09:05 -0700)
Instead of checking that the hardware supports underlying features for
EFER bits, check if KVM supports them. It is practically the same, but
this removes a subtle dependency on kvm_set_cpu_caps() enabling the
relevant CPUID features.

No functional change intended.

Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Yosry Ahmed <yosry@kernel.org>
Link: https://patch.msgid.link/20260307011619.2324234-3-yosry@kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/x86.c

index 7e8c1816cffd6bf9a3738cc29307607d6d3b1d2d..3753d0b62dedfc334775c54a8eb6a9cd173ef468 100644 (file)
@@ -10000,13 +10000,13 @@ EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_setup_xss_caps);
 
 static void kvm_setup_efer_caps(void)
 {
-       if (boot_cpu_has(X86_FEATURE_NX))
+       if (kvm_cpu_cap_has(X86_FEATURE_NX))
                kvm_enable_efer_bits(EFER_NX);
 
-       if (boot_cpu_has(X86_FEATURE_FXSR_OPT))
+       if (kvm_cpu_cap_has(X86_FEATURE_FXSR_OPT))
                kvm_enable_efer_bits(EFER_FFXSR);
 
-       if (boot_cpu_has(X86_FEATURE_AUTOIBRS))
+       if (kvm_cpu_cap_has(X86_FEATURE_AUTOIBRS))
                kvm_enable_efer_bits(EFER_AUTOIBRS);
 }