Skip to contentSkip to conversation

kvm clock : userspace part

PATCH New Glauber de Oliveira Costa 1 participant 3 messages Feb 11, 2008 KVM

lore
Share & tools
lore
#1 lore raw

PATCH 1/2 add kvm_para.h header to qemu-kvm-x86.c

With this, functions such as cpuid can make
use of paravirt definitions

---
 qemu/qemu-kvm-x86.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
qemu/qemu-kvm-x86.c +1 -0
index 037abb1..4a52d4d 100644
@@ -9,6 +9,7 @@ #include "qemu-kvm.h"
 #include <libkvm.h>
 #include <pthread.h>
 #include <sys/utsname.h>
+#include <linux/kvm_para.h>
 
 #define MSR_IA32_TSC		0x10
 
Signature · 7 lines
1.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
#2 lore raw

PATCH 2/2 fill cpuid with clock information

we advertise the presence of our paravirt clock
through cpuid, if it is defined in headers

---
 qemu/qemu-kvm-x86.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
qemu/qemu-kvm-x86.c +5 -1
index 4a52d4d..4daf6cc 100644
@@ -513,6 +513,10 @@ #endif
     int cpuid_nent = 0;
     CPUState copy;
     uint32_t i, limit;
+    int has_clocksource = 0;
+#ifdef KVM_CAP_CLOCKSOURCE
+    has_clocksource = kvm_check_extension(kvm_context, KVM_CAP_CLOCKSOURCE);
+#endif
 
     copy = *cenv;
 
@@ -530,7 +534,7 @@ #ifdef KVM_CPUID_SIGNATURE
     pv_ent = &cpuid_ent[cpuid_nent++];
     memset(pv_ent, 0, sizeof(*pv_ent));
     pv_ent->function = KVM_CPUID_FEATURES;
-    pv_ent->eax = 0;
+    pv_ent->eax = (has_clocksource << KVM_FEATURE_CLOCKSOURCE);
 #endif
 
     copy.regs[R_EAX] = 0;
Signature · 7 lines
1.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/