U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Marek Vasut <marek.vasut+renesas@mailbox.org>
Cc: u-boot@lists.denx.de,
	"João Paulo Gonçalves" <joao.goncalves@toradex.com>,
	"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
	"Sam Protsenko" <semen.protsenko@linaro.org>,
	"Sughosh Ganu" <sughosh.ganu@linaro.org>
Subject: Re: [PATCH] boot: Warn users about fdt_high=~0 usage
Date: Thu, 13 Nov 2025 09:49:00 -0600	[thread overview]
Message-ID: <20251113154900.GJ6688@bill-the-cat> (raw)
In-Reply-To: <20251113142957.1069909-1-marek.vasut+renesas@mailbox.org>

[-- Attachment #1: Type: text/plain, Size: 2115 bytes --]

On Thu, Nov 13, 2025 at 03:29:51PM +0100, Marek Vasut wrote:

> In case the 'fdt_high' environment variable is set to ~0 and DT is
> at non-8-byte aligned offset, warn users about the dangers of the
> fdt_high usage. This will hopefully lead to removal of most of the
> fdt_high ~0 usage over time.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> ---
> Cc: "João Paulo Gonçalves" <joao.goncalves@toradex.com>
> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Cc: Sam Protsenko <semen.protsenko@linaro.org>
> Cc: Sughosh Ganu <sughosh.ganu@linaro.org>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: u-boot@lists.denx.de
> ---
>  boot/image-fdt.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/boot/image-fdt.c b/boot/image-fdt.c
> index 3f0ac54f76f..e88525a3846 100644
> --- a/boot/image-fdt.c
> +++ b/boot/image-fdt.c
> @@ -189,6 +189,10 @@ int boot_relocate_fdt(char **of_flat_tree, ulong *of_size)
>  			/* All ones means use fdt in place */
>  			of_start = fdt_blob;
>  			addr = map_to_sysmem(fdt_blob);
> +			if (addr & 7) {
> +				printf("WARNING: The 'fdt_high' environment variable is set to ~0 and DT is at non-8-byte aligned address.\nWARNING: This system will likely fail to boot. Unset 'fdt_high' environment variable and submit fix upstream.\n");
> +			}
> +
>  			err = lmb_alloc_mem(LMB_MEM_ALLOC_ADDR, 0, &addr,
>  					    of_len, LMB_NONE);
>  			if (err) {

I think we need to yell about it sooner. Today (and for quite some
years) if you pass a 4 byte and not 8 byte aligned DT to Linux, it fails
to boot or breaks in loud and odd ways. This has in turn lead to much
time spent and some of our older threads with the libfdt folks years
ago. So I think we need something earlier in code where we're seeing
that fdt_high is set to ~0 and that's where we say "Stop doing this, it
will be removed soon". Historically it was either used to work-around
problems that don't exist anymore, or as a misguided boot time
optimization (this is different from disabling initrd relocation, which
can be noticeable).

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2025-11-13 15:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-13 14:29 [PATCH] boot: Warn users about fdt_high=~0 usage Marek Vasut
2025-11-13 15:49 ` Tom Rini [this message]
2025-11-15 17:34   ` Marek Vasut
2025-11-16 14:09     ` Tom Rini
2025-11-16 21:43       ` Marek Vasut
2025-11-17 14:32         ` Tom Rini
2025-11-19 17:27           ` Marek Vasut

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=20251113154900.GJ6688@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=joao.goncalves@toradex.com \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=semen.protsenko@linaro.org \
    --cc=sughosh.ganu@linaro.org \
    --cc=u-boot@lists.denx.de \
    /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