Make use of the KVM_TSC_CONTROL feature if available. Signed-off-by: Joerg Roedel <joerg.roedel@xxxxxxx> --- target-i386/kvm.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 1ae2d61..2d89544 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -528,6 +528,17 @@ int kvm_arch_init_vcpu(CPUState *env) } #endif +#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 + qemu_add_vm_change_state_handler(cpu_update_state, env); return kvm_vcpu_ioctl(env, KVM_SET_CPUID2, &cpuid_data); -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html