diff options
author | Song Gao <gaosong@loongson.cn> | 2023-04-06 14:57:27 +0800 |
---|---|---|
committer | Song Gao <gaosong@loongson.cn> | 2023-05-15 19:09:33 +0800 |
commit | 78464f023b5407c636239de43cef864d76098009 (patch) | |
tree | b8078b71ea9a4dd419d8b2baca8c9fd034e02fa7 /hw/loongarch | |
parent | 7318c62215ac1cf6b4d3c10b267e4cbc37a21f5a (diff) | |
download | qemu-78464f023b5407c636239de43cef864d76098009.zip qemu-78464f023b5407c636239de43cef864d76098009.tar.gz qemu-78464f023b5407c636239de43cef864d76098009.tar.bz2 |
hw/loongarch/virt: Modify ipi as percpu device
ipi is used to communicate between cpus, this patch modified
loongarch ipi device as percpu device, so that there are
2 MemoryRegions with ipi device, rather than 2*cpus
MemoryRegions, which may be large than QDEV_MAX_MMIO if
more cpus are added on loongarch virt machine.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Song Gao <gaosong@loongson.cn>
Message-Id: <20230512100421.1867848-2-gaosong@loongson.cn>
Diffstat (limited to 'hw/loongarch')
-rw-r--r-- | hw/loongarch/virt.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index f4bf14c..c8a01b1 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -565,9 +565,6 @@ static void loongarch_irq_init(LoongArchMachineState *lams) CPUState *cpu_state; int cpu, pin, i, start, num; - ipi = qdev_new(TYPE_LOONGARCH_IPI); - sysbus_realize_and_unref(SYS_BUS_DEVICE(ipi), &error_fatal); - extioi = qdev_new(TYPE_LOONGARCH_EXTIOI); sysbus_realize_and_unref(SYS_BUS_DEVICE(extioi), &error_fatal); @@ -598,15 +595,18 @@ static void loongarch_irq_init(LoongArchMachineState *lams) lacpu = LOONGARCH_CPU(cpu_state); env = &(lacpu->env); + ipi = qdev_new(TYPE_LOONGARCH_IPI); + sysbus_realize_and_unref(SYS_BUS_DEVICE(ipi), &error_fatal); + /* connect ipi irq to cpu irq */ - qdev_connect_gpio_out(ipi, cpu, qdev_get_gpio_in(cpudev, IRQ_IPI)); + qdev_connect_gpio_out(ipi, 0, qdev_get_gpio_in(cpudev, IRQ_IPI)); /* IPI iocsr memory region */ memory_region_add_subregion(&env->system_iocsr, SMP_IPI_MAILBOX, sysbus_mmio_get_region(SYS_BUS_DEVICE(ipi), - cpu * 2)); + 0)); memory_region_add_subregion(&env->system_iocsr, MAIL_SEND_ADDR, sysbus_mmio_get_region(SYS_BUS_DEVICE(ipi), - cpu * 2 + 1)); + 1)); /* extioi iocsr memory region */ memory_region_add_subregion(&env->system_iocsr, APIC_BASE, sysbus_mmio_get_region(SYS_BUS_DEVICE(extioi), |