[Top][All Lists]
[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: |
Mon, 9 Feb 2009 19:39:23 +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 | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/qemu/target-i386/kvm.c b/qemu/target-i386/kvm.c
index a7ff14f..86745b1 100644
--- a/qemu/target-i386/kvm.c
+++ b/qemu/target-i386/kvm.c
@@ -51,6 +51,33 @@ 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;
+ c = &cpuid_data.entries[++cpuid_i];
+ }
+ break;
+ }
case 4:
case 0xb:
case 0xd:
--
1.6.0.6