* [PULL 1/2] hw/loongarch/virt: Fix cpuslot::cpu set at last in virt_cpu_plug()
2025-04-08 6:41 [PULL 0/2] loongarch bug fix for 10.0 Song Gao
@ 2025-04-08 6:41 ` Song Gao
2025-04-08 6:41 ` [PULL 2/2] hw/loongarch/virt: Replace destination error with error_abort Song Gao
2025-04-09 8:31 ` [PULL 0/2] loongarch bug fix for 10.0 Stefan Hajnoczi
2 siblings, 0 replies; 4+ messages in thread
From: Song Gao @ 2025-04-08 6:41 UTC (permalink / raw)
To: qemu-devel; +Cc: stefanha, Bibo Mao, Markus Armbruster
From: Bibo Mao <maobibo@loongson.cn>
In function virt_cpu_plug(), Object cpuslot::cpu is set at last
only when there is no any error, otherwise it is problematic that
cpuslot::cpu is set in advance however it returns because of error.
Fixes: ab9935d2991e (hw/loongarch/virt: Implement cpu plug interface)
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20250324030145.3037408-2-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
---
hw/loongarch/virt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index e25864214f..504f8755a0 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -973,8 +973,6 @@ static void virt_cpu_plug(HotplugHandler *hotplug_dev,
LoongArchVirtMachineState *lvms = LOONGARCH_VIRT_MACHINE(hotplug_dev);
Error *err = NULL;
- cpu_slot = virt_find_cpu_slot(MACHINE(lvms), cpu->phy_id);
- cpu_slot->cpu = CPU(dev);
if (lvms->ipi) {
hotplug_handler_plug(HOTPLUG_HANDLER(lvms->ipi), dev, &err);
if (err) {
@@ -998,6 +996,8 @@ static void virt_cpu_plug(HotplugHandler *hotplug_dev,
}
}
+ cpu_slot = virt_find_cpu_slot(MACHINE(lvms), cpu->phy_id);
+ cpu_slot->cpu = CPU(dev);
return;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PULL 2/2] hw/loongarch/virt: Replace destination error with error_abort
2025-04-08 6:41 [PULL 0/2] loongarch bug fix for 10.0 Song Gao
2025-04-08 6:41 ` [PULL 1/2] hw/loongarch/virt: Fix cpuslot::cpu set at last in virt_cpu_plug() Song Gao
@ 2025-04-08 6:41 ` Song Gao
2025-04-09 8:31 ` [PULL 0/2] loongarch bug fix for 10.0 Stefan Hajnoczi
2 siblings, 0 replies; 4+ messages in thread
From: Song Gao @ 2025-04-08 6:41 UTC (permalink / raw)
To: qemu-devel; +Cc: stefanha, Bibo Mao, Markus Armbruster
From: Bibo Mao <maobibo@loongson.cn>
In function virt_cpu_plug() and virt_cpu_unplug(), the error is
impossile. Destination error is not propagated and replaced with
error_abort. With this, the logic is simple.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Acked-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20250324030145.3037408-3-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
---
hw/loongarch/virt.c | 39 +++++++--------------------------------
1 file changed, 7 insertions(+), 32 deletions(-)
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index 504f8755a0..65c9027feb 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -936,29 +936,15 @@ static void virt_cpu_unplug(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
CPUArchId *cpu_slot;
- Error *err = NULL;
LoongArchCPU *cpu = LOONGARCH_CPU(dev);
LoongArchVirtMachineState *lvms = LOONGARCH_VIRT_MACHINE(hotplug_dev);
/* Notify ipi and extioi irqchip to remove interrupt routing to CPU */
- hotplug_handler_unplug(HOTPLUG_HANDLER(lvms->ipi), dev, &err);
- if (err) {
- error_propagate(errp, err);
- return;
- }
-
- hotplug_handler_unplug(HOTPLUG_HANDLER(lvms->extioi), dev, &err);
- if (err) {
- error_propagate(errp, err);
- return;
- }
+ hotplug_handler_unplug(HOTPLUG_HANDLER(lvms->ipi), dev, &error_abort);
+ hotplug_handler_unplug(HOTPLUG_HANDLER(lvms->extioi), dev, &error_abort);
/* Notify acpi ged CPU removed */
- hotplug_handler_unplug(HOTPLUG_HANDLER(lvms->acpi_ged), dev, &err);
- if (err) {
- error_propagate(errp, err);
- return;
- }
+ hotplug_handler_unplug(HOTPLUG_HANDLER(lvms->acpi_ged), dev, &error_abort);
cpu_slot = virt_find_cpu_slot(MACHINE(lvms), cpu->phy_id);
cpu_slot->cpu = NULL;
@@ -971,29 +957,18 @@ static void virt_cpu_plug(HotplugHandler *hotplug_dev,
CPUArchId *cpu_slot;
LoongArchCPU *cpu = LOONGARCH_CPU(dev);
LoongArchVirtMachineState *lvms = LOONGARCH_VIRT_MACHINE(hotplug_dev);
- Error *err = NULL;
if (lvms->ipi) {
- hotplug_handler_plug(HOTPLUG_HANDLER(lvms->ipi), dev, &err);
- if (err) {
- error_propagate(errp, err);
- return;
- }
+ hotplug_handler_plug(HOTPLUG_HANDLER(lvms->ipi), dev, &error_abort);
}
if (lvms->extioi) {
- hotplug_handler_plug(HOTPLUG_HANDLER(lvms->extioi), dev, &err);
- if (err) {
- error_propagate(errp, err);
- return;
- }
+ hotplug_handler_plug(HOTPLUG_HANDLER(lvms->extioi), dev, &error_abort);
}
if (lvms->acpi_ged) {
- hotplug_handler_plug(HOTPLUG_HANDLER(lvms->acpi_ged), dev, &err);
- if (err) {
- error_propagate(errp, err);
- }
+ hotplug_handler_plug(HOTPLUG_HANDLER(lvms->acpi_ged), dev,
+ &error_abort);
}
cpu_slot = virt_find_cpu_slot(MACHINE(lvms), cpu->phy_id);
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread