qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] KVM: Get all cpuid values from function 2


From: Amit Shah
Subject: [Qemu-devel] [PATCH] KVM: Get all cpuid values from function 2
Date: Wed, 4 Feb 2009 22:05:00 +0530

cpuid function 2 can have multiple values to describe cache behaviour.
Loop till we have fetched all the values.

Signed-off-by: Amit Shah <address@hidden>
---
 qemu/target-i386/kvm.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/qemu/target-i386/kvm.c b/qemu/target-i386/kvm.c
index b9c106e..93ff31f 100644
--- a/qemu/target-i386/kvm.c
+++ b/qemu/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:
-- 
1.6.0.6





reply via email to

[Prev in Thread] Current Thread [Next in Thread]