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

From: Gupta, Pankaj

Date: Thu Nov 26 2026 - 06:30:18 EST



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>
Reviewed-by: Pankaj Gupta <pankaj.gupta@xxxxxxx>
Tested-by: Pankaj Gupta <pankaj.gupta@xxxxxxx>

Tested on SEV-SNP with CONFIG_UNACCEPTED_MEMORY=y

Best regards,

Pankaj