From: Randolph Sapp <rs@ti.com>
To: Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Randolph Sapp <rs@ti.com>
Cc: <robertcnelson@gmail.com>, <ayush@beagleboard.org>,
<Erik.Welsh@octavosystems.com>, <anshuld@ti.com>, <bb@ti.com>,
<trini@konsulko.com>, <afd@ti.com>, <xypron.glpk@gmx.de>,
<u-boot@lists.denx.de>
Subject: Re: [PATCH 5/6] efi_memory: backfill EFI_CONVENTIONAL_MEMORY
Date: Fri, 3 Apr 2026 19:08:06 -0500 [thread overview]
Message-ID: <DHJXLS85SGO8.7U7T6E8CCW6P@ti.com> (raw)
In-Reply-To: <CAC_iWjK=Fx80=Zh73f01oLvQETd8qiuqWyVXCDDpQcwC=BDdtQ@mail.gmail.com>
On Fri Apr 3, 2026 at 12:28 AM CDT, Ilias Apalodimas wrote:
> [...]
>
>> >>
>> >>> +}
>> >>> +
>> >>> /**
>> >>> * 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
I mean, trimming the last x bits off of the LMB allocation flag value to store
the current EFI enum is a little bit of a hack, but honestly it'll allow the
current allocation coalescence logic to continue to work as-is. It would just
need helpers to store and retrieve the enum type for the code that actually
cares about the EFI memory types. I could look into doing that if you guys think
that's a valid approach, or if you've got other ideas.
>>
>> >>> 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
>>
next prev parent reply other threads:[~2026-04-04 0:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 0:14 [PATCH 0/6] various memory related fixups rs
2026-04-02 0:14 ` [PATCH 1/6] lmb: add LMB_FDT for fdt reserved regions rs
2026-04-02 0:36 ` Randolph Sapp
2026-04-02 0:14 ` [PATCH 2/6] efi_dt_fixup: use fdtdec_get_bool rs
2026-04-02 8:38 ` Ilias Apalodimas
2026-04-02 0:14 ` [PATCH 3/6] efi_selftest_memory: check for duplicates first rs
2026-04-02 0:14 ` [PATCH 4/6] efi_memory: nitpick removal loop rs
2026-04-02 9:04 ` Ilias Apalodimas
2026-04-02 17:39 ` Randolph Sapp
2026-04-02 19:02 ` Ilias Apalodimas
2026-04-02 19:21 ` Randolph Sapp
2026-04-02 0:14 ` [PATCH 5/6] efi_memory: backfill EFI_CONVENTIONAL_MEMORY rs
2026-04-02 8:53 ` Ilias Apalodimas
2026-04-02 17:32 ` Randolph Sapp
2026-04-02 19:58 ` Randolph Sapp
2026-04-03 5:28 ` Ilias Apalodimas
2026-04-04 0:08 ` Randolph Sapp [this message]
2026-04-02 0:14 ` [PATCH 6/6] memory: reserve from start_addr_sp to relocaddr rs
2026-04-02 9:21 ` Ilias Apalodimas
2026-04-02 19:15 ` Randolph Sapp
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=DHJXLS85SGO8.7U7T6E8CCW6P@ti.com \
--to=rs@ti.com \
--cc=Erik.Welsh@octavosystems.com \
--cc=afd@ti.com \
--cc=anshuld@ti.com \
--cc=ayush@beagleboard.org \
--cc=bb@ti.com \
--cc=ilias.apalodimas@linaro.org \
--cc=robertcnelson@gmail.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.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