On Tue, 17 Feb 2026 at 17:20, Ard Biesheuvel <[email protected]> wrote:
>
>
> On Tue, 17 Feb 2026, at 09:19, Dave Young wrote:
> > Hi Ard,
> >
> > On Tue, 17 Feb 2026 at 16:10, Ard Biesheuvel <[email protected]> wrote:
> >>
> >> Hi Dave,
> >>
> >> On Tue, 17 Feb 2026, at 09:04, Dave Young wrote:
> >> > Kernel panic occurs during a kexec reboot when EFI runtime services
> >> > are not enabled in the first kernel. The issue is that the second
> >> > kernel cannot find the ACPI RSDP address during boot.
> >> >
> >> > In legacy boot, the acpi_rsdp_addr is set in early x86 boot code.
> >> > However, kernel decompression has moved to the EFI stub for EFI boot.
> >> > Therefore, the x86 EFI stub must also be updated to store the
> >> > acpi_rsdp_addr in the boot parameters to ensure the kexec kernel
> >> > can find it.
> >> >
> >> > (Note: If the pre-kexec kernel was itself a kexec boot, the later kexec
> >> > reboot will still utilize the legacy decompressor path, so the original
> >> > code remains functional though some cleanups can be done later.)
> >> >
> >> > Signed-off-by: Dave Young <[email protected]>
> >> > ---
> >> > drivers/firmware/efi/libstub/x86-stub.c | 18 ++++++++++++++++++
> >> > 1 file changed, 18 insertions(+)
> >> >
> >>
> >> If this issue is kexec-specific, can we move this to where the kexec code
> >> prepares the boot_params struct for the next kernel?
> >>
> >
> > The kexec use case is it depends on the pre-kexec kernel saving it
> > during boot for noefi case. I do not have a better idea to do it in
> > kexec code for the time being.
>
> How about something like this?
Thanks! It works for me, however the legacy kexec_load syscall still
failed with a panic I did not dig into the root cause yet, I supposed
it will find the rsdp from /sys/firmware/efi/systab file, maybe some
userspace code bug.
Anyway I'm fine with this fix, would you like to send a formal patch
since you proposed it? Otherwise I will resend with the changes.
>
> diff --git a/arch/x86/kernel/kexec-bzimage64.c
> b/arch/x86/kernel/kexec-bzimage64.c
> index 7508d0ccc740..24aec7c1153f 100644
> --- a/arch/x86/kernel/kexec-bzimage64.c
> +++ b/arch/x86/kernel/kexec-bzimage64.c
> @@ -313,6 +313,12 @@ setup_boot_parameters(struct kimage *image, struct
> boot_params *params,
>
> /* Always fill in RSDP: it is either 0 or a valid value */
> params->acpi_rsdp_addr = boot_params.acpi_rsdp_addr;
> + if (IS_ENABLED(CONFIG_EFI) && !params->acpi_rsdp_addr) {
> + if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
> + params->acpi_rsdp_addr = efi.acpi20;
> + else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
> + params->acpi_rsdp_addr = efi.acpi;
> + }
>
> /* Default APM info */
> memset(¶ms->apm_bios_info, 0, sizeof(params->apm_bios_info));
>