diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2011-08-08 14:38:42 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2011-08-08 14:38:42 -0500 |
commit | 986563b173ca2d4bd47b10455b19c86e5cd5bba2 (patch) | |
tree | 25db73df4cb973bf86c58341cb82415ab8d2c90b /target-i386/kvm.c | |
parent | 039523397fce67ccb15a9b71ef812f9a69286aa5 (diff) | |
parent | ac363c9042eb1010b88af0a202c09475ef909972 (diff) |
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging
Diffstat (limited to 'target-i386/kvm.c')
-rw-r--r-- | target-i386/kvm.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 10fb2c4b07..31b88b7499 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,20 @@ 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; + + 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; + } + } + + return 0; } void kvm_arch_reset_vcpu(CPUState *env) |