@samitouri / QOSamiQemu / commits / 5af6d1308b

hw/riscv/sifive_u: add #address-cells in PLIC FDT

By Linux FDT docs in [1] the "address-cells" property is mandatory. Set it to zero. While we're at it let's also put this new value and the interrupt-cells value in macros, like the 'virt' board is doing. [1] https://www.kernel.org/doc/Documentation/devicetree/bindings/interrupt-controller/sifive%2Cplic-1.0.0.txt Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <20260616235939.1358663-4-daniel.barboza@oss.qualcomm.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

Daniel Henrique Barboza committed Jun 16, 2026 at 20:59 UTC 5af6d1308b29a6dd426158706b2b70ef5cdc8d9d
2 files changed +6 -1
hw/riscv/sifive_u.c
+4 -1
@@ -213,7 +213,10 @@ static void create_fdt(SiFiveUState *s, const MemMapEntry *memmap,
213 nodename = g_strdup_printf("/soc/interrupt-controller@%lx",
214 (long)memmap[SIFIVE_U_DEV_PLIC].base);
215 qemu_fdt_add_subnode(fdt, nodename);
216 - qemu_fdt_setprop_cell(fdt, nodename, "#interrupt-cells", 1);
216 + qemu_fdt_setprop_cell(fdt, nodename, "#interrupt-cells",
217 + SIFIVE_U_PLIC_INT_CELLS);
218 + qemu_fdt_setprop_cell(fdt, nodename, "#address-cells",
219 + SIFIVE_U_PLIC_ADDR_CELLS);
220 qemu_fdt_setprop_string_array(fdt, nodename, "compatible",
221 (char **)&plic_compat, ARRAY_SIZE(plic_compat));
222 qemu_fdt_setprop(fdt, nodename, "interrupt-controller", NULL, 0);
include/hw/riscv/sifive_u.h
+2
@@ -156,6 +156,8 @@ enum {
156 #define SIFIVE_U_MANAGEMENT_CPU_COUNT 1
157 #define SIFIVE_U_COMPUTE_CPU_COUNT 4
158
159 +#define SIFIVE_U_PLIC_ADDR_CELLS 0
160 +#define SIFIVE_U_PLIC_INT_CELLS 1
161 #define SIFIVE_U_PLIC_NUM_SOURCES 54
162 #define SIFIVE_U_PLIC_NUM_PRIORITIES 7
163 #define SIFIVE_U_PLIC_PRIORITY_BASE 0x00