boot: image-fdt: downgrade -EINVAL reservation failure to debug
PATCH 1/1 boot: image-fdt: downgrade -EINVAL reservation failure to debug
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.
--- boot/image-fdt.c | 3 +++ 1 file changed, 3 insertions(+)
boot/image-fdt.c +3 -0
@@ -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,
Signature · 1 line
Joseph Guo <[email protected]>
Quoted 46 lines · Joseph Guo
When
boot_fdt_handle_region()attempts to reserve a DTS reserved-memory region vialmb_alloc_mem(), it may receive-EINVALif the region's physical address falls outside the LMB-managed memory range (i.e. belowPHYS_SDRAMon platforms where U-Boot does not manage the lower DRAM window).A typical example is platforms like i.MX95 where
PHYS_SDRAMstarts at0x90000000, 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
-EINVALcase todebug()to suppress the spurious output while preserving full visibility under DEBUG/log builds.Real failures (e.g.
-EEXISTfrom an overlapping reservation) continue to be reported as ERROR.Fixes 623f6c5b6ab7 ("boot: image-fdt: free old dtb reservations")Signed-off-by Joseph Guo <[email protected]>--- boot/image-fdt.c | 3 +++ 1 file changed, 3 insertions(+)boot/image-fdt.c +3
-1@@ -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
Quoted 1 line
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
Hi Joseph and Emanuele,
Quoted 16 lines · Emanuele Ghidoli
Quoted 13 lines · Joseph Guo
When
boot_fdt_handle_region()attempts to reserve a DTS reserved-memory region vialmb_alloc_mem(), it may receive-EINVALif the region's physical address falls outside the LMB-managed memory range (i.e. belowPHYS_SDRAMon platforms where U-Boot does not manage the lower DRAM window).A typical example is platforms like i.MX95 where
PHYS_SDRAMstarts at0x90000000, 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.
Quoted 7 lines
Quoted 7 lines
Printing ERROR for a condition that is harmless and expected on many platforms is misleading. Downgrade the
-EINVALcase todebug()to suppress the spurious output while preserving full visibility under DEBUG/log builds.Real failures (e.g.
-EEXISTfrom 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/[email protected]/
Regards,
Jonas
Quoted 38 lines
Quoted 26 lines
Fixes 623f6c5b6ab7 ("boot: image-fdt: free old dtb reservations")Signed-off-by Joseph Guo <[email protected]>--- boot/image-fdt.c | 3 +++ 1 file changed, 3 insertions(+)boot/image-fdt.c +3
-1@@ -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-f8319ab2d75bQuoted 1 line
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,
EmanueleTested-by Emanuele Ghidoli <[email protected]>
Quoted 29 lines · Jonas Karlman
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Hi Joseph and Emanuele,
Quoted 16 lines · Emanuele Ghidoli
Quoted 13 lines · Joseph Guo
When
boot_fdt_handle_region()attempts to reserve a DTS reserved-memory region vialmb_alloc_mem(), it may receive-EINVALif the region's physical address falls outside the LMB-managed memory range (i.e. belowPHYS_SDRAMon platforms where U-Boot does not manage the lower DRAM window).A typical example is platforms like i.MX95 where
PHYS_SDRAMstarts at0x90000000, 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.Quoted 7 lines
Quoted 7 lines
Printing ERROR for a condition that is harmless and expected on many platforms is misleading. Downgrade the
-EINVALcase todebug()to suppress the spurious output while preserving full visibility under DEBUG/log builds.Real failures (e.g.
-EEXISTfrom an overlapping reservation) continue to be reported as ERROR.
Quoted 9 lines
I sent a similar patch 2-3 weeks ago [1], and was planning to send a v2 that also change
lmb_free()to return-EINVALto also catch the free scenario.[1] https://patch.msgid.link/[email protected]/
Regards,
Jonas
Hi Jonas,
Thanks for your information. This patch can be dropped in that case.
Regards,
Joseph>>>
Quoted 38 lines
Quoted 37 lines
Quoted 25 lines
Fixes 623f6c5b6ab7 ("boot: image-fdt: free old dtb reservations")Signed-off-by Joseph Guo <[email protected]>--- boot/image-fdt.c | 3 +++ 1 file changed, 3 insertions(+)boot/image-fdt.c +3
-1@@ -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-f8319ab2d75bQuoted 1 line
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,
EmanueleTested-by Emanuele Ghidoli <[email protected]>
Quoted 40 lines · Joseph Guo (OSS)
Quoted 29 lines · Jonas Karlman
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Hi Joseph and Emanuele,
Quoted 16 lines · Emanuele Ghidoli
Quoted 13 lines · Joseph Guo
When
boot_fdt_handle_region()attempts to reserve a DTS reserved-memory region vialmb_alloc_mem(), it may receive-EINVALif the region's physical address falls outside the LMB-managed memory range (i.e. belowPHYS_SDRAMon platforms where U-Boot does not manage the lower DRAM window).A typical example is platforms like i.MX95 where
PHYS_SDRAMstarts at0x90000000, 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.Quoted 7 lines
Quoted 7 lines
Printing ERROR for a condition that is harmless and expected on many platforms is misleading. Downgrade the
-EINVALcase todebug()to suppress the spurious output while preserving full visibility under DEBUG/log builds.Real failures (e.g.
-EEXISTfrom an overlapping reservation) continue to be reported as ERROR.Quoted 9 lines
I sent a similar patch 2-3 weeks ago [1], and was planning to send a v2 that also change
lmb_free()to return-EINVALto also catch the free scenario.[1] https://patch.msgid.link/[email protected]/
Regards,
Jonas
Quoted 6 lines
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
Quoted 38 lines
Quoted 38 lines
Quoted 37 lines
Quoted 25 lines
Fixes 623f6c5b6ab7 ("boot: image-fdt: free old dtb reservations")Signed-off-by Joseph Guo <[email protected]>--- boot/image-fdt.c | 3 +++ 1 file changed, 3 insertions(+)boot/image-fdt.c +3
-1@@ -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-f8319ab2d75bQuoted 1 line
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,
EmanueleTested-by Emanuele Ghidoli <[email protected]>
Hi Joseph,
Quoted 27 lines · Joseph Guo
boot: image-fdt: downgrade
-EINVALreservation failure to debugWhen
boot_fdt_handle_region()attempts to reserve a DTS reserved-memory region vialmb_alloc_mem(), it may receive-EINVALif the region's physical address falls outside the LMB-managed memory range (i.e. belowPHYS_SDRAMon platforms where U-Boot does not manage the lower DRAM window).A typical example is platforms like i.MX95 where
PHYS_SDRAMstarts at0x90000000, 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
-EINVALcase todebug()to suppress the spurious output while preserving full visibility under DEBUG/log builds.[...]
boot/image-fdt.c| 3 +++1 file changed, 3 insertions(+)
boot/image-fdt.c static void boot_fdt_handle_region(u64 addr, u64 size, u32 flags, bool free) · line 97
Quoted 3 lines
boot/image-fdt.c +3
-0@@ -95,6 +95,9 @@ static void boot_fdt_handle_region(u64 addr, u64 size, u32 flags, bool free) + }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);
Just to note, -EINVAL from _lmb_alloc_addr() is also returned when the region only partially overlaps available memory, e.g. a reserved-memory node that straddles the start of PHYS_SDRAM or spans a hole between banks. Part of such a region is reachable by U-Boot's allocator, so silently skipping it means the initrd or FDT could still be placed there - exactly what the commit message says cannot happen.
I see this patch is being dropped in favour of Jonas's version, but the same applies there: perhaps only downgrade the message when the region has no overlap at all with LMB memory, or clamp the reservation to the overlapping portion.
Regards,
Simon