Re: [PATCH v6 1/8] efi: Pass KHO state to the next kernel in a configuration table

From: Ard Biesheuvel

Date: Thu Oct 29 2026 - 15:28:51 EST



On Thu, 29 Oct 2026, at 18:29, George Guo wrote:
> From: George Guo <guodongtai@xxxxxxxxxx>
>
> KHO has to give the next kernel two addresses: the KHO FDT and the
> bootmem area list. arm64 and riscv put them under /chosen in the boot
> FDT. LoongArch systems booting with EFI and ACPI do not require a boot
> FDT, so KHO needs another way to pass this information.
>
> Add a Linux EFI configuration table for them, under
> LINUX_EFI_KEXEC_HANDOVER_GUID. It points to a struct linux_efi_kho_data.
>
> - On a cold boot, the LoongArch EFI stub installs the table, zeroed.
> Each kexec'd kernel is given the same EFI system table, so it finds
> the same table.
>
> - In early boot, efi_config_parse_tables() reserves the table so
> neither the page allocator nor kexec segments use it, and calls
> kho_populate() if the table holds KHO state.
>
> - Provide efi_kho_update() to update the table before kexec. Map the
> table during boot so updates do not require allocation or mapping
> at panic time.
>
> - efi_kho_table_found() tells architecture code whether the table was
> found at boot, so it can turn KHO off when the table is missing.
>
> Only the LoongArch stub installs the table, and only with
> CONFIG_KEXEC_HANDOVER. Elsewhere there is no table and this code does
> nothing.
>

Can we handle this as an arch table then, and handle everything in
the LoongArch arch code?