diff options
author | Xiaoyao Li <xiaoyao.li@intel.com> | 2024-08-14 03:54:31 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2024-10-17 12:30:21 +0200 |
commit | 87c88db3143e91076d167a62dd7febf49afca8a2 (patch) | |
tree | 2ed06cd3f23dbc8f24cd0f79777d5b3c2f2d3dbd | |
parent | 5ab639141b6d916a6f4041d4ec46f2f1a1e4a365 (diff) | |
download | qemu-87c88db3143e91076d167a62dd7febf49afca8a2.zip qemu-87c88db3143e91076d167a62dd7febf49afca8a2.tar.gz qemu-87c88db3143e91076d167a62dd7febf49afca8a2.tar.bz2 |
target/i386: Make invtsc migratable when user sets tsc-khz explicitly
When user sets tsc-frequency explicitly, the invtsc feature is actually
migratable because the tsc-frequency is supposed to be fixed during the
migration.
See commit d99569d9d856 ("kvm: Allow invtsc migration if tsc-khz
is set explicitly") for referrence.
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Link: https://lore.kernel.org/r/20240814075431.339209-10-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | target/i386/cpu.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 089b651..5535f4e 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1865,9 +1865,10 @@ static inline uint64_t x86_cpu_xsave_xss_components(X86CPU *cpu) * Returns the set of feature flags that are supported and migratable by * QEMU, for a given FeatureWord. */ -static uint64_t x86_cpu_get_migratable_flags(FeatureWord w) +static uint64_t x86_cpu_get_migratable_flags(X86CPU *cpu, FeatureWord w) { FeatureWordInfo *wi = &feature_word_info[w]; + CPUX86State *env = &cpu->env; uint64_t r = 0; int i; @@ -1881,6 +1882,12 @@ static uint64_t x86_cpu_get_migratable_flags(FeatureWord w) r |= f; } } + + /* when tsc-khz is set explicitly, invtsc is migratable */ + if ((w == FEAT_8000_0007_EDX) && env->user_tsc_khz) { + r |= CPUID_APM_INVTSC; + } + return r; } @@ -6124,7 +6131,7 @@ uint64_t x86_cpu_get_supported_feature_word(X86CPU *cpu, FeatureWord w) r &= ~unavail; if (cpu && cpu->migratable) { - r &= x86_cpu_get_migratable_flags(w); + r &= x86_cpu_get_migratable_flags(cpu, w); } return r; } |