In function virt_cpu_unplug(), it will send cpu unplug message to interrupt controller extioi and ipi irqchip. If there is problem in this function, system should continue to run and keep state the same before cpu is removed.
If error happends in cpu unplug stage, send cpu plug message to extioi and ipi irqchip to restore to previous stage, and then return immediately. Fixes: 2cd6857f6f5b (hw/loongarch/virt: Implement cpu unplug interface) Signed-off-by: Bibo Mao <maob...@loongson.cn> --- hw/loongarch/virt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index 5118f01e4b..8dd5d88c31 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -958,12 +958,16 @@ static void virt_cpu_unplug(HotplugHandler *hotplug_dev, hotplug_handler_unplug(HOTPLUG_HANDLER(lvms->extioi), dev, &err); if (err) { error_propagate(errp, err); + /* Send plug message to restore, discard error here */ + hotplug_handler_plug(HOTPLUG_HANDLER(lvms->ipi), dev, NULL); return; } /* Notify acpi ged CPU removed */ hotplug_handler_unplug(HOTPLUG_HANDLER(lvms->acpi_ged), dev, &err); if (err) { + hotplug_handler_plug(HOTPLUG_HANDLER(lvms->ipi), dev, NULL); + hotplug_handler_plug(HOTPLUG_HANDLER(lvms->extioi), dev, NULL); error_propagate(errp, err); return; } -- 2.39.3