diff options
author | Sean Christopherson <seanjc@google.com> | 2023-07-21 23:18:53 +0300 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2023-08-04 01:37:15 +0300 |
commit | 85fd29dd5fe459b732e46c7a9782fc403c5604ed (patch) | |
tree | ec45306e1fd09f582a76680b63a03f57fb2e68d6 /arch/x86/kvm/svm/svm.c | |
parent | 5df8ecfe3632d5879d1f154f7aa8de441b5d1c89 (diff) | |
download | linux-85fd29dd5fe459b732e46c7a9782fc403c5604ed.tar.xz |
x86/virt: KVM: Open code cpu_has_svm() into kvm_is_svm_supported()
Fold the guts of cpu_has_svm() into kvm_is_svm_supported(), its sole
remaining user.
No functional change intended.
Reviewed-by: Kai Huang <kai.huang@intel.com>
Link: https://lore.kernel.org/r/20230721201859.2307736-14-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'arch/x86/kvm/svm/svm.c')
-rw-r--r-- | arch/x86/kvm/svm/svm.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 1ae9c2c7eacb..ff6c769aafb2 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -521,11 +521,16 @@ static void svm_init_osvw(struct kvm_vcpu *vcpu) static bool kvm_is_svm_supported(void) { int cpu = raw_smp_processor_id(); - const char *msg; u64 vm_cr; - if (!cpu_has_svm(&msg)) { - pr_err("SVM not supported by CPU %d, %s\n", cpu, msg); + if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD && + boot_cpu_data.x86_vendor != X86_VENDOR_HYGON) { + pr_err("CPU %d isn't AMD or Hygon\n", cpu); + return false; + } + + if (!boot_cpu_has(X86_FEATURE_SVM)) { + pr_err("SVM not supported by CPU %d\n", cpu); return false; } |