aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/kvm/cpuid.h
diff options
context:
space:
mode:
authorGravatar Sean Christopherson <sean.j.christopherson@intel.com> 2020-03-04 17:34:32 -0800
committerGravatar Paolo Bonzini <pbonzini@redhat.com> 2020-03-16 17:58:47 +0100
commit15608ed03f10a1414188612b0ee9653e3c78bbd9 (patch)
treeac09dad5dac942f2aece0e77a244c33326bdf0a8 /arch/x86/kvm/cpuid.h
parentKVM: x86: Trace the original requested CPUID function in kvm_cpuid() (diff)
downloadlinux-15608ed03f10a1414188612b0ee9653e3c78bbd9.tar.gz
linux-15608ed03f10a1414188612b0ee9653e3c78bbd9.tar.bz2
linux-15608ed03f10a1414188612b0ee9653e3c78bbd9.zip
KVM: x86: Add helpers to perform CPUID-based guest vendor check
Add helpers to provide CPUID-based guest vendor checks, i.e. to do the ugly register comparisons. Use the new helpers to check for an AMD guest vendor in guest_cpuid_is_amd() as well as in the existing emulator flows. Using the new helpers fixes a _very_ theoretical bug where guest_cpuid_is_amd() would get a false positive on a non-AMD virtual CPU with a vendor string beginning with "Auth" due to the previous logic only checking EBX. It also fixes a marginally less theoretically bug where guest_cpuid_is_amd() would incorrectly return false for a guest CPU with "AMDisbetter!" as its vendor string. Fixes: a0c0feb57992c ("KVM: x86: reserve bit 8 of non-leaf PDPEs and PML4Es in 64-bit mode on AMD") Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/cpuid.h')
-rw-r--r--arch/x86/kvm/cpuid.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
index e9a3277ce256..cccfd854aacf 100644
--- a/arch/x86/kvm/cpuid.h
+++ b/arch/x86/kvm/cpuid.h
@@ -219,7 +219,7 @@ static inline bool guest_cpuid_is_amd(struct kvm_vcpu *vcpu)
struct kvm_cpuid_entry2 *best;
best = kvm_find_cpuid_entry(vcpu, 0, 0);
- return best && best->ebx == X86EMUL_CPUID_VENDOR_AuthenticAMD_ebx;
+ return best && is_guest_vendor_amd(best->ebx, best->ecx, best->edx);
}
static inline int guest_cpuid_family(struct kvm_vcpu *vcpu)