In case of PSCI off followed by a PSCI on which is a scenario that happens notably during kexec, what happens today is that the state sync does not happen and the vCPU becomes in an unexpected state.
Address this via marking the vCPU as dirty during a PSCI power on. Signed-off-by: Mohamed Mediouni <[email protected]> --- target/arm/hvf/hvf.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index e1ddfe14c7..7ce2e38df1 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1651,6 +1651,14 @@ static bool hvf_handle_psci_call(CPUState *cpu, int *excp_ret) context_id = param[3]; ret = arm_set_cpu_on(mpidr, entry, context_id, hvf_psci_get_target_el(), target_aarch64); + + /* + * Mark state as dirty for HVF to sync context + * when the vCPU runs. arm_set_cpu_on() does not + * do it by itself. + */ + arm_get_cpu_by_id(mpidr)->vcpu_dirty = true; + break; case QEMU_PSCI_0_1_FN_CPU_OFF: case QEMU_PSCI_0_2_FN_CPU_OFF: -- 2.54.0 (Apple Git-157)
