* [PATCH 0/2] hw/intc/loongson_ipi: Fix for LoongArch @ 2024-06-27 4:13 Jiaxun Yang 2024-06-27 4:13 ` [PATCH 1/2] hw/intc/loongson_ipi: Gate MMIO regions creation with property Jiaxun Yang ` (2 more replies) 0 siblings, 3 replies; 8+ messages in thread From: Jiaxun Yang @ 2024-06-27 4:13 UTC (permalink / raw) To: qemu-devel Cc: Huacai Chen, Song Gao, Philippe Mathieu-Daudé, Jiaxun Yang, maobibo Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- Jiaxun Yang (2): hw/intc/loongson_ipi: Gate MMIO regions creation with property MAINTAINERS: Add myself as a reviewer of LoongArch virt machine MAINTAINERS | 1 + hw/intc/loongson_ipi.c | 23 ++++++++++++++--------- hw/mips/loongson3_virt.c | 1 + include/hw/intc/loongson_ipi.h | 1 + 4 files changed, 17 insertions(+), 9 deletions(-) --- base-commit: 3f044554b94fc0756d5b3cdbf84501e0eea0e629 change-id: 20240627-ipi-fixes-13eaf1b8815a Best regards, -- Jiaxun Yang <jiaxun.yang@flygoat.com> ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] hw/intc/loongson_ipi: Gate MMIO regions creation with property 2024-06-27 4:13 [PATCH 0/2] hw/intc/loongson_ipi: Fix for LoongArch Jiaxun Yang @ 2024-06-27 4:13 ` Jiaxun Yang 2024-06-27 4:13 ` [PATCH 2/2] MAINTAINERS: Add myself as a reviewer of LoongArch virt machine Jiaxun Yang 2024-06-27 6:38 ` [PATCH 0/2] hw/intc/loongson_ipi: Fix for LoongArch Philippe Mathieu-Daudé 2 siblings, 0 replies; 8+ messages in thread From: Jiaxun Yang @ 2024-06-27 4:13 UTC (permalink / raw) To: qemu-devel Cc: Huacai Chen, Song Gao, Philippe Mathieu-Daudé, Jiaxun Yang, maobibo Commit 49eba52a52fe ("hw/intc/loongson_ipi: Provide per core MMIO address spaces") implemented per core MMIO spaces for IPI registers. However on LoongArch system emulation with high core count it may exhaust QDEV_MAX_MMIO and trigger assertion. Given that MMIO region is unused for LoongArch system emulation (we do have it on hardware but kernel is in favor of IOCSR), gate MMIO regions creation with "has-mmio" property and only set if for loongson3-virt machine to avoid such limitation on LoongArch. Reported-by: maobibo <maobibo@loongson.cn> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- hw/intc/loongson_ipi.c | 23 ++++++++++++++--------- hw/mips/loongson3_virt.c | 1 + include/hw/intc/loongson_ipi.h | 1 + 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/hw/intc/loongson_ipi.c b/hw/intc/loongson_ipi.c index e6a7142480c6..6e92a503499a 100644 --- a/hw/intc/loongson_ipi.c +++ b/hw/intc/loongson_ipi.c @@ -305,15 +305,19 @@ static void loongson_ipi_realize(DeviceState *dev, Error **errp) return; } - for (i = 0; i < s->num_cpu; i++) { - s->cpu[i].ipi = s; - s->cpu[i].ipi_mmio_mem = g_new0(MemoryRegion, 1); - g_autofree char *name = g_strdup_printf("loongson_ipi_cpu%d_mmio", i); - memory_region_init_io(s->cpu[i].ipi_mmio_mem, OBJECT(dev), - &loongson_ipi_core_ops, &s->cpu[i], name, 0x48); - sysbus_init_mmio(sbd, s->cpu[i].ipi_mmio_mem); - - qdev_init_gpio_out(dev, &s->cpu[i].irq, 1); + if (s->has_mmio) { + for (i = 0; i < s->num_cpu; i++) { + s->cpu[i].ipi = s; + s->cpu[i].ipi_mmio_mem = g_new0(MemoryRegion, 1); + g_autofree char *name = + g_strdup_printf("loongson_ipi_cpu%d_mmio", i); + memory_region_init_io(s->cpu[i].ipi_mmio_mem, OBJECT(dev), + &loongson_ipi_core_ops, &s->cpu[i], + name, 0x48); + sysbus_init_mmio(sbd, s->cpu[i].ipi_mmio_mem); + + qdev_init_gpio_out(dev, &s->cpu[i].irq, 1); + } } } @@ -344,6 +348,7 @@ static const VMStateDescription vmstate_loongson_ipi = { static Property ipi_properties[] = { DEFINE_PROP_UINT32("num-cpu", LoongsonIPI, num_cpu, 1), + DEFINE_PROP_BOOL("has-mmio", LoongsonIPI, has_mmio, false), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c index 4ad36f0c5b64..a27b30ab318c 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -537,6 +537,7 @@ static void mips_loongson3_virt_init(MachineState *machine) if (!kvm_enabled()) { ipi = qdev_new(TYPE_LOONGSON_IPI); qdev_prop_set_uint32(ipi, "num-cpu", machine->smp.cpus); + qdev_prop_set_bit(ipi, "has-mmio", true); sysbus_realize_and_unref(SYS_BUS_DEVICE(ipi), &error_fatal); memory_region_add_subregion(iocsr, SMP_IPI_MAILBOX, sysbus_mmio_get_region(SYS_BUS_DEVICE(ipi), 0)); diff --git a/include/hw/intc/loongson_ipi.h b/include/hw/intc/loongson_ipi.h index 3f795edbf3cd..0e35674e7aaf 100644 --- a/include/hw/intc/loongson_ipi.h +++ b/include/hw/intc/loongson_ipi.h @@ -50,6 +50,7 @@ struct LoongsonIPI { MemoryRegion ipi_iocsr_mem; MemoryRegion ipi64_iocsr_mem; uint32_t num_cpu; + bool has_mmio; IPICore *cpu; }; -- 2.43.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] MAINTAINERS: Add myself as a reviewer of LoongArch virt machine 2024-06-27 4:13 [PATCH 0/2] hw/intc/loongson_ipi: Fix for LoongArch Jiaxun Yang 2024-06-27 4:13 ` [PATCH 1/2] hw/intc/loongson_ipi: Gate MMIO regions creation with property Jiaxun Yang @ 2024-06-27 4:13 ` Jiaxun Yang 2024-07-11 3:41 ` gaosong 2024-06-27 6:38 ` [PATCH 0/2] hw/intc/loongson_ipi: Fix for LoongArch Philippe Mathieu-Daudé 2 siblings, 1 reply; 8+ messages in thread From: Jiaxun Yang @ 2024-06-27 4:13 UTC (permalink / raw) To: qemu-devel Cc: Huacai Chen, Song Gao, Philippe Mathieu-Daudé, Jiaxun Yang I would like to be informed on changes made to the LoongArch virt machine. I'm fairly familiar with Loongson-3 series platform hardware and doing firmwre (U-Boot) development as hobbyist on LoongArch virt platform, so I believe I can give positive review input to changes on that machine. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 19f67dc5d215..9a646ea58483 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1239,6 +1239,7 @@ LoongArch Machines ------------------ Virt M: Song Gao <gaosong@loongson.cn> +R: Jiaxun Yang <jiaxun.yang@flygoat.com> S: Maintained F: docs/system/loongarch/virt.rst F: configs/targets/loongarch64-softmmu.mak -- 2.43.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] MAINTAINERS: Add myself as a reviewer of LoongArch virt machine 2024-06-27 4:13 ` [PATCH 2/2] MAINTAINERS: Add myself as a reviewer of LoongArch virt machine Jiaxun Yang @ 2024-07-11 3:41 ` gaosong 0 siblings, 0 replies; 8+ messages in thread From: gaosong @ 2024-07-11 3:41 UTC (permalink / raw) To: Jiaxun Yang, qemu-devel; +Cc: Huacai Chen, Philippe Mathieu-Daudé 在 2024/6/27 下午12:13, Jiaxun Yang 写道: > I would like to be informed on changes made to the LoongArch virt machine. > > I'm fairly familiar with Loongson-3 series platform hardware and doing > firmwre (U-Boot) development as hobbyist on LoongArch virt platform, > so I believe I can give positive review input to changes on that machine. > > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> > --- Reviewed-by: Song Gao <gaosong@loongson.cn> Thanks. Song Gao > MAINTAINERS | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/MAINTAINERS b/MAINTAINERS > index 19f67dc5d215..9a646ea58483 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -1239,6 +1239,7 @@ LoongArch Machines > ------------------ > Virt > M: Song Gao <gaosong@loongson.cn> > +R: Jiaxun Yang <jiaxun.yang@flygoat.com> > S: Maintained > F: docs/system/loongarch/virt.rst > F: configs/targets/loongarch64-softmmu.mak > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] hw/intc/loongson_ipi: Fix for LoongArch 2024-06-27 4:13 [PATCH 0/2] hw/intc/loongson_ipi: Fix for LoongArch Jiaxun Yang 2024-06-27 4:13 ` [PATCH 1/2] hw/intc/loongson_ipi: Gate MMIO regions creation with property Jiaxun Yang 2024-06-27 4:13 ` [PATCH 2/2] MAINTAINERS: Add myself as a reviewer of LoongArch virt machine Jiaxun Yang @ 2024-06-27 6:38 ` Philippe Mathieu-Daudé 2024-06-27 12:13 ` gaosong 2 siblings, 1 reply; 8+ messages in thread From: Philippe Mathieu-Daudé @ 2024-06-27 6:38 UTC (permalink / raw) To: Jiaxun Yang, qemu-devel; +Cc: Huacai Chen, Song Gao, maobibo On 27/6/24 06:13, Jiaxun Yang wrote: > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> > --- > Jiaxun Yang (2): > hw/intc/loongson_ipi: Gate MMIO regions creation with property > MAINTAINERS: Add myself as a reviewer of LoongArch virt machine Maybe s/has-mmio/use-mmio/? Otherwise series: Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] hw/intc/loongson_ipi: Fix for LoongArch 2024-06-27 6:38 ` [PATCH 0/2] hw/intc/loongson_ipi: Fix for LoongArch Philippe Mathieu-Daudé @ 2024-06-27 12:13 ` gaosong 2024-06-27 12:55 ` Philippe Mathieu-Daudé 2024-06-27 15:12 ` Jiaxun Yang 0 siblings, 2 replies; 8+ messages in thread From: gaosong @ 2024-06-27 12:13 UTC (permalink / raw) To: Philippe Mathieu-Daudé, Jiaxun Yang, qemu-devel Cc: Huacai Chen, maobibo, Richard Henderson, Peter Maydell, Paolo Bonzini, Alex Bennée 在 2024/6/27 下午2:38, Philippe Mathieu-Daudé 写道: > On 27/6/24 06:13, Jiaxun Yang wrote: >> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> >> --- >> Jiaxun Yang (2): >> hw/intc/loongson_ipi: Gate MMIO regions creation with property >> MAINTAINERS: Add myself as a reviewer of LoongArch virt machine > > Maybe s/has-mmio/use-mmio/? Otherwise series: > Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> > Hi, If we had done a simple test, we should have found the following problem, but obviously we didn't . root@loongson-KVM:~/work/code/clean/github/qemu# . /kernel.sh Unexpected error in object_property_find_err() at . /qom/object.c:1357. qemu-system-loongarch64: Property 'loongson_ipi.unnamed-gpio-out[0]' not found . /kernel.sh: line 16: 117708 Aborted (core dumped) . /build/qemu-system-loongarch64 -machine virt -m 8G -cpu la464 -smp 8 -kernel ~/vmlinux -initrd ramdisk -serial stdio -monitor telnet:localhost. 4418,server,nowait -net nic -net user -device virtio-gpu-pci -device nec-usb-xhci,id=xhci,addr=0x1b -device usb-tablet,id=tablet,bus=xhci.0, port=1 -device usb-tablet,id=tablet,bus=xhci.0, -device usb-tablet,id=tablet,bus=xhci. port=1 -device usb-kbd,id=keyboard,bus=xhci.0,port=2 -append "root=/dev/ram rdinit=/sbin/init console=ttyS0,115200 earlycon=uart,mmio. 0x1fe001e0" --nographic So to minimize interactions with the MIPS architecture, I'll submit a patch to restore loongarch_ipi for LoongArch. Thanks. Song Gao ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] hw/intc/loongson_ipi: Fix for LoongArch 2024-06-27 12:13 ` gaosong @ 2024-06-27 12:55 ` Philippe Mathieu-Daudé 2024-06-27 15:12 ` Jiaxun Yang 1 sibling, 0 replies; 8+ messages in thread From: Philippe Mathieu-Daudé @ 2024-06-27 12:55 UTC (permalink / raw) To: gaosong, Jiaxun Yang, qemu-devel Cc: Huacai Chen, maobibo, Richard Henderson, Peter Maydell, Paolo Bonzini, Alex Bennée On 27/6/24 14:13, gaosong wrote: > > > 在 2024/6/27 下午2:38, Philippe Mathieu-Daudé 写道: >> On 27/6/24 06:13, Jiaxun Yang wrote: >>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> >>> --- >>> Jiaxun Yang (2): >>> hw/intc/loongson_ipi: Gate MMIO regions creation with property >>> MAINTAINERS: Add myself as a reviewer of LoongArch virt machine >> >> Maybe s/has-mmio/use-mmio/? Otherwise series: >> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> >> > Hi, > > If we had done a simple test, we should have found the following > problem, but obviously we didn't . > > root@loongson-KVM:~/work/code/clean/github/qemu# . /kernel.sh > Unexpected error in object_property_find_err() at . /qom/object.c:1357. > qemu-system-loongarch64: Property 'loongson_ipi.unnamed-gpio-out[0]' not > found > . /kernel.sh: line 16: 117708 Aborted (core dumped) . > /build/qemu-system-loongarch64 -machine virt -m 8G -cpu la464 -smp 8 > -kernel ~/vmlinux -initrd ramdisk -serial stdio -monitor > telnet:localhost. 4418,server,nowait -net nic -net user -device > virtio-gpu-pci -device nec-usb-xhci,id=xhci,addr=0x1b -device > usb-tablet,id=tablet,bus=xhci.0, port=1 -device > usb-tablet,id=tablet,bus=xhci.0, -device usb-tablet,id=tablet,bus=xhci. > port=1 -device usb-kbd,id=keyboard,bus=xhci.0,port=2 -append > "root=/dev/ram rdinit=/sbin/init console=ttyS0,115200 > earlycon=uart,mmio. 0x1fe001e0" --nographic Works for me squashing: -- >8 -- diff --git a/hw/intc/loongson_ipi.c b/hw/intc/loongson_ipi.c index 6e92a50349..ce845aecda 100644 --- a/hw/intc/loongson_ipi.c +++ b/hw/intc/loongson_ipi.c @@ -305,18 +305,18 @@ static void loongson_ipi_realize(DeviceState *dev, Error **errp) return; } - if (s->has_mmio) { - for (i = 0; i < s->num_cpu; i++) { - s->cpu[i].ipi = s; + for (i = 0; i < s->num_cpu; i++) { + s->cpu[i].ipi = s; + qdev_init_gpio_out(dev, &s->cpu[i].irq, 1); + + if (s->has_mmio) { + g_autofree char *name = g_strdup_printf("loongson_ipi_cpu%d_mmio", i); s->cpu[i].ipi_mmio_mem = g_new0(MemoryRegion, 1); - g_autofree char *name = - g_strdup_printf("loongson_ipi_cpu%d_mmio", i); memory_region_init_io(s->cpu[i].ipi_mmio_mem, OBJECT(dev), &loongson_ipi_core_ops, &s->cpu[i], name, 0x48); sysbus_init_mmio(sbd, s->cpu[i].ipi_mmio_mem); - qdev_init_gpio_out(dev, &s->cpu[i].irq, 1); } } } --- ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] hw/intc/loongson_ipi: Fix for LoongArch 2024-06-27 12:13 ` gaosong 2024-06-27 12:55 ` Philippe Mathieu-Daudé @ 2024-06-27 15:12 ` Jiaxun Yang 1 sibling, 0 replies; 8+ messages in thread From: Jiaxun Yang @ 2024-06-27 15:12 UTC (permalink / raw) To: gaosong, Philippe Mathieu-Daudé, QEMU devel Cc: Huacai Chen, Bibo Mao, Richard Henderson, Peter Maydell, Paolo Bonzini, Alex Bennée 在2024年6月27日六月 下午4:13,gaosong写道: > 在 2024/6/27 下午2:38, Philippe Mathieu-Daudé 写道: >> On 27/6/24 06:13, Jiaxun Yang wrote: >>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> >>> --- >>> Jiaxun Yang (2): >>> hw/intc/loongson_ipi: Gate MMIO regions creation with property >>> MAINTAINERS: Add myself as a reviewer of LoongArch virt machine >> >> Maybe s/has-mmio/use-mmio/? Otherwise series: >> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> >> > Hi, > > If we had done a simple test, we should have found the following > problem, but obviously we didn't . My bad, I’m currently traveling and sent that in rush. I do boot tested with CI and I trust CI can catch those issues. > > root@loongson-KVM:~/work/code/clean/github/qemu# . /kernel.sh > Unexpected error in object_property_find_err() at . /qom/object.c:1357. > qemu-system-loongarch64: Property 'loongson_ipi.unnamed-gpio-out[0]' not > found > . /kernel.sh: line 16: 117708 Aborted (core dumped) . > /build/qemu-system-loongarch64 -machine virt -m 8G -cpu la464 -smp 8 > -kernel ~/vmlinux -initrd ramdisk -serial stdio -monitor > telnet:localhost. 4418,server,nowait -net nic -net user -device > virtio-gpu-pci -device nec-usb-xhci,id=xhci,addr=0x1b -device > usb-tablet,id=tablet,bus=xhci.0, port=1 -device > usb-tablet,id=tablet,bus=xhci.0, -device usb-tablet,id=tablet,bus=xhci. > port=1 -device usb-kbd,id=keyboard,bus=xhci.0,port=2 -append > "root=/dev/ram rdinit=/sbin/init console=ttyS0,115200 > earlycon=uart,mmio. 0x1fe001e0" --nographic > > > So to minimize interactions with the MIPS architecture, I'll submit a > patch to restore loongarch_ipi for LoongArch. > > Thanks. > Song Gao -- - Jiaxun ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-07-11 3:42 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-06-27 4:13 [PATCH 0/2] hw/intc/loongson_ipi: Fix for LoongArch Jiaxun Yang 2024-06-27 4:13 ` [PATCH 1/2] hw/intc/loongson_ipi: Gate MMIO regions creation with property Jiaxun Yang 2024-06-27 4:13 ` [PATCH 2/2] MAINTAINERS: Add myself as a reviewer of LoongArch virt machine Jiaxun Yang 2024-07-11 3:41 ` gaosong 2024-06-27 6:38 ` [PATCH 0/2] hw/intc/loongson_ipi: Fix for LoongArch Philippe Mathieu-Daudé 2024-06-27 12:13 ` gaosong 2024-06-27 12:55 ` Philippe Mathieu-Daudé 2024-06-27 15:12 ` Jiaxun Yang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).