[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/3] qemu-x86: Set tsc_khz in kvm when supported
From: |
Joerg Roedel |
Subject: |
[Qemu-devel] [PATCH 3/3] qemu-x86: Set tsc_khz in kvm when supported |
Date: |
Thu, 7 Jul 2011 16:13:13 +0200 |
Make use of the KVM_TSC_CONTROL feature if available.
Signed-off-by: Joerg Roedel <address@hidden>
---
target-i386/kvm.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 10fb2c4..923d2d5 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -354,6 +354,7 @@ int kvm_arch_init_vcpu(CPUState *env)
uint32_t unused;
struct kvm_cpuid_entry2 *c;
uint32_t signature[3];
+ int r;
env->cpuid_features &= kvm_arch_get_supported_cpuid(s, 1, 0, R_EDX);
@@ -499,7 +500,22 @@ int kvm_arch_init_vcpu(CPUState *env)
qemu_add_vm_change_state_handler(cpu_update_state, env);
- return kvm_vcpu_ioctl(env, KVM_SET_CPUID2, &cpuid_data);
+ r = kvm_vcpu_ioctl(env, KVM_SET_CPUID2, &cpuid_data);
+ if (r)
+ return r;
+
+#ifdef KVM_CAP_TSC_CONTROL
+ r = kvm_check_extension(env->kvm_state, KVM_CAP_TSC_CONTROL);
+ if (r && env->tsc_khz) {
+ r = kvm_vcpu_ioctl(env, KVM_SET_TSC_KHZ, env->tsc_khz);
+ if (r < 0) {
+ fprintf(stderr, "KVM_SET_TSC_KHZ failed\n");
+ return r;
+ }
+ }
+#endif
+
+ return 0;
}
void kvm_arch_reset_vcpu(CPUState *env)
--
1.7.4.1
- Re: [Qemu-devel] [PATCH 1/3] qemu: Add strtosz_suffix_unit function, (continued)
- [Qemu-devel] [PATCH 2/3] qemu-x86: Add tsc_freq option to -cpu, Joerg Roedel, 2011/07/07
- Re: [Qemu-devel] [PATCH 2/3] qemu-x86: Add tsc_freq option to -cpu, Marcelo Tosatti, 2011/07/19
- Re: [Qemu-devel] [PATCH 2/3] qemu-x86: Add tsc_freq option to -cpu, Avi Kivity, 2011/07/19
- Re: [Qemu-devel] [PATCH 2/3] qemu-x86: Add tsc_freq option to -cpu, Marcelo Tosatti, 2011/07/19
- Re: [Qemu-devel] [PATCH 2/3] qemu-x86: Add tsc_freq option to -cpu, Joerg Roedel, 2011/07/19
- Re: [Qemu-devel] [PATCH 2/3] qemu-x86: Add tsc_freq option to -cpu, Avi Kivity, 2011/07/19
- Re: [Qemu-devel] [PATCH 2/3] qemu-x86: Add tsc_freq option to -cpu, Avi Kivity, 2011/07/19
- Re: [Qemu-devel] [PATCH 2/3] qemu-x86: Add tsc_freq option to -cpu, Joerg Roedel, 2011/07/19
- Re: [Qemu-devel] [PATCH 2/3] qemu-x86: Add tsc_freq option to -cpu, Avi Kivity, 2011/07/19
[Qemu-devel] [PATCH 3/3] qemu-x86: Set tsc_khz in kvm when supported,
Joerg Roedel <=
Re: [Qemu-devel] [PATCH 0/3][uq/master] Basic TSC-Scaling support v2, Marcelo Tosatti, 2011/07/19