@samitouri / QOSamiQemu / commits / 926a8b8e4f

hw/riscv/virt.c: fix 'iommu-map' FDT entry

Based on the DT documentation of 'iommu-map': https://www.kernel.org/doc/Documentation/devicetree/bindings/pci/pci-iommu.txt - iommu-map: Maps a Requester ID to an IOMMU and associated IOMMU specifier data. The property is an arbitrary number of tuples of (rid-base,iommu,iommu-base,length). Reviewed-by: Alistair Francis <alistair.francis@wdc.com> ---------- We're adding a no-op entry (length = 0) in iommu-map: qemu_fdt_setprop_cells(ms->fdt, name, "iommu-map", 0, iommu_sys_phandle, 0, 0, 0, iommu_sys_phandle, 0, 0xffff); This is easily seen in the generated DT: iommu-map = <0x00 0x8000 0x00 0x00 0x00 0x8000 0x00 0xffff>; The tuple (0 0 0x8000 0) does nothing since it has length = 0. The information we want to advertise is in the second tuple only. Thus remove the empty tuple. While we're at it, seems like we've mistaken the API and we're using 0xffff as 'last address', but in fact it is length. This means that we're telling the DT we're mapping 0x0 -> 0xfffe, which wasn't our intention. Therefore change size to '0x10000' to reflect the address mapping we want (0x0 -> 0xffff). Found while reviewing the RISC-V Server Platform DT generation, which happens to copy a lot of code from the 'virt' board, and this nit is also present there. Fixes: 2c12de1460 ("hw/riscv/virt: Add IOMMU as platform device if the option is set") Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com> Message-ID: <20260608210642.464131-1-daniel.barboza@oss.qualcomm.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

Daniel Henrique Barboza committed Jun 8, 2026 at 18:06 UTC 926a8b8e4f11a1b1955f5f46c89069614ea28156
1 file changed +1 -2
hw/riscv/virt.c
+1 -2
@@ -900,8 +900,7 @@ static void create_fdt_pcie(RISCVVirtState *s,
900
901 if (virt_is_iommu_sys_enabled(s)) {
902 qemu_fdt_setprop_cells(ms->fdt, name, "iommu-map",
903 - 0, iommu_sys_phandle, 0, 0, 0,
904 - iommu_sys_phandle, 0, 0xffff);
903 + 0, iommu_sys_phandle, 0, 0x10000);
904 }
905
906 create_pcie_irq_map(s, ms->fdt, name, irq_pcie_phandle);