Re: [PATCH v2 2/3] x86/boot: Move unaccepted memory handling out of the decompressor

From: Kiryl Shutsemau

Date: Fri Sep 25 2026 - 07:59:43 EST


On Fri, Sep 25, 2026 at 09:51:40AM +0200, Ard Biesheuvel wrote:
> arch_accept_memory() is an arch-specific hook that is required by the
> EFI stub when processing memory that the firmware reports to the OS as
> EFI_UNACCEPTED_MEMORY.
>
> This hook is called after ExitBootServices() has been called, as before
> that point, the EFI memory map may get updated behind the back of the
> running EFI stub, making it difficult to get a stable view on it while
> iterating over the entries.
>
> Currently, the x86 version of this hook is implemented in its
> decompressor rather than in the EFI stub itself, in a manner that is
> problematic: when an error occurs, it calls the decompressor's error()
> routine, but without having gone through the decompressor initialization
> code. This means it will resort to direct port I/O rather than the
> hypercall based interface that TDX guests would use otherwise.
>
> Conceptually, code that is only called from the EFI stub, and never by
> the decompressor when doing legacy boot, belongs in the EFI stub and not
> in the decompressor.
>
> So move it into the x86-specific EFI stub code, replacing the error() on
> the TDX path with tdx_panic(), and dropping the error() when no CC
> support is detected - the kernel can decide what to do in this case
> after it has booted.
>
> Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx>

Reviewed-by: Kiryl Shutsemau (Meta) <kas@xxxxxxxxxx>

--
Kiryl Shutsemau / Kirill A. Shutemov