From: Joerg Roedel Date: Tue, 30 Nov 2010 17:04:01 +0000 (+0100) Subject: KVM: SVM: Use get_host_vmcb function in svm_get_msr for TSC X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=4cc703100b1fd97c71804e2fa5c9c377c5b37dc5;p=linux-beck.git 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: Joerg Roedel Signed-off-by: Marcelo Tosatti --- diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index cde5392bbe90..50387860a53c 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -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; + struct vmcb *vmcb = get_host_vmcb(svm); - if (is_guest_mode(vcpu)) - tsc_offset = svm->nested.hsave->control.tsc_offset; - else - tsc_offset = svm->vmcb->control.tsc_offset; - - *data = tsc_offset + native_read_tsc(); + *data = vmcb->control.tsc_offset + native_read_tsc(); break; } case MSR_STAR: