Skip to contentSkip to conversation

expose paravirt feature list to cpuid

PATCH In review Glauber Costa 2 participants 2 messages Jan 28, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 expose paravirt feature list to cpuid

Expose the paravirt features provided by the host to the guest. The features exposed uses qemu just as a medium, since they only depend on a negotiation between the host and guest directly.

As a direct result, we're now able to run the kvm pvclock in qemu based kvm guests.

---
 kvm.h             |    1 +
 target-i386/kvm.c |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 0 deletions(-)
kvm.h +1 -0
index efce145..db58baa 100644
@@ -17,6 +17,7 @@
 #include "config.h"
 
 #ifdef CONFIG_KVM
+#include <linux/kvm_para.h>
 extern int kvm_allowed;
 
 #define kvm_enabled() (kvm_allowed)
target-i386/kvm.c +50 -0

64 lines not on this page · raw message

Signature · 1 line
1.5.6.5
#1 lore raw

target-i386/kvm.c int kvm_arch_init_vcpu(CPUState *env) · line 88

Quoted 6 lines
target-i386/kvm.c +6 -0
+#ifdef KVM_CPUID_SIGNATURE
+    /* Paravirtualization CPUIDs */
+    memcpy(signature, "KVMKVMKVM\0\0\0", 12);
+    pv_ent->ebx = signature[0];
+    pv_ent->ecx = signature[1];
+    pv_ent->edx = signature[2];

This is broken on big-endian hosts.

I realise this code is currently only enabled for x86 hosts, however there's a good chance we'll want to implement something similar for normal qemu. At minimum it needs a comment saying that it's potentially broken.

Paul