Skip to contentSkip to conversation

boot: image-fdt: downgrade -EINVAL reservation failure to debug

PATCH In review Joseph Guo 5 participants 6 messages Jul 13 – Jul 28

lore
Share & tools
lore

Joseph Guo

author
#0 lore raw

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.

Fixes 623f6c5b6ab7 ("boot: image-fdt: free old dtb reservations")
---
 boot/image-fdt.c | 3 +++
 1 file changed, 3 insertions(+)
boot/image-fdt.c +3 -0
index 9e0e0f93edd34ae9056926883b1a802858e179d9..2175fa338f55110862100fa9f491a0957e85ce56 100644
@@ -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]>
Tested-by on v1 1/1
#1 lore raw
Quoted 46 lines · Joseph Guo

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.

Fixes 623f6c5b6ab7 ("boot: image-fdt: free old dtb reservations")
---
 boot/image-fdt.c | 3 +++
 1 file changed, 3 insertions(+)
boot/image-fdt.c +3 -1
index 9e0e0f93edd34ae9056926883b1a802858e179d9..2175fa338f55110862100fa9f491a0957e85ce56 100644
@@ -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

#2 lore raw

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 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.

Quoted 7 lines
Quoted 7 lines

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/[email protected]/

Regards,
Jonas

Quoted 38 lines
Quoted 26 lines
Fixes 623f6c5b6ab7 ("boot: image-fdt: free old dtb reservations")
---
 boot/image-fdt.c | 3 +++
 1 file changed, 3 insertions(+)
boot/image-fdt.c +3 -1
index 9e0e0f93edd34ae9056926883b1a802858e179d9..2175fa338f55110862100fa9f491a0957e85ce56 100644
@@ -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

#3 lore raw
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 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.

Quoted 7 lines
Quoted 7 lines

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.

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 -EINVAL to 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")
---
 boot/image-fdt.c | 3 +++
 1 file changed, 3 insertions(+)
boot/image-fdt.c +3 -1
index 9e0e0f93edd34ae9056926883b1a802858e179d9..2175fa338f55110862100fa9f491a0957e85ce56 100644
@@ -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

#4 lore raw
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 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.

Quoted 7 lines
Quoted 7 lines

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.

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 -EINVAL to 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")
---
 boot/image-fdt.c | 3 +++
 1 file changed, 3 insertions(+)
boot/image-fdt.c +3 -1
index 9e0e0f93edd34ae9056926883b1a802858e179d9..2175fa338f55110862100fa9f491a0957e85ce56 100644
@@ -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

#5 lore raw
In reply to Joseph Guo

Hi Joseph,

Quoted 27 lines · Joseph Guo

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.

[...]

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