[PULL 03/15] hw/intc/loongarch_ipi: Notify ipi object when cpu is plugged

Bibo Mao posted 15 patches 4 weeks ago
Only 13 patches received!
There is a newer version of this series
[PULL 03/15] hw/intc/loongarch_ipi: Notify ipi object when cpu is plugged
Posted by Bibo Mao 4 weeks ago
Use hotplug_handler_plug() to nofity ipi object when cold-plug
cpu is created, so that ipi can set and configure irq routing
to new cpu.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
 hw/loongarch/virt.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index 59533b058b..0629347da1 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -317,6 +317,7 @@ static void virt_cpu_irq_init(LoongArchVirtMachineState *lvms)
     MachineClass *mc = MACHINE_GET_CLASS(ms);
     const CPUArchIdList *possible_cpus;
     CPUState *cs;
+    Error *err = NULL;
 
     /* cpu nodes */
     possible_cpus = mc->possible_cpu_arch_ids(ms);
@@ -326,9 +327,7 @@ static void virt_cpu_irq_init(LoongArchVirtMachineState *lvms)
             continue;
         }
 
-        /* connect ipi irq to cpu irq */
-        qdev_connect_gpio_out(lvms->ipi, num,
-                              qdev_get_gpio_in(DEVICE(cs), IRQ_IPI));
+        hotplug_handler_plug(HOTPLUG_HANDLER(lvms->ipi), DEVICE(cs), &err);
 
         /*
          * connect ext irq to the cpu irq
-- 
2.43.5