public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qemu-kvm: Ask kernel about supported svm features
@ 2010-04-22 10:57 Joerg Roedel
  2010-04-22 11:07 ` Avi Kivity
  0 siblings, 1 reply; 6+ messages in thread
From: Joerg Roedel @ 2010-04-22 10:57 UTC (permalink / raw)
  To: Avi Kivity, Anthony Liguori; +Cc: kvm, Joerg Roedel

This patch adds code to ask the kernel about the svm
features it supports for its guests and propagates them to
the guest. The new capability is necessary because the old
behavior of the kernel was to just return the host svm
features but every svm-feature needs emulation in the nested
svm kernel code. The new capability indicates that the
kernel is aware of that when returning svm cpuid
information.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 qemu-kvm-x86.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index 748ff69..6eccd69 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -1327,8 +1327,18 @@ int kvm_arch_init_vcpu(CPUState *cenv)
     qemu_kvm_cpuid_on_env(&copy);
     limit = copy.regs[R_EAX];
 
-    for (i = 0x80000000; i <= limit; ++i)
-	do_cpuid_ent(&cpuid_ent[cpuid_nent++], i, 0, &copy);
+    for (i = 0x80000000; i <= limit; ++i) {
+        do_cpuid_ent(&cpuid_ent[cpuid_nent], i, 0, &copy);
+        switch (i) {
+            case 0x8000000a:
+                cpuid_ent[cpuid_nent].eax = kvm_arch_get_supported_cpuid(cenv, 0x8000000a, R_EAX);
+                cpuid_ent[cpuid_nent].ebx = kvm_arch_get_supported_cpuid(cenv, 0x8000000a, R_EBX);
+                cpuid_ent[cpuid_nent].ebx = kvm_arch_get_supported_cpuid(cenv, 0x8000000a, R_EBX);
+                cpuid_ent[cpuid_nent].edx = kvm_arch_get_supported_cpuid(cenv, 0x8000000a, R_EDX);
+                break;
+        }
+        cpuid_nent += 1;
+    }
 
     kvm_setup_cpuid2(cenv, cpuid_nent, cpuid_ent);
 
-- 
1.7.0.4



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

end of thread, other threads:[~2010-04-22 14:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-22 10:57 [PATCH] qemu-kvm: Ask kernel about supported svm features Joerg Roedel
2010-04-22 11:07 ` Avi Kivity
2010-04-22 12:02   ` Joerg Roedel
2010-04-22 12:13     ` Avi Kivity
2010-04-22 12:28       ` Joerg Roedel
2010-04-22 14:48         ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox