From: Daniel Henrique Barboza <[email protected]> Running 'dtc' to generate a readable fdt for the virt machine produce warnings:
$ dtc -I dtb -O dts virt.dtb > virt.dts <stdout>: Warning (simple_bus_reg): /soc/mtimer@2000000: simple-bus unit address format error, expected "2007ff8" <stdout>: Warning (simple_bus_reg): /soc/mtimer@2008000: simple-bus unit address format error, expected "200fff8" This happens because the 'reg' field does not match the address in the nodename. The right fix, pointed out by Chao in [1], is to make the nodename match the reg value: "In the current QEMU implement, `addr` is the MTIMECMP base address, while the MTIME register is located at addr + RISCV_ACLINT_DEFAULT_MTIME." In other words, the 'reg' value is correct but the nodename isn't. We'll make the fix now, allowing the next patch to move the fixed version of aclint FDT to fdt-common. [1] https://lore.kernel.org/qemu-devel/[email protected]/ Cc: [email protected] Suggested-by: Chao Liu <[email protected]> Fixes: 954886ea6d ("hw/riscv: virt: Add optional ACLINT support to virt machine") Signed-off-by: Daniel Henrique Barboza <[email protected]> Acked-by: Alistair Francis <[email protected]> Reviewed-by: Chao Liu <[email protected]> Message-ID: <[email protected]> Signed-off-by: Alistair Francis <[email protected]> (cherry picked from commit 9d6ac47d3182f2bdadea4bed596c82759a167e67) (Mjt: drop format string change (it was corrected in subsequent change), but keep the value change) Signed-off-by: Michael Tokarev <[email protected]> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index e517002fdfc..fc44c8480c2 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -405,7 +405,8 @@ static void create_fdt_socket_aclint(RISCVVirtState *s, (memmap[VIRT_CLINT].size * socket); size = memmap[VIRT_CLINT].size - RISCV_ACLINT_SWI_SIZE; } - name = g_strdup_printf("/soc/mtimer@%lx", addr); + name = g_strdup_printf("/soc/mtimer@%lx", + addr + RISCV_ACLINT_DEFAULT_MTIME); qemu_fdt_add_subnode(ms->fdt, name); qemu_fdt_setprop_string(ms->fdt, name, "compatible", "riscv,aclint-mtimer"); -- 2.47.3
