aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2010-11-30 12:04:01 -0500
committerAvi Kivity <avi@redhat.com>2011-01-12 04:30:17 -0500
commit4cc703100b1fd97c71804e2fa5c9c377c5b37dc5 (patch)
tree3fa1e619f50f44fb4e6ba27fc626c1ebbad1407b
parent8a05a1b8693371547bbb2d06f842595cebd16687 (diff)
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 <joerg.roedel@amd.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r--arch/x86/kvm/svm.c9
1 files changed, 2 insertions, 7 deletions
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)
2630 2630
2631 switch (ecx) { 2631 switch (ecx) {
2632 case MSR_IA32_TSC: { 2632 case MSR_IA32_TSC: {
2633 u64 tsc_offset; 2633 struct vmcb *vmcb = get_host_vmcb(svm);
2634 2634
2635 if (is_guest_mode(vcpu)) 2635 *data = vmcb->control.tsc_offset + native_read_tsc();
2636 tsc_offset = svm->nested.hsave->control.tsc_offset;
2637 else
2638 tsc_offset = svm->vmcb->control.tsc_offset;
2639
2640 *data = tsc_offset + native_read_tsc();
2641 break; 2636 break;
2642 } 2637 }
2643 case MSR_STAR: 2638 case MSR_STAR: