diff options
author | Maxim Levitsky <mlevitsk@redhat.com> | 2022-03-22 18:24:48 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2022-04-02 11:37:26 +0200 |
commit | 880993138396f8f0be620c425d08f84490c35251 (patch) | |
tree | b586f8d40d19238f593bf0cf3b13eef90129912a /arch/x86/kvm/x86.c | |
parent | kvm: x86: SVM: remove unused defines (diff) | |
download | linux-880993138396f8f0be620c425d08f84490c35251.tar.xz linux-880993138396f8f0be620c425d08f84490c35251.zip |
KVM: x86: SVM: fix tsc scaling when the host doesn't support it
It was decided that when TSC scaling is not supported,
the virtual MSR_AMD64_TSC_RATIO should still have the default '1.0'
value.
However in this case kvm_max_tsc_scaling_ratio is not set,
which breaks various assumptions.
Fix this by always calculating kvm_max_tsc_scaling_ratio regardless of
host support. For consistency, do the same for VMX.
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20220322172449.235575-8-mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to '')
-rw-r--r-- | arch/x86/kvm/x86.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index bc63ba52c4d6..498cd4aaa2cb 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -11602,10 +11602,8 @@ int kvm_arch_hardware_setup(void *opaque) u64 max = min(0x7fffffffULL, __scale_tsc(kvm_max_tsc_scaling_ratio, tsc_khz)); kvm_max_guest_tsc_khz = max; - - kvm_default_tsc_scaling_ratio = 1ULL << kvm_tsc_scaling_ratio_frac_bits; } - + kvm_default_tsc_scaling_ratio = 1ULL << kvm_tsc_scaling_ratio_frac_bits; kvm_init_msr_list(); return 0; } |