From c3f86c199885506cfddde0dfc235c04e0897d591 Mon Sep 17 00:00:00 2001 From: Kunkun Jiang Date: Tue, 14 Feb 2023 20:33:40 +0800 Subject: [PATCH] arm/virt: Correct timing of executing cpu_synchronize_post_init for hot-plugged cpus When the CPU starts normally, cpu_synchronize_post_init is executed after GICv3 is implemented. This order should be followed when dealing with hot-plugged CPUs. Signed-off-by: Kunkun Jiang --- hw/arm/virt.c | 1 + hw/core/cpu-common.c | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 4716f9baaa..7d5b332594 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2798,6 +2798,7 @@ static void virt_cpu_plug(HotplugHandler *hotplug_dev, } /* Register CPU reset and trigger it manually */ + cpu_synchronize_post_init(cs); cpu_synchronize_state(cs); cpu_hotplug_register_reset(ncpu); cpu_hotplug_reset_manually(ncpu); diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index b8d1d820cb..2213840260 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -206,14 +206,12 @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp) } } +#ifdef __aarch64__ if (dev->hotplugged) { cpu_synchronize_post_init(cpu); - -#ifdef __aarch64__ - if (!kvm_enabled()) -#endif cpu_resume(cpu); } +#endif /* NOTE: latest generic point where the cpu is fully realized */ trace_init_vcpu(cpu); -- 2.27.0