This adds CPUID support for paravirtualization.  We can do this unconditionally
because there are no features defined at the moment.  Future code that
introduces features, however, should validate that the kernel supports those
features before setting the bits.

Signed-off-by: Anthony Liguori <[EMAIL PROTECTED]>

diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index 4843a74..7572cef 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -1113,12 +1113,29 @@ static void do_cpuid_ent(struct kvm_cpuid_entry *e, 
uint32_t function,
 int kvm_qemu_init_env(CPUState *cenv)
 {
     struct kvm_cpuid_entry cpuid_ent[100];
+    struct kvm_cpuid_entry *pv_ent;
+    uint32_t signature[3];
     int cpuid_nent = 0;
     CPUState copy;
     uint32_t i, limit;
 
     copy = *cenv;
 
+    /* Paravirtualization CPUIDs */
+    memcpy(signature, "KVMKVMKVM", 12);
+    pv_ent = &cpuid_ent[cpuid_nent++];
+    memset(pv_ent, 0, sizeof(*pv_ent));
+    pv_ent->function = KVM_CPUID_SIGNATURE;
+    pv_ent->eax = 0;
+    pv_ent->ebx = signature[0];
+    pv_ent->ecx = signature[1];
+    pv_ent->edx = signature[2];
+
+    pv_ent = &cpuid_ent[cpuid_nent++];
+    memset(pv_ent, 0, sizeof(*pv_ent));
+    pv_ent->function = KVM_CPUID_FEATURES;
+    pv_ent->eax = 0;
+
     copy.regs[R_EAX] = 0;
     qemu_kvm_cpuid_on_env(&copy);
     limit = copy.regs[R_EAX];
diff --git a/user/kvmctl.h b/user/kvmctl.h
index 109d81c..74db1ba 100644
--- a/user/kvmctl.h
+++ b/user/kvmctl.h
@@ -10,6 +10,7 @@
 #endif
 
 #include <linux/kvm.h>
+#include <linux/kvm_para.h>
 #include <stdint.h>
 #include <signal.h>
 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to