]> git.karo-electronics.de Git - linux-beck.git/commitdiff
KVM: SVM: Use get_host_vmcb function in svm_get_msr for TSC
authorJoerg Roedel <joerg.roedel@amd.com>
Tue, 30 Nov 2010 17:04:01 +0000 (18:04 +0100)
committerAvi Kivity <avi@redhat.com>
Wed, 12 Jan 2011 09:30:17 +0000 (11:30 +0200)
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>
arch/x86/kvm/svm.c

index cde5392bbe90d9f539466e24f57cab7549a1d6f7..50387860a53ca261c8c73b35c10590a384beb0d5 100644 (file)
@@ -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: