[PATCH v2 1/4] qemu: overlay signature nodes

Simon Glass sjg at chromium.org
Thu May 7 17:33:10 CEST 2026


+Patrick Rudolph

Hi Ludwig,

On Wed, 6 May 2026 at 09:29, Ludwig Nussel <ludwig.nussel at siemens.com> wrote:
>
> On 5/4/26 14:26, Simon Glass wrote:
> > On 2026-04-30T12:25:59, Ludwig Nussel <ludwig.nussel at siemens.com> wrote:
> >> qemu: overlay signature nodes
> >> [...]
> >> diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
> >> @@ -147,7 +147,38 @@ int dram_init_banksize(void)
> >>   int board_fdt_blob_setup(void **fdtp)
> >>   {
> >>        /* QEMU loads a generated DTB for us at the start of RAM. */
> >> -     *fdtp = (void *)CFG_SYS_SDRAM_BASE;
> >> +     void *qemu_fdt = (void *)CFG_SYS_SDRAM_BASE;
> >> +     int ret;
> >> +
> >> +     if (!*fdtp)
> >> +             goto out;
> >
> > This runs the opposite direction to qemu-sbsa, which uses the U-Boot
> > DT as the base and overlays the QEMU DT onto it (see
> > fdtdec_board_setup() in board/emulation/qemu-sbsa/qemu-sbsa.c). Done
> > this way, any node in U-Boot's built-in DT that shares a name with a
> > QEMU node (/cpus, /memory, /chosen, ...) will have its properties
> > merged into QEMU's, potentially clobbering the hardware description.
> > If this is correct, please explain in the commit message why the merge
> > runs in this direction.
>
> IIUC the FDT patching happens before relocation. QEMU starts u-boot from
> a ROM at address 0 so writing to the embedded DT does not work. QEMU's
> provided DT is at a writable RAM location so patching that one works.
>
> I don't know which direction makes more sense really. If you say merging
> QEMU's DT into U-Boot's is better then board_fix_fdt() could be used for
> the merging I guess. Looks like that could work with
> CONFIG_OF_INITIAL_DTB_READONLY and CONFIG_OF_BOARD_FIXUP set.

Hmmm now I am wondering how this actually works with sbsa. As you
point out it's hard to see how the fdtdec_board_setup() works before
relocation...I don't have the energy to dig into it, though.

The whole this is quite messy due to QEMU's assuming that firmware
does not care about the DT. Since this approach seems to work we can
always revisit it later if problems come up.

So how about you tidy up the other things and add my:

Reviewed-by: Simon Glass <sjg at chromium.org>

Regards,
Simon


More information about the U-Boot mailing list