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

Commit 4cc70310 authored by Joerg Roedel's avatar Joerg Roedel Committed by Avi Kivity
Browse files

KVM: SVM: Use get_host_vmcb function in svm_get_msr for TSC



This patch replaces the open-coded vmcb-selection for the
TSC calculation with the new get_host_vmcb helper function
introduced in this patchset.

Signed-off-by: default avatarJoerg Roedel <joerg.roedel@amd.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent 8a05a1b8
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -2630,14 +2630,9 @@ static int svm_get_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 *data)

	switch (ecx) {
	case MSR_IA32_TSC: {
		u64 tsc_offset;

		if (is_guest_mode(vcpu))
			tsc_offset = svm->nested.hsave->control.tsc_offset;
		else
			tsc_offset = svm->vmcb->control.tsc_offset;
		struct vmcb *vmcb = get_host_vmcb(svm);

		*data = tsc_offset + native_read_tsc();
		*data = vmcb->control.tsc_offset + native_read_tsc();
		break;
	}
	case MSR_STAR: