[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/4] hw/intc/loongarch_extioi: Use cpu plug notification
From: |
Bibo Mao |
Subject: |
[PATCH 4/4] hw/intc/loongarch_extioi: Use cpu plug notification |
Date: |
Fri, 10 Jan 2025 17:04:36 +0800 |
Use hotplug_handler_plug() to nofity extioi object when cold-plug
cpu is created, so that extioi can set and configure irq routing
to new cpu.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
hw/loongarch/virt.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index df56d75a6e..4006cabdc5 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -850,7 +850,8 @@ static void virt_irq_init(LoongArchVirtMachineState *lvms)
LoongArchCPU *lacpu;
CPULoongArchState *env;
CPUState *cpu_state;
- int cpu, pin, i, start, num;
+ int cpu, i, start, num;
+ Error *local_err = NULL;
/*
* Extended IRQ model.
@@ -932,16 +933,9 @@ static void virt_irq_init(LoongArchVirtMachineState *lvms)
sysbus_mmio_get_region(SYS_BUS_DEVICE(extioi), 1));
}
- /*
- * connect ext irq to the cpu irq
- * cpu_pin[9:2] <= intc_pin[7:0]
- */
for (cpu = 0; cpu < ms->smp.cpus; cpu++) {
cpudev = DEVICE(qemu_get_cpu(cpu));
- for (pin = 0; pin < LS3A_INTC_IP; pin++) {
- qdev_connect_gpio_out(extioi, (cpu * 8 + pin),
- qdev_get_gpio_in(cpudev, pin + 2));
- }
+ hotplug_handler_plug(HOTPLUG_HANDLER(extioi), cpudev, &local_err);
}
pch_pic = qdev_new(TYPE_LOONGARCH_PIC);
--
2.39.3