aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-02-09 15:50:36 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-02-09 15:50:36 +0000
commita36b1029e226f377028aeab0e8779fcd4c3e414e (patch)
tree27087d6cd95b1182f82d4b878a97f55c1d6cfd67
parent486bd5a2f26e58d7222a0cb83f25bb4136b7406d (diff)
KVM: Get all cpuid values from function 2 (Amit Shah)
cpuid function 2 can have multiple values to describe cache behaviour. Loop till we have fetched all the values. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6567 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--target-i386/kvm.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index a7ff14fa1c..19b08d8009 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -51,6 +51,32 @@ int kvm_arch_init_vcpu(CPUState *env)
struct kvm_cpuid_entry2 *c = &cpuid_data.entries[cpuid_i++];
switch (i) {
+ case 2: {
+ /* Keep reading function 2 till all the input is received */
+ int times;
+
+ cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx);
+ times = eax & 0xff;
+
+ c->function = i;
+ c->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC;
+ c->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT;
+ c->eax = eax;
+ c->ebx = ebx;
+ c->ecx = ecx;
+ c->edx = edx;
+
+ for (j = 1; j < times; ++j) {
+ cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx);
+ c->function = i;
+ c->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC;
+ c->eax = eax;
+ c->ebx = ebx;
+ c->ecx = ecx;
+ c->edx = edx;
+ }
+ break;
+ }
case 4:
case 0xb:
case 0xd: