]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Add helpers to perform CPUID-based guest vendor check
authorSean Christopherson <sean.j.christopherson@intel.com>
Thu, 5 Mar 2020 01:34:32 +0000 (17:34 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 16 Mar 2020 16:58:47 +0000 (17:58 +0100)
commit8361e71e5a25705a6048410971097c4fffd626b0
treeac09dad5dac942f2aece0e77a244c33326bdf0a8
parentd6d0bc00b00e7ba8d3ad06bb19984fcfa6d39c4c
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: 10325013ad975 ("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>
arch/x86/kvm/cpuid.h
arch/x86/kvm/emulate.c
arch/x86/kvm/kvm_emulate.h