Skip to content

Commit ff2c3a1

Browse files
Haozhong Zhangbonzini
authored andcommitted
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>
1 parent 64903d6 commit ff2c3a1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

arch/x86/kvm/vmx.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,6 +2061,12 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
20612061

20622062
rdmsrl(MSR_IA32_SYSENTER_ESP, sysenter_esp);
20632063
vmcs_writel(HOST_IA32_SYSENTER_ESP, sysenter_esp); /* 22.2.3 */
2064+
2065+
/* Setup TSC multiplier */
2066+
if (cpu_has_vmx_tsc_scaling())
2067+
vmcs_write64(TSC_MULTIPLIER,
2068+
vcpu->arch.tsc_scaling_ratio);
2069+
20642070
vmx->loaded_vmcs->cpu = cpu;
20652071
}
20662072

0 commit comments

Comments
 (0)