qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] v2:  KVM: support for 'count' in CPUID functions 4, 0xb and 0xd.
@ 2009-01-13  7:09 Amit Shah
  2009-01-13  7:09 ` [Qemu-devel] [PATCH] KVM: CPUID takes ecx as input value for some functions Amit Shah
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Amit Shah @ 2009-01-13  7:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori, avi, kvm

These two patches were sent separately earlier. There are a couple of
small changes in this version, including removal of a debug message that
was left behind.

Please apply.

^ permalink raw reply	[flat|nested] 15+ messages in thread
* [Qemu-devel] v23: KVM: Complete support for cpuid functions 2, 4, b, d
@ 2009-02-09 14:09 Amit Shah
  2009-02-09 14:09 ` [Qemu-devel] [PATCH] KVM: CPUID takes ecx as input value for some functions Amit Shah
  0 siblings, 1 reply; 15+ messages in thread
From: Amit Shah @ 2009-02-09 14:09 UTC (permalink / raw)
  To: aliguori; +Cc: qemu-devel


Not really v23, this is rebased to qemu-svn and also fixes
a small bug for cpuid function 2.

Please apply.

^ permalink raw reply	[flat|nested] 15+ messages in thread
* [Qemu-devel] KVM: completely support cpuid functions 2, 4, b, d
@ 2009-02-04 16:34 Amit Shah
  2009-02-04 16:34 ` [Qemu-devel] [PATCH] KVM: CPUID takes ecx as input value for some functions Amit Shah
  0 siblings, 1 reply; 15+ messages in thread
From: Amit Shah @ 2009-02-04 16:34 UTC (permalink / raw)
  To: aliguori; +Cc: qemu-devel


These patches add support for cpuid functions 2, 4, 0xb, 0xd. cpuid function
2 keeps returning values till we get a 0. The others take a 'count' parameter
in addition to the function number.

With these patches, KVM can run a VM started with a newer CPU type (coreduo,
core2duo). These patches also pave way for a "host" CPU type, where we could
pass the CPU type of the current host to the VM.

Please apply.

^ permalink raw reply	[flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH] KVM: Fetch sub-leaf cpuid values for functions 4, 0xb, 0xd.
@ 2009-01-12 11:58 Amit Shah
  0 siblings, 0 replies; 15+ messages in thread
From: Amit Shah @ 2009-01-12 11:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: Amit Shah, aliguori, avi, kvm

CPUID functions 4, 0xb and 0xd have sub-leaf values which depend on the
input value of ECX. Store these values as well.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 qemu/target-i386/kvm.c |   40 +++++++++++++++++++++++++++++-----------
 1 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/qemu/target-i386/kvm.c b/qemu/target-i386/kvm.c
index f87bf36..c17e58b 100644
--- a/qemu/target-i386/kvm.c
+++ b/qemu/target-i386/kvm.c
@@ -39,32 +39,50 @@ int kvm_arch_init_vcpu(CPUState *env)
         struct kvm_cpuid cpuid;
         struct kvm_cpuid_entry entries[100];
     } __attribute__((packed)) cpuid_data;
-    uint32_t limit, i, cpuid_i;
+    uint32_t limit, i, j, cpuid_i;
     uint32_t eax, ebx, ecx, edx;
 
     cpuid_i = 0;
 
-    cpu_x86_cpuid(env, 0, &eax, &ebx, &ecx, &edx);
+    cpu_x86_cpuid(env, 0, 0, &eax, &ebx, &ecx, &edx);
     limit = eax;
 
     for (i = 0; i <= limit; i++) {
         struct kvm_cpuid_entry *c = &cpuid_data.entries[cpuid_i++];
 
-        cpu_x86_cpuid(env, i, &eax, &ebx, &ecx, &edx);
-        c->function = i;
-        c->eax = eax;
-        c->ebx = ebx;
-        c->ecx = ecx;
-        c->edx = edx;
+        if (i == 4 || i == 0xb || i == 0xd) {
+            for (j = 0; ; j++) {
+                cpu_x86_cpuid(env, i, j, &eax, &ebx, &ecx, &edx);
+                c->function = i;
+                c->eax = eax;
+                c->ebx = ebx;
+                c->ecx = ecx;
+                c->edx = edx;
+                c = &cpuid_data.entries[++cpuid_i];
+
+                if (i == 4 && eax == 0)
+                    break;
+                if (i == 0xb && !(ecx & 0xff00))
+                    break;
+                if (i == 0xd && eax == 0)
+                    break;
+            }
+        } else {
+            cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx);
+            c->function = i;
+            c->eax = eax;
+            c->ebx = ebx;
+            c->ecx = ecx;
+            c->edx = edx;
+        }
     }
-
-    cpu_x86_cpuid(env, 0x80000000, &eax, &ebx, &ecx, &edx);
+    cpu_x86_cpuid(env, 0x80000000, 0, &eax, &ebx, &ecx, &edx);
     limit = eax;
 
     for (i = 0x80000000; i <= limit; i++) {
         struct kvm_cpuid_entry *c = &cpuid_data.entries[cpuid_i++];
 
-        cpu_x86_cpuid(env, i, &eax, &ebx, &ecx, &edx);
+        cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx);
         c->function = i;
         c->eax = eax;
         c->ebx = ebx;
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2009-02-09 14:09 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-13  7:09 [Qemu-devel] v2: KVM: support for 'count' in CPUID functions 4, 0xb and 0xd Amit Shah
2009-01-13  7:09 ` [Qemu-devel] [PATCH] KVM: CPUID takes ecx as input value for some functions Amit Shah
2009-01-13  7:09   ` [Qemu-devel] [PATCH] KVM: Fetch sub-leaf cpuid values for functions 4, 0xb, 0xd Amit Shah
2009-01-13  8:25 ` [Qemu-devel] v2: KVM: support for 'count' in CPUID functions 4, 0xb and 0xd Alexander Graf
2009-01-13  9:10   ` Amit Shah
2009-01-13 11:06     ` Amit Shah
2009-01-13  9:56 ` [Qemu-devel] [PATCH] Always return latest pmsts instead of the old one Zhang, Xiantao
2009-01-15  6:27   ` [Qemu-devel] " Zhang, Xiantao
2009-01-15 21:55   ` [Qemu-devel] " Anthony Liguori
2009-01-19 14:12     ` [Qemu-devel] " Zhang, Xiantao
2009-01-21  3:51       ` Zhang, Xiantao
2009-01-21 16:35       ` [Qemu-devel] " Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2009-02-09 14:09 [Qemu-devel] v23: KVM: Complete support for cpuid functions 2, 4, b, d Amit Shah
2009-02-09 14:09 ` [Qemu-devel] [PATCH] KVM: CPUID takes ecx as input value for some functions Amit Shah
2009-02-09 14:09   ` [Qemu-devel] [PATCH] KVM: Fetch sub-leaf cpuid values for functions 4, 0xb, 0xd Amit Shah
2009-02-04 16:34 [Qemu-devel] KVM: completely support cpuid functions 2, 4, b, d Amit Shah
2009-02-04 16:34 ` [Qemu-devel] [PATCH] KVM: CPUID takes ecx as input value for some functions Amit Shah
2009-02-04 16:34   ` [Qemu-devel] [PATCH] KVM: Fetch sub-leaf cpuid values for functions 4, 0xb, 0xd Amit Shah
2009-01-12 11:58 Amit Shah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).