On 01/11/21 14:23, Maxim Levitsky wrote:
Signed-off-by: Maxim Levitsky <mlevitsk@xxxxxxxxxx> --- target/i386/cpu.c | 5 +++++ target/i386/cpu.h | 4 ++++ target/i386/kvm/kvm.c | 15 +++++++++++++++ target/i386/machine.c | 23 +++++++++++++++++++++++ 4 files changed, 47 insertions(+)
It's easier to migrate it unconditionally: diff --git a/target/i386/machine.c b/target/i386/machine.c index e1138693f3..83c2b91529 100644 --- a/target/i386/machine.c +++ b/target/i386/machine.c @@ -1286,8 +1286,7 @@ static bool amd_tsc_scale_msr_needed(void *opaque) X86CPU *cpu = opaque; CPUX86State *env = &cpu->env; - return env->amd_tsc_scale_msr && - env->amd_tsc_scale_msr != MSR_AMD64_TSC_RATIO_DEFAULT; + return (env->features[FEAT_SVM] & CPUID_SVM_TSCSCALE); } static const VMStateDescription amd_tsc_scale_msr_ctrl = {
+ if (env->features[FEAT_SVM] & CPUID_SVM_TSCSCALE) { + env->amd_tsc_scale_msr = MSR_AMD64_TSC_RATIO_DEFAULT; + }
and also set it unconditionally here, so that it's always passed correctly to KVM.
I queued patches 2 and 3, for (1) I need to think more about migration to older QEMU versions.
Paolo