Skip to content

Commit

Permalink
KVM: SVM: Use get_host_vmcb function in svm_get_msr for TSC
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Joerg Roedel authored and Avi Kivity committed Jan 12, 2011
1 parent 8a05a1b commit 4cc7031
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions arch/x86/kvm/svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 4cc7031

Please sign in to comment.