If confidential guest support is active, set TSC to 0 on the target when loading the CPU state. This causes the guest OS to re-sync with kvm-clock.
Without this change, the guest clocks after migration are stuck (don't advance), except the *_COARSE clocks which advance normally. Signed-off-by: Dov Murik <dovmu...@linux.vnet.ibm.com> --- target/i386/machine.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/target/i386/machine.c b/target/i386/machine.c index 3768a753af..36c52ec02e 100644 --- a/target/i386/machine.c +++ b/target/i386/machine.c @@ -297,8 +297,17 @@ static int cpu_post_load(void *opaque, int version_id) X86CPU *cpu = opaque; CPUState *cs = CPU(cpu); CPUX86State *env = &cpu->env; + MachineState *ms = MACHINE(qdev_get_machine()); int i; + /* + * When loading the state of a confidential guest, set TSC to zero at allow + * the guest OS to re-sync with kvmclock. + */ + if (ms->cgs) { + env->tsc = 0; + } + if (env->tsc_khz && env->user_tsc_khz && env->tsc_khz != env->user_tsc_khz) { error_report("Mismatch between user-specified TSC frequency and " -- 2.20.1