[PATCH 5/6] efi_memory: backfill EFI_CONVENTIONAL_MEMORY
Ilias Apalodimas
ilias.apalodimas at linaro.org
Fri Apr 3 07:28:38 CEST 2026
[...]
> >>
> >>> +}
> >>> +
> >>> /**
> >>> * efi_allocate_pages - allocate memory pages
> >>> *
> >>> @@ -507,10 +528,20 @@ efi_status_t efi_allocate_pages(enum efi_allocate_type type,
> >>> /* Reserve that map in our memory maps */
> >>> ret = efi_update_memory_map(efi_addr, pages, memory_type, true, false);
> >>
> >> In theory the lmb and the EFI maps are in sync. I haven't checked
> >> close enough yet, but do you have cases where lmb_alloc worked and
> >> updating the efi memory map failed?
> >
> > Fair point. Now that I've fixed the FDT warning I should probably check if I can
> > actually reproduce the issue that actually required this.
>
> Yeah, this patch isn't necessary anymore. I suppose it should be dropped as it
> would potentially mask any discrepancies between the two maps.
Yea and if we really need a similar fix in the future, it's best if we
put in the lmb core code.
>
> Out of curiosity, is there any plan to merge the EFI and LMB allocators more in
> the future, or is the current layering scheme the furthest we want to go?
We do, but havent due to lack of time. It's been a while since I
discussed this with Heinrich but iirc the only thing missing is for
lmb to be aware of the memory flags EFI expects.
/Ilias
>
> >>> if (ret != EFI_SUCCESS) {
> >>> - /* Map would overlap, bail out */
> >>> + /* Map would overlap, try something else */
> >>> lmb_free(addr, (u64)pages << EFI_PAGE_SHIFT, flags);
> >>> unmap_sysmem((void *)(uintptr_t)efi_addr);
> >>> - return EFI_OUT_OF_RESOURCES;
> >>> +
> >>> + /* See if there is any EFI_CONVENTIONAL_MEMORY allocations */
> >>> + if (type != EFI_ALLOCATE_ADDRESS) {
> >>
> >> Can you please inverse this. It's going to reduce the identation.
> >> if (type == EFI_ALLOCATE_ADDRESS)
> >>> + *memory = efi_get_conventional_start(pages);
> >>> + if (*memory != 0)
> >>
> >> Same here
> >>
> >>> + return efi_allocate_pages(EFI_ALLOCATE_ADDRESS,
> >>> + memory_type, pages,
> >>> + memory);
> >>> + }
> >>> +
> >>> + return EFI_OUT_OF_RESOURCES;
> >>> }
> >>>
> >>> *memory = efi_addr;
> >>> --
> >>> 2.53.0
> >>>
> >>
> >> Thanks
> >> /Ilias
>
More information about the U-Boot
mailing list