[PATCH v6 2/8] kho: Write KHO state to the EFI table at kexec time
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Thu Oct 29 10:47:13 PDT 2026
> From: George Guo <guodongtai at kylinos.cn>
>
> On arm64 and riscv, KHO addresses and sizes are passed through /chosen
> properties in the boot FDT prepared for each kexec image. On x86, they
> are passed through a SETUP_KEXEC_KHO record linked from the image's boot
> parameters. These records are per-image, unlike the shared EFI table.
>
> The EFI table is shared. A KHO-enabled normal image and a crash image
> can both be loaded, but need different contents: the normal image needs
> the KHO addresses, while the crash image needs an empty table. Updating
> the table at load time cannot satisfy both.
>
> Write the table in kernel_kexec() and __crash_kexec(), once the image
> that will run is known. kho_update_efi_table() fills the table from that
> image, or zeroes it if the image has no KHO state, including images
> loaded with kexec_load().
>
> Clear the table even with CONFIG_KEXEC_HANDOVER disabled, since the
> kernel may have inherited a populated table. This prevents a later
> kernel from trying to revive obsolete KHO state.
>
> The table stores the size of the bootmem area list (bufsz), not of its
> page-aligned segment, as the FDT and x86 code do. If updating or clearing
> the table fails, kernel_kexec() returns before liveupdate_reboot(), so
> LUO does not save state that the next kernel would not find.
> __crash_kexec() ignores the error so the crash boot can still proceed.
>
> Signed-off-by: George Guo <guodongtai at kylinos.cn>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261029172956.20791-1-dongtai.guo@linux.dev?part=2
More information about the kexec
mailing list