Skip to contentSkip to conversation

x86/kexec: Copy ACPI root pointer address from config table

PATCH In review Ard Biesheuvel 2 participants 2 messages Feb 17 – Mar 6

Subsystems (3)
lore
Share & tools
lore

Ard Biesheuvel

author maintainer
#0 lore raw

PATCH 1/1 x86/kexec: Copy ACPI root pointer address from config table

Dave reports that kexec may fail when the first kernel boots via the EFI stub but without EFI runtime services, as in that case, the RSDP address field in struct bootparams is never assigned. Kexec copies this value into the version of struct bootparams that it provides to the incoming kernel, which may have no other means to locate the ACPI root pointer.

So take the value from the EFI config tables if no root pointer has been set in the first kernel's struct bootparams.

Fixes a1b87d54f4e4 ("x86/efistub: Avoid legacy decompressor when doing EFI boot")
Cc <[email protected]> # v6.1

---
Unless anyone minds, I intend to take this via the EFI tree as a fix.

 arch/x86/kernel/kexec-bzimage64.c | 6 ++++++
 1 file changed, 6 insertions(+)
arch/x86/kernel/kexec-bzimage64.c +6 -0
index 7508d0ccc740..24aec7c1153f 100644
@@ -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(&params->apm_bios_info, 0, sizeof(params->apm_bios_info));
Signature · 1 line
2.53.0.273.g2a3d683680-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 29 lines · Ard Biesheuvel

Dave reports that kexec may fail when the first kernel boots via the EFI stub but without EFI runtime services, as in that case, the RSDP address field in struct bootparams is never assigned. Kexec copies this value into the version of struct bootparams that it provides to the incoming kernel, which may have no other means to locate the ACPI root pointer.

So take the value from the EFI config tables if no root pointer has been set in the first kernel's struct bootparams.

Fixes a1b87d54f4e4 ("x86/efistub: Avoid legacy decompressor when doing EFI boot")
Cc <[email protected]> # v6.1

---
Unless anyone minds, I intend to take this via the EFI tree as a fix.

arch/x86/kernel/kexec-bzimage64.c | 6 ++++++

1 file changed, 6 insertions(+)
arch/x86/kernel/kexec-bzimage64.c +0 -0
index 7508d0ccc740..24aec7c1153f 100644
@@ -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;

arch/x86/kernel/kexec-bzimage64.c setup_boot_parameters(struct kimage *image, struct boot_params *params,

Quoted 10 lines
arch/x86/kernel/kexec-bzimage64.c +6 -1
+	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(&params->apm_bios_info, 0, sizeof(params->apm_bios_info));
-- 2.53.0.273.g2a3d683680-goog

This change is good to me.