diff options
author | Haozhong Zhang <haozhong.zhang@intel.com> | 2015-10-20 15:39:10 +0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2015-11-10 12:06:20 +0100 |
commit | ff2c3a1803775cc72dc6f624b59554956396b0ee (patch) | |
tree | 9c7590b93dc726a8bce9ea87dff3726320c98061 /arch/x86/kvm/vmx.c | |
parent | 64903d6195cbfb051ce339d30848cc64babdba12 (diff) | |
download | blackbird-op-linux-ff2c3a1803775cc72dc6f624b59554956396b0ee.tar.gz blackbird-op-linux-ff2c3a1803775cc72dc6f624b59554956396b0ee.zip |
KVM: VMX: Setup TSC scaling ratio when a vcpu is loaded
This patch makes kvm-intel module to load TSC scaling ratio into TSC
multiplier field of VMCS when a vcpu is loaded, so that TSC scaling
ratio can take effect if VMX TSC scaling is enabled.
Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index e45b03ed5c52..890295287afa 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2061,6 +2061,12 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu) rdmsrl(MSR_IA32_SYSENTER_ESP, sysenter_esp); vmcs_writel(HOST_IA32_SYSENTER_ESP, sysenter_esp); /* 22.2.3 */ + + /* Setup TSC multiplier */ + if (cpu_has_vmx_tsc_scaling()) + vmcs_write64(TSC_MULTIPLIER, + vcpu->arch.tsc_scaling_ratio); + vmx->loaded_vmcs->cpu = cpu; } |