diff mbox series

[1/2] hw/arm/virt: Fix incorrect non-secure flash dtb node name

Message ID 20220513131316.4081539-2-peter.maydell@linaro.org
State New
Headers show
Series hw/arm/virt: fix dtb nits spotted by dtc | expand

Commit Message

Peter Maydell May 13, 2022, 1:13 p.m. UTC
In the virt board with secure=on we put two nodes in the dtb
for flash devices: one for the secure-only flash, and one
for the non-secure flash. We get the reg properties for these
correct, but in the DT node name, which by convention includes
the base address of devices, we used the wrong address. Fix it.

Spotted by dtc, which will complain
Warning (unique_unit_address): /flash@0: duplicate unit-address (also used in node /secflash@0)
if you dump the dtb from QEMU with -machine dumpdtb=file.dtb
and then decompile it with dtc.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/arm/virt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Henderson May 13, 2022, 3:35 p.m. UTC | #1
On 5/13/22 06:13, Peter Maydell wrote:
> In the virt board with secure=on we put two nodes in the dtb
> for flash devices: one for the secure-only flash, and one
> for the non-secure flash. We get the reg properties for these
> correct, but in the DT node name, which by convention includes
> the base address of devices, we used the wrong address. Fix it.
> 
> Spotted by dtc, which will complain
> Warning (unique_unit_address): /flash@0: duplicate unit-address (also used in node /secflash@0)
> if you dump the dtb from QEMU with -machine dumpdtb=file.dtb
> and then decompile it with dtc.
> 
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---
>   hw/arm/virt.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~
diff mbox series

Patch

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 1a45f44435e..587e885a98c 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1195,7 +1195,7 @@  static void virt_flash_fdt(VirtMachineState *vms,
         qemu_fdt_setprop_string(ms->fdt, nodename, "secure-status", "okay");
         g_free(nodename);
 
-        nodename = g_strdup_printf("/flash@%" PRIx64, flashbase);
+        nodename = g_strdup_printf("/flash@%" PRIx64, flashbase + flashsize);
         qemu_fdt_add_subnode(ms->fdt, nodename);
         qemu_fdt_setprop_string(ms->fdt, nodename, "compatible", "cfi-flash");
         qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg",