Re: [PATCH] x86/efi: Handle EFI_UNACCEPTED_MEMORY in do_add_efi_memmap()

From: Kiryl Shutsemau (Meta)

Date: Thu Nov 26 2026 - 07:06:32 EST


On Thu, Nov 26, 2026 at 12:29:30PM +0100, Ard Biesheuvel wrote:
>
>
> On Wed, 25 Nov 2026, at 18:33, Kiryl Shutsemau (Meta) wrote:
> > The EFI stub reports unaccepted memory to the kernel as E820 RAM.
> > do_add_efi_memmap() has no case for EFI_UNACCEPTED_MEMORY and adds the
> > same range again as E820_TYPE_RESERVED. e820__update_table() resolves
> > the overlap in favour of the reserved type, so the kernel never uses
> > the range.
> >
> > do_add_efi_memmap() runs when soft reservation is enabled and the
> > firmware marks any conventional memory EFI_MEMORY_SP; that takes no
> > command-line option. It also runs with the add_efi_memmap boot
> > parameter. A TDX or SEV-SNP guest booted either way loses the memory the
> > firmware left unaccepted, and it does not show up in MemTotal.
> >
> > Add unaccepted memory as RAM, as the stub does. Without
> > CONFIG_UNACCEPTED_MEMORY the kernel cannot accept it, so keep it
> > reserved there.
> >
> > Fixes: 745e3ed85f71 ("efi/libstub: Implement support for unaccepted memory")
> > Reported-by: Mike Rapoport <rppt@xxxxxxxxxx>
> > Cc: stable@xxxxxxxxxxxxxxx
> > Signed-off-by: Kiryl Shutsemau (Meta) <kas@xxxxxxxxxx>
> > ---
> > Build-tested only, with and without CONFIG_UNACCEPTED_MEMORY.
> >
> > arch/x86/platform/efi/efi.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
>
> Reviewed-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
>
> I can take this via efi/urgent if desired.

It is not urgent on my part. It can wait the next merge window, unless
someone else needs it now.

--
Kiryl Shutsemau / Kirill A. Shutemov