]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: move and fix substitue search for missing CPUID entries
authorAndre Przywara <andre.przywara@amd.com>
Thu, 31 Mar 2011 14:58:49 +0000 (16:58 +0200)
committerAvi Kivity <avi@redhat.com>
Wed, 6 Apr 2011 10:15:56 +0000 (13:15 +0300)
commit47fdffd1c1b841d3f0f20bc8057e76a7317ac273
tree8f479fb862bd422e7cdbe8b240e1fdd4978f725b
parentbb63f3e43ce26d2c1c553df2b077233824c7764c
KVM: move and fix substitue search for missing CPUID entries

If KVM cannot find an exact match for a requested CPUID leaf, the
code will try to find the closest match instead of simply confessing
it's failure.
The implementation was meant to satisfy the CPUID specification, but
did not properly check for extended and standard leaves and also
didn't account for the index subleaf.
Beside that this rule only applies to CPUID intercepts, which is not
the only user of the kvm_find_cpuid_entry() function.

So fix this algorithm and call it from kvm_emulate_cpuid().
This fixes a crash of newer Linux kernels as KVM guests on
AMD Bulldozer CPUs, where bogus values were returned in response to
a CPUID intercept.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/x86.c