summary refs log tree commit diff stats
path: root/hw/intc/loongarch_extioi_common.c
diff options
context:
space:
mode:
authorBibo Mao <maobibo@loongson.cn>2025-01-10 16:29:47 +0800
committerBibo Mao <maobibo@loongson.cn>2025-03-05 09:39:17 +0800
commit8b4b668f6a3661885fcabcedcf812930d5577f7e (patch)
tree8357322e2e989905e1292c80051425e5bc286102 /hw/intc/loongarch_extioi_common.c
parent50ebc3fc47f7e4133e0d5e2674a1db17ddd5e815 (diff)
downloadfocaccia-qemu-8b4b668f6a3661885fcabcedcf812930d5577f7e.tar.gz
focaccia-qemu-8b4b668f6a3661885fcabcedcf812930d5577f7e.zip
hw/intc/loongarch_extioi: Move gpio irq initial to common code
When cpu is added, it will connect gpio irq line to cpu irq.
And cpu hot-add is put in common code, move gpio irq initial
part into common code.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Diffstat (limited to 'hw/intc/loongarch_extioi_common.c')
-rw-r--r--hw/intc/loongarch_extioi_common.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/intc/loongarch_extioi_common.c b/hw/intc/loongarch_extioi_common.c
index fd56253d10..e3a38b318a 100644
--- a/hw/intc/loongarch_extioi_common.c
+++ b/hw/intc/loongarch_extioi_common.c
@@ -16,7 +16,7 @@ static void loongarch_extioi_common_realize(DeviceState *dev, Error **errp)
     MachineState *machine = MACHINE(qdev_get_machine());
     MachineClass *mc = MACHINE_GET_CLASS(machine);
     const CPUArchIdList *id_list;
-    int i;
+    int i, pin;
 
     assert(mc->possible_cpu_arch_ids);
     id_list = mc->possible_cpu_arch_ids(machine);
@@ -30,6 +30,10 @@ static void loongarch_extioi_common_realize(DeviceState *dev, Error **errp)
     for (i = 0; i < s->num_cpu; i++) {
         s->cpu[i].arch_id = id_list->cpus[i].arch_id;
         s->cpu[i].cpu = CPU(id_list->cpus[i].cpu);
+
+        for (pin = 0; pin < LS3A_INTC_IP; pin++) {
+            qdev_init_gpio_out(dev, &s->cpu[i].parent_irq[pin], 1);
+        }
     }
 }