diff options
Diffstat (limited to 'target/i386')
-rw-r--r-- | target/i386/cpu.c | 13 | ||||
-rw-r--r-- | target/i386/cpu.h | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/target/i386/cpu.c b/target/i386/cpu.c index ec3b50bf6e..cb6b5467d0 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -5931,6 +5931,19 @@ static void x86_cpu_reset(DeviceState *dev) env->xstate_bv = 0; env->pat = 0x0007040600070406ULL; + + if (kvm_enabled()) { + /* + * KVM handles TSC = 0 specially and thinks we are hot-plugging + * a new CPU, use 1 instead to force a reset. + */ + if (env->tsc != 0) { + env->tsc = 1; + } + } else { + env->tsc = 0; + } + env->msr_ia32_misc_enable = MSR_IA32_MISC_ENABLE_DEFAULT; if (env->features[FEAT_1_ECX] & CPUID_EXT_MONITOR) { env->msr_ia32_misc_enable |= MSR_IA32_MISC_ENABLE_MWAIT; diff --git a/target/i386/cpu.h b/target/i386/cpu.h index e31e6bd8b8..982c532353 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1554,7 +1554,6 @@ typedef struct CPUArchState { target_ulong kernelgsbase; #endif - uint64_t tsc; uint64_t tsc_adjust; uint64_t tsc_deadline; uint64_t tsc_aux; @@ -1708,6 +1707,7 @@ typedef struct CPUArchState { int64_t tsc_khz; int64_t user_tsc_khz; /* for sanity check only */ uint64_t apic_bus_freq; + uint64_t tsc; #if defined(CONFIG_KVM) || defined(CONFIG_HVF) void *xsave_buf; uint32_t xsave_buf_len; |