[PATCH 0/2] hw/intc/loongson_ipi: Fix for LoongArch

Jiaxun Yang posted 2 patches 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240627-ipi-fixes-v1-0-9b061dc28a3a@flygoat.com
Maintainers: Song Gao <gaosong@loongson.cn>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Huacai Chen <chenhuacai@kernel.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>
There is a newer version of this series
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(-)
[PATCH 0/2] hw/intc/loongson_ipi: Fix for LoongArch
Posted by Jiaxun Yang 5 months ago
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>
Re: [PATCH 0/2] hw/intc/loongson_ipi: Fix for LoongArch
Posted by Philippe Mathieu-Daudé 5 months ago
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>



Re: [PATCH 0/2] hw/intc/loongson_ipi: Fix for LoongArch
Posted by gaosong 5 months ago

在 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


Re: [PATCH 0/2] hw/intc/loongson_ipi: Fix for LoongArch
Posted by Jiaxun Yang 5 months ago

在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
Re: [PATCH 0/2] hw/intc/loongson_ipi: Fix for LoongArch
Posted by Philippe Mathieu-Daudé 5 months ago
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);
          }
      }
  }
---