aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2016-07-06 08:57:24 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2016-07-14 13:11:10 -0400
commit9770404a0061ec46dec6e15c4b07731ce2e2d7bb (patch)
treef055df1f6dca4abdc063c34870c0e106019a33b6
parent30b072ce0356e8b141f4ca6da7220486fa3641d9 (diff)
KVM: SVM: fix trashing of MSR_TSC_AUX
I don't know what I was thinking when I wrote commit 46896c73c1a4 ("KVM: svm: add support for RDTSCP", 2015-11-12); I missed write_rdtscp_aux which obviously uses MSR_TSC_AUX. Therefore we do need to save/restore MSR_TSC_AUX in svm_vcpu_run. Cc: stable@vger.kernel.org Cc: Borislav Petkov <bp@alien8.de> Fixes: 46896c73c1a4 ("KVM: svm: add support for RDTSCP") Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--arch/x86/kvm/svm.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 16ef31b87452..f931d3e33c7f 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -41,6 +41,7 @@
41#include <asm/desc.h> 41#include <asm/desc.h>
42#include <asm/debugreg.h> 42#include <asm/debugreg.h>
43#include <asm/kvm_para.h> 43#include <asm/kvm_para.h>
44#include <asm/vgtod.h>
44 45
45#include <asm/virtext.h> 46#include <asm/virtext.h>
46#include "trace.h" 47#include "trace.h"
@@ -1530,9 +1531,6 @@ static void svm_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
1530 wrmsrl(MSR_AMD64_TSC_RATIO, tsc_ratio); 1531 wrmsrl(MSR_AMD64_TSC_RATIO, tsc_ratio);
1531 } 1532 }
1532 } 1533 }
1533 /* This assumes that the kernel never uses MSR_TSC_AUX */
1534 if (static_cpu_has(X86_FEATURE_RDTSCP))
1535 wrmsrl(MSR_TSC_AUX, svm->tsc_aux);
1536 1534
1537 avic_vcpu_load(vcpu, cpu); 1535 avic_vcpu_load(vcpu, cpu);
1538} 1536}
@@ -4474,6 +4472,8 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
4474 svm->vmcb->save.cr2 = vcpu->arch.cr2; 4472 svm->vmcb->save.cr2 = vcpu->arch.cr2;
4475 4473
4476 clgi(); 4474 clgi();
4475 if (static_cpu_has(X86_FEATURE_RDTSCP))
4476 wrmsrl(MSR_TSC_AUX, svm->tsc_aux);
4477 4477
4478 local_irq_enable(); 4478 local_irq_enable();
4479 4479
@@ -4550,6 +4550,8 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
4550#endif 4550#endif
4551 ); 4551 );
4552 4552
4553 if (static_cpu_has(X86_FEATURE_RDTSCP))
4554 wrmsrl(MSR_TSC_AUX, __getcpu());
4553#ifdef CONFIG_X86_64 4555#ifdef CONFIG_X86_64
4554 wrmsrl(MSR_GS_BASE, svm->host.gs_base); 4556 wrmsrl(MSR_GS_BASE, svm->host.gs_base);
4555#else 4557#else