From: Francesco Valla <francesco@valla.it>
To: Simon Glass <sjg@chromium.org>
Cc: u-boot@lists.denx.de, Tom Rini <trini@konsulko.com>,
Quentin Schulz <quentin.schulz@cherry.de>,
Marek Vasut <marek.vasut+renesas@mailbox.org>,
James Hilliard <james.hilliard1@gmail.com>,
Julien Stephan <jstephan@baylibre.com>,
Frank Wunderlich <frank-w@public-files.de>,
Heinrich Schuchardt <xypron.glpk@gmx.de>,
Kunihiko Hayashi <hayashi.kunihiko@socionext.com>,
Anshul Dalal <anshuld@ti.com>,
Leo Yu-Chi Liang <ycliang@andestech.com>,
Andrew Goodbody <andrew.goodbody@linaro.org>,
Ronald Wahl <ronald.wahl@legrand.com>,
Dhruva Gole <d-gole@ti.com>,
Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>,
Rasmus Villemoes <ravi@prevas.dk>,
Michael Walle <mwalle@kernel.org>,
Marek Vasut <marek.vasut@mailbox.org>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Genoud <richard.genoud@bootlin.com>,
Wolfgang Wallner <wolfgang.wallner@at.abb.com>,
David Lechner <dlechner@baylibre.com>
Subject: Re: [PATCH 5/5] spl: fit: add ramdisk load
Date: Mon, 4 May 2026 19:47:10 +0200 [thread overview]
Message-ID: <afjZ4__QY137OrWF@bywater> (raw)
In-Reply-To: <CAFLszTh2CFomDvn4u6HAo_2mT+2GyvqHfo_y8-agOH-KoCvjPg@mail.gmail.com>
Hi Simon,
On Mon, May 04, 2026 at 06:09:31AM -0600, Simon Glass wrote:
> Hi Francesco,
>
> On 2026-04-28T20:24:41, Francesco Valla <francesco@valla.it> wrote:
> > spl: fit: add ramdisk load
> >
> > Add ramdisk loading logic to the 'full' SPL FIT loader, as well as the
> > corresponding FDT fixup. This is required for proper support of falcon
> > boot using FIT images, but is useless for a U-Boot launch, so make it
> > depend on SPL_OS_BOOT.
> >
> > Signed-off-by: Francesco Valla <francesco@valla.it>
> >
> > common/spl/spl.c | 17 ++++++++++++++---
> > common/spl/spl_fit.c | 18 ++++++++++++++++--
> > include/spl.h | 20 ++++++++++++++++++++
> > 3 files changed, 50 insertions(+), 5 deletions(-)
>
> > diff --git a/common/spl/spl.c b/common/spl/spl.c
> > @@ -172,6 +172,14 @@ void spl_fixup_fdt(void *fdt_blob)
> > return;
> > }
> > }
> > +
> > +#if IS_ENABLED(CONFIG_SPL_OS_BOOT)
> > + err = fdt_initrd(fdt_blob, initrd_start, initrd_end);
> > + if (err) {
> > + printf(PHASE_PROMPT "fdt_initrd err - %d\n", err);
> > + return;
> > + }
> > +#endif
> > #endif
> > }
>
> Please us 'if (IS_ENABLED(CONFIG_SPL_OS_BOOT))' - we try to avoid #if
> in C files for better build-coverage.
>
Ok.
> > diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> > @@ -1011,6 +1011,20 @@ int spl_load_fit_image(struct spl_image_info *spl_image,
> > }
> > }
> >
> > + if (spl_image->os != IH_OS_U_BOOT) {
> > +#ifdef CONFIG_SPL_FIT_SIGNATURE
> > + images.verify = 1;
> > +#endif
> > + ret = fit_image_load(&images, virt_to_phys((void *)header), NULL,
> > + &fit_uname_config, IH_ARCH_DEFAULT,
> > + IH_TYPE_RAMDISK, -1, FIT_LOAD_OPTIONAL,
> > + &rd_data, &rd_len);
> > + if (ret >= 0) {
> > + spl_image->ramdisk_addr = rd_data;
> > + spl_image->ramdisk_size = rd_len;
> > + }
> > + }
> > +
>
> There is no SPL_OS_BOOT guard here, so the ramdisk lookup is attempted
> for any non-U-Boot OS (ATF, OP-TEE, OpenSBI, Linux). Is that
> intentional? With FIT_LOAD_OPTIONAL it is harmless when no ramdisk
> node exists, but gating on CONFIG_IS_ENABLED(OS_BOOT) would match the
> consumer side in spl_fixup_fdt()
>
It _was_ intentional, since when I wrote initially this patch I was
experimenting with different options for the FIT image format (including
e.g. having TF-A instead of Linux marked as the OS).
But in the end a guard is probably a better option, I agree.
> > diff --git a/include/spl.h b/include/spl.h
> > @@ -288,6 +288,8 @@ struct spl_image_info {
> > ulong entry_point;
> > #if CONFIG_IS_ENABLED(LOAD_FIT) || CONFIG_IS_ENABLED(LOAD_FIT_FULL)
> > void *fdt_addr;
> > + ulong ramdisk_addr;
> > + ulong ramdisk_size;
> > #endif
>
> Only the LOAD_FIT_FULL path populates these (spl_load_simple_fit()
> does not load a ramdisk), so they could be gated on LOAD_FIT_FULL
> only. Please also add a kernel-doc comment to the new
> spl_image_ramdisk_start()/spl_image_ramdisk_end() helpers describing
> the units and what they return when the FIT loader is not enabled -
> 'end' in particular is ambiguous (inclusive vs exclusive), so please
> state that it is the exclusive end address expected by fdt_initrd().
>
Ok.
> Regards,
> Simon
Thank you!
Regards,
Francesco
next prev parent reply other threads:[~2026-05-04 17:47 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-28 20:24 [PATCH 0/5] Enhance the SPL FIT "full" loading logic Francesco Valla
2026-04-28 20:24 ` [PATCH 1/5] boot: fit: fix FIT verification in SPL Francesco Valla
2026-05-04 12:08 ` Simon Glass
2026-04-28 20:24 ` [PATCH 2/5] boot: fit: decompress kernel when " Francesco Valla
2026-05-04 12:08 ` Simon Glass
2026-05-04 17:34 ` Francesco Valla
2026-04-28 20:24 ` [PATCH 3/5] boot: fit: enable FIT image post-processing " Francesco Valla
2026-05-04 12:08 ` Simon Glass
2026-05-07 16:17 ` Quentin Schulz
2026-05-07 20:18 ` Francesco Valla
2026-04-28 20:24 ` [PATCH 4/5] spl: call ft_board_setup() and ft_system_setup() if enabled Francesco Valla
2026-05-04 12:09 ` Simon Glass
2026-05-04 17:39 ` Francesco Valla
2026-04-28 20:24 ` [PATCH 5/5] spl: fit: add ramdisk load Francesco Valla
2026-05-04 12:09 ` Simon Glass
2026-05-04 17:47 ` Francesco Valla [this message]
2026-05-04 12:07 ` [0/5] Enhance the SPL FIT "full" loading logic Simon Glass
2026-05-04 17:32 ` Francesco Valla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=afjZ4__QY137OrWF@bywater \
--to=francesco@valla.it \
--cc=andrew.goodbody@linaro.org \
--cc=anshuld@ti.com \
--cc=d-gole@ti.com \
--cc=dlechner@baylibre.com \
--cc=frank-w@public-files.de \
--cc=hayashi.kunihiko@socionext.com \
--cc=james.hilliard1@gmail.com \
--cc=jstephan@baylibre.com \
--cc=marek.vasut+renesas@mailbox.org \
--cc=marek.vasut@mailbox.org \
--cc=mikhail.kshevetskiy@iopsys.eu \
--cc=miquel.raynal@bootlin.com \
--cc=mwalle@kernel.org \
--cc=quentin.schulz@cherry.de \
--cc=ravi@prevas.dk \
--cc=richard.genoud@bootlin.com \
--cc=ronald.wahl@legrand.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=wolfgang.wallner@at.abb.com \
--cc=xypron.glpk@gmx.de \
--cc=ycliang@andestech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox