[PATCHv4 2/6] boot_fdt_add_mem_rsv_regions: free old dtb reservations
Randolph Sapp
rs at ti.com
Wed Apr 22 00:55:52 CEST 2026
On Tue Apr 21, 2026 at 5:54 PM CDT, Simon Glass wrote:
> Hi Randolph,
>
> On Wed, 22 Apr 2026 at 10:14, Randolph Sapp <rs at ti.com> wrote:
>>
>> On Tue Apr 21, 2026 at 3:40 PM CDT, Simon Glass wrote:
>> > Hi Randolph,
>> >
>> > On 2026-04-20T19:25:18, Randolph Sapp <rs at ti.com> wrote:
>> >> boot_fdt_add_mem_rsv_regions: free old dtb reservations
>> >>
>> >> Add a free flag and an initial call to free allocations covered by the
>> >> global FDT. This assumes that all calls to boot_fdt_add_mem_rsv_regions
>> >> occur before the transition to the new device tree, thus we can access
>> >> the currently active device tree through the global data pointer.
>> >>
>> >> This allows us to clearly indicate to the user when a device tree
>> >> reservation fails. How we handle this can still use some improvement.
>> >> Right now we'll keep the default behavior and try to boot anyway.
>> >>
>> >> This functionality was broken in:
>> >> 5a6aa7d ("boot: fdt: Handle already reserved memory in boot_fdt_reserve_region()")
>> >>
>> >> Signed-off-by: Randolph Sapp <rs at ti.com>
>> >>
>> >> arch/mips/lib/bootm.c | 2 +-
>> >> boot/bootm.c | 2 +-
>> >> boot/bootm_os.c | 2 +-
>> >> boot/image-board.c | 2 +-
>> >> boot/image-fdt.c | 57 +++++++++++++++++++++++++++++++++++----------------
>> >> include/image.h | 2 +-
>> >> lib/lmb.c | 2 +-
>> >> 7 files changed, 45 insertions(+), 24 deletions(-)
>> >
>> >> diff --git a/boot/image-fdt.c b/boot/image-fdt.c
>> >> @@ -69,35 +69,51 @@ static const struct legacy_img_hdr *image_get_fdt(ulong fdt_addr)
>> >> +static void boot_fdt_reserve_region(u64 addr, u64 size, u32 flags, bool free)
>> >> {
>> >> - long ret;
>> >> + int ret;
>> >
>> > nit: perhaps keep this one 'long' since lmb_free() returns long ?
>> >
>> > Regards,
>> > Simon
>>
>> Ugh, yeah though it should only return 0, -EEXIST, or -1 since that's all
>> lmb_add_region_flags returns. I'm not going to ask why that's the case.
>
> Ah yes, I suppose it could be changed to return an int.
>
> Regards,
> Simon
I'll leave that for later cleanup considering I've still got to get the
pocketbeagle2 series submitted after this stuff.
More information about the U-Boot
mailing list