From: Emanuele Ghidoli <ghidoliemanuele@gmail.com>
To: "Joseph Guo (OSS)" <qijian.guo@oss.nxp.com>,
Jonas Karlman <jonas@kwiboo.se>, Joseph Guo <qijian.guo@nxp.com>
Cc: Randolph Sapp <rs@ti.com>, Simon Glass <sjg@chromium.org>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
"u-boot@lists.denx.de" <u-boot@lists.denx.de>,
Tom Rini <trini@konsulko.com>, Anshul Dalal <anshuld@ti.com>,
Marek Vasut <marek.vasut+renesas@mailbox.org>
Subject: Re: [PATCH] boot: image-fdt: downgrade -EINVAL reservation failure to debug
Date: Fri, 17 Jul 2026 14:00:18 +0200 [thread overview]
Message-ID: <df4a4fb2-643c-4d6a-a8de-edf15a375928@gmail.com> (raw)
In-Reply-To: <7e290ff6-0e97-4c9e-b82b-7425904efb8a@oss.nxp.com>
On 7/17/26 07:18, Joseph Guo (OSS) wrote:
> On 7/16/2026 7:55 PM, Jonas Karlman wrote:
>> [You don't often get email from jonas@kwiboo.se. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>>
>> Hi Joseph and Emanuele,
>>
>> On 7/16/2026 10:25 AM, Emanuele Ghidoli wrote:
>>>
>>>
>>> On 7/13/26 10:45, Joseph Guo wrote:
>>>> When boot_fdt_handle_region() attempts to reserve a DTS reserved-memory
>>>> region via lmb_alloc_mem(), it may receive -EINVAL if the region's
>>>> physical address falls outside the LMB-managed memory range (i.e.
>>>> below PHYS_SDRAM on platforms where U-Boot does not manage the lower
>>>> DRAM window).
>>>>
>>>> A typical example is platforms like i.MX95 where PHYS_SDRAM starts at
>>>> 0x90000000, but remoteproc/rpmsg carveouts (vdev vrings, vdev buffer,
>>>> resource table) are placed at 0x88xxxxxx by hardware convention. Those
>>>> addresses are unreachable by U-Boot's allocator anyway, so failing to
>>>> mark them reserved has no practical consequence -- U-Boot will never
>>>> accidentally place the initrd or FDT blob there.
>>>>
>>>> Printing ERROR for a condition that is harmless and expected on many
>>>> platforms is misleading. Downgrade the -EINVAL case to debug() to
>>>> suppress the spurious output while preserving full visibility under
>>>> DEBUG/log builds.
>>>>
>>>> Real failures (e.g. -EEXIST from an overlapping reservation) continue
>>>> to be reported as ERROR.
>>
>> I sent a similar patch 2-3 weeks ago [1], and was planning to send a v2
>> that also change lmb_free() to return -EINVAL to also catch the free
>> scenario.
>>
>> [1] https://patch.msgid.link/20260627204851.1151419-1-jonas@kwiboo.se/
>>
>> Regards,
>> Jonas
>>
>
> Hi Jonas,
>
> Thanks for your information. This patch can be dropped in that case.
>
> Regards,
> Joseph>>>
Hi Jonas,
I agree with Joseph.
Can you please add me in Cc to the v2?
Thanks and regards,
Emanuele
>>>> Fixes: 623f6c5b6ab7 ("boot: image-fdt: free old dtb reservations")
>>>> Signed-off-by: Joseph Guo <qijian.guo@nxp.com>
>>>> ---
>>>> boot/image-fdt.c | 3 +++
>>>> 1 file changed, 3 insertions(+)
>>>>
>>>> diff --git a/boot/image-fdt.c b/boot/image-fdt.c
>>>> index 9e0e0f93edd34ae9056926883b1a802858e179d9..2175fa338f55110862100fa9f491a0957e85ce56 100644
>>>> --- a/boot/image-fdt.c
>>>> +++ b/boot/image-fdt.c
>>>> @@ -95,6 +95,9 @@ static void boot_fdt_handle_region(u64 addr, u64 size, u32 flags, bool free)
>>>> debug(" %s fdt memory region: addr=%llx size=%llx flags=%x\n",
>>>> free ? "freed" : "reserved", (unsigned long long)addr,
>>>> (unsigned long long)size, flags);
>>>> + } else if (ret == -EINVAL) {
>>>> + debug(" skipping fdt memory region outside LMB range (addr=%llx size=%llx flags=%x)\n",
>>>> + (unsigned long long)addr, (unsigned long long)size, flags);
>>>> } else {
>>>> printf("ERROR: %s fdt memory region failed (addr=%llx size=%llx flags=%x): %ld\n",
>>>> free ? "freeing" : "reserving", (unsigned long long)addr,
>>>>
>>>> ---
>>>> base-commit: 6741b0dfb41dc82a284ab1cff4c58af6ef2f3f9c
>>>> change-id: 20260713-downgrade-f8319ab2d75b
>>>>
>>>> Best regards,
>>>
>>> Hi Joseph,
>>>
>>> Tested on Toradex Aquila iMX95, which has reserved-memory regions for
>>> the Cortex-M7 (vrings, vdev buffer, resource table) below PHYS_SDRAM.
>>> The spurious ERROR messages are gone and boot is unaffected.
>>>
>>> Kind regards,
>>> Emanuele
>>>
>>> Tested-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
>>
prev parent reply other threads:[~2026-07-17 12:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 8:45 [PATCH] boot: image-fdt: downgrade -EINVAL reservation failure to debug Joseph Guo
2026-07-16 8:25 ` Emanuele Ghidoli
2026-07-16 11:55 ` Jonas Karlman
2026-07-17 5:18 ` Joseph Guo (OSS)
2026-07-17 12:00 ` Emanuele Ghidoli [this message]
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=df4a4fb2-643c-4d6a-a8de-edf15a375928@gmail.com \
--to=ghidoliemanuele@gmail.com \
--cc=anshuld@ti.com \
--cc=ilias.apalodimas@linaro.org \
--cc=jonas@kwiboo.se \
--cc=marek.vasut+renesas@mailbox.org \
--cc=qijian.guo@nxp.com \
--cc=qijian.guo@oss.nxp.com \
--cc=rs@ti.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--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