diff options
-rw-r--r-- | arch/x86/kvm/svm.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 41c996ab87e9..9a4dacab6d8a 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -763,14 +763,13 @@ static void svm_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | |||
763 | int i; | 763 | int i; |
764 | 764 | ||
765 | if (unlikely(cpu != vcpu->cpu)) { | 765 | if (unlikely(cpu != vcpu->cpu)) { |
766 | u64 tsc_this, delta; | 766 | u64 delta; |
767 | 767 | ||
768 | /* | 768 | /* |
769 | * Make sure that the guest sees a monotonically | 769 | * Make sure that the guest sees a monotonically |
770 | * increasing TSC. | 770 | * increasing TSC. |
771 | */ | 771 | */ |
772 | rdtscll(tsc_this); | 772 | delta = vcpu->arch.host_tsc - native_read_tsc(); |
773 | delta = vcpu->arch.host_tsc - tsc_this; | ||
774 | svm->vmcb->control.tsc_offset += delta; | 773 | svm->vmcb->control.tsc_offset += delta; |
775 | if (is_nested(svm)) | 774 | if (is_nested(svm)) |
776 | svm->nested.hsave->control.tsc_offset += delta; | 775 | svm->nested.hsave->control.tsc_offset += delta; |
@@ -792,7 +791,7 @@ static void svm_vcpu_put(struct kvm_vcpu *vcpu) | |||
792 | for (i = 0; i < NR_HOST_SAVE_USER_MSRS; i++) | 791 | for (i = 0; i < NR_HOST_SAVE_USER_MSRS; i++) |
793 | wrmsrl(host_save_user_msrs[i], svm->host_user_msrs[i]); | 792 | wrmsrl(host_save_user_msrs[i], svm->host_user_msrs[i]); |
794 | 793 | ||
795 | rdtscll(vcpu->arch.host_tsc); | 794 | vcpu->arch.host_tsc = native_read_tsc(); |
796 | } | 795 | } |
797 | 796 | ||
798 | static unsigned long svm_get_rflags(struct kvm_vcpu *vcpu) | 797 | static unsigned long svm_get_rflags(struct kvm_vcpu *vcpu) |