Skip to content

Commit

Permalink
x86/virt: Drop unnecessary check on extended CPUID level in cpu_has_s…
Browse files Browse the repository at this point in the history
…vm()

[ Upstream commit 5df8ecf ]

Drop the explicit check on the extended CPUID level in cpu_has_svm(), the
kernel's cached CPUID info will leave the entire SVM leaf unset if said
leaf is not supported by hardware.  Prior to using cached information,
the check was needed to avoid false positives due to Intel's rather crazy
CPUID behavior of returning the values of the maximum supported leaf if
the specified leaf is unsupported.

Fixes: 682a810 ("x86/kvm/svm: Simplify cpu_has_svm()")
Link: https://lore.kernel.org/r/20230721201859.2307736-13-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
sean-jc authored and gregkh committed Sep 19, 2023
1 parent 95101e1 commit 09af247
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions arch/x86/include/asm/virtext.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,6 @@ static inline int cpu_has_svm(const char **msg)
return 0;
}

if (boot_cpu_data.extended_cpuid_level < SVM_CPUID_FUNC) {
if (msg)
*msg = "can't execute cpuid_8000000a";
return 0;
}

if (!boot_cpu_has(X86_FEATURE_SVM)) {
if (msg)
*msg = "svm not available";
Expand Down

0 comments on commit 09af247

Please sign in to comment.