summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/svm/svm.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2022-03-05 00:39:29 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2022-03-05 00:39:29 +0100
commit0564eeb71bbb0e1a566fb701f90155bef9e7a224 (patch)
tree2935323651d0f8ab2acb5f96f6ee6c722a9cad5a /arch/x86/kvm/svm/svm.c
parentKVM: SVM: Disable preemption across AVIC load/put during APICv refresh (diff)
parentKVM: x86: pull kvm->srcu read-side to kvm_arch_vcpu_ioctl_run (diff)
downloadlinux-0564eeb71bbb0e1a566fb701f90155bef9e7a224.tar.xz
linux-0564eeb71bbb0e1a566fb701f90155bef9e7a224.zip
Merge branch 'kvm-bugfixes' into HEAD
Merge bugfixes from 5.17 before merging more tricky work.
Diffstat (limited to 'arch/x86/kvm/svm/svm.c')
-rw-r--r--arch/x86/kvm/svm/svm.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index c5e3f219803e..fc5222a0f506 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -2705,8 +2705,23 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
u64 data = msr->data;
switch (ecx) {
case MSR_AMD64_TSC_RATIO:
- if (!msr->host_initiated && !svm->tsc_scaling_enabled)
- return 1;
+
+ if (!svm->tsc_scaling_enabled) {
+
+ if (!msr->host_initiated)
+ return 1;
+ /*
+ * In case TSC scaling is not enabled, always
+ * leave this MSR at the default value.
+ *
+ * Due to bug in qemu 6.2.0, it would try to set
+ * this msr to 0 if tsc scaling is not enabled.
+ * Ignore this value as well.
+ */
+ if (data != 0 && data != svm->tsc_ratio_msr)
+ return 1;
+ break;
+ }
if (data & TSC_RATIO_RSVD)
return 1;