Hi Heinrich, On Wed, 16 Oct 2024 at 19:57, Heinrich Schuchardt <xypron.g...@gmx.de> wrote: > > On 17.09.24 11:02, Ilias Apalodimas wrote: > > The EFI spec defines special-purpose memory in ยง7.2. That memory > > serves as a hint to the OS to avoid allocating this memory for core > > OS data or code that can not be relocated. So let's ignore it when > > allocating from conventional memory. > > > > Signed-off-by: Ilias Apalodimas <ilias.apalodi...@linaro.org> > > --- > > lib/efi_loader/efi_memory.c | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c > > index c6f1dd09456e..74732e37f8aa 100644 > > --- a/lib/efi_loader/efi_memory.c > > +++ b/lib/efi_loader/efi_memory.c > > @@ -422,7 +422,8 @@ static efi_status_t efi_check_allocated(u64 addr, bool > > must_be_allocated) > > > > if (addr >= start && addr < end) { > > if (must_be_allocated ^ > > - (item->desc.type == EFI_CONVENTIONAL_MEMORY)) > > + (item->desc.type == EFI_CONVENTIONAL_MEMORY) && > > + !(item->desc.attribute & EFI_MEMORY_SP)) > > return EFI_SUCCESS; > > else > > return EFI_NOT_FOUND; > > @@ -460,6 +461,9 @@ static uint64_t efi_find_free_memory(uint64_t len, > > uint64_t max_addr) > > Now that Sushosh's LMB patches are merged this function does not exist > anymore. > > I think we should next move the EFI memory map to LMB to avoid double > book keeping. >
Yea, I sent that patch before LMB as a fix, but I agreed to wait till the LMB patches get merged. Now that they are in we'll rework it. Thanks /Ilias > Best regards > > Heinrich > > > if (desc->type != EFI_CONVENTIONAL_MEMORY) > > continue; > > > > + if (desc->attribute & EFI_MEMORY_SP) > > + continue; > > + > > /* Out of bounds for max_addr */ > > if ((ret + len) > max_addr) > > continue; >