Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff2c3a18 authored by Haozhong Zhang's avatar Haozhong Zhang Committed by Paolo Bonzini
Browse files

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: default avatarHaozhong Zhang <haozhong.zhang@intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 64903d61
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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;
	}