]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: SVM: Require exact CPUID.0x1 match when stuffing EDX at INIT
authorSean Christopherson <seanjc@google.com>
Tue, 13 Jul 2021 16:32:43 +0000 (09:32 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 2 Aug 2021 15:01:49 +0000 (11:01 -0400)
commitd78e3b3b5e4457aa9192a9320bf451258d36554c
tree233d12b7859e431e79ad4510ff0a8c34555dac61
parent4287726cbe7a712cc21ed323284fdd7b60d4ac7f
KVM: SVM: Require exact CPUID.0x1 match when stuffing EDX at INIT

Do not allow an inexact CPUID "match" when querying the guest's CPUID.0x1
to stuff EDX during INIT.  In the common case, where the guest CPU model
is an AMD variant, allowing an inexact match is a nop since KVM doesn't
emulate Intel's goofy "out-of-range" logic for AMD and Hygon.  If the
vCPU model happens to be an Intel variant, an inexact match is possible
if and only if the max CPUID leaf is precisely '0'. Aside from the fact
that there's probably no CPU in existence with a single CPUID leaf, if
the max CPUID leaf is '0', that means that CPUID.0.EAX is '0', and thus
an inexact match for CPUID.0x1.EAX will also yield '0'.

So, with lots of twisty logic, no functional change intended.

Reviewed-by: Reiji Watanabe <reijiw@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210713163324.627647-6-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/svm.c