On Fri, 21 Mar 2025 11:12:56 +0800 Bibo Mao <maob...@loongson.cn> wrote:
> 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. see my comment to 2/6, the same applies here. (unless there is a good reason why it can fail) > > 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 | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c > index 8563967c8b..503362a69e 100644 > --- a/hw/loongarch/virt.c > +++ b/hw/loongarch/virt.c > @@ -958,6 +958,8 @@ static void virt_cpu_unplug(HotplugHandler *hotplug_dev, > hotplug_handler_unplug(HOTPLUG_HANDLER(lvms->extioi), dev, &err); > if (err) { > error_propagate(errp, err); > + hotplug_handler_plug(HOTPLUG_HANDLER(lvms->ipi), dev, > + &error_abort); > return; > } > > @@ -965,6 +967,10 @@ static void virt_cpu_unplug(HotplugHandler *hotplug_dev, > hotplug_handler_unplug(HOTPLUG_HANDLER(lvms->acpi_ged), dev, &err); > if (err) { > error_propagate(errp, err); > + hotplug_handler_plug(HOTPLUG_HANDLER(lvms->ipi), dev, > + &error_abort); > + hotplug_handler_plug(HOTPLUG_HANDLER(lvms->extioi), dev, > + &error_abort); > return; > } >