diff options
author | Sean Christopherson <seanjc@google.com> | 2023-07-21 13:18:49 -0700 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2023-08-03 15:37:14 -0700 |
commit | b6a6af0d19cea17a3c1e34f81f0d521775f94ab5 (patch) | |
tree | bcd9126c901ca842a66e45496c75a655cf7814fd /arch/x86/kvm/vmx | |
parent | 261cd5ed934e6923187cf1c9eaa6cb63f2b81212 (diff) |
x86/virt: KVM: Open code cpu_has_vmx() in KVM VMX
Fold the raw CPUID check for VMX into kvm_is_vmx_supported(), its sole
user. Keep the check even though KVM also checks X86_FEATURE_VMX, as the
intent is to provide a unique error message if VMX is unsupported by
hardware, whereas X86_FEATURE_VMX may be clear due to firmware and/or
kernel actions.
No functional change intended.
Reviewed-by: Kai Huang <kai.huang@intel.com>
Link: https://lore.kernel.org/r/20230721201859.2307736-10-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'arch/x86/kvm/vmx')
-rw-r--r-- | arch/x86/kvm/vmx/vmx.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index df991f15baf4..4b9d68826172 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -2699,7 +2699,7 @@ static bool kvm_is_vmx_supported(void) { int cpu = raw_smp_processor_id(); - if (!cpu_has_vmx()) { + if (!(cpuid_ecx(1) & feature_bit(VMX))) { pr_err("VMX not supported by CPU %d\n", cpu); return false; } |