qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/3] target-i386: initialize vcpu's TSC rate to the


From: Haozhong Zhang
Subject: [Qemu-devel] [PATCH 2/3] target-i386: initialize vcpu's TSC rate to the value from KVM
Date: Mon, 28 Sep 2015 13:38:30 +0800

When creating a vcpu, we initialize its TSC rate to the value from
KVM (through ioctl KVM_GET_TSC_KHZ).

Signed-off-by: Haozhong Zhang <address@hidden>
---
 target-i386/kvm.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 7b0ba17..c2b161a 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -751,6 +751,13 @@ int kvm_arch_init_vcpu(CPUState *cs)
         }
     }
 
+    r = kvm_vcpu_ioctl(cs, KVM_GET_TSC_KHZ);
+    if (r < 0) {
+        fprintf(stderr, "KVM_GET_TSC_KHZ failed\n");
+        return r;
+    }
+    env->tsc_khz = r;
+
     if (kvm_has_xsave()) {
         env->kvm_xsave_buf = qemu_memalign(4096, sizeof(struct kvm_xsave));
     }
-- 
2.4.8




reply via email to

[Prev in Thread] Current Thread [Next in Thread]