Re: [PATCH v4] x86/boot: Use efi_setup_data for searching RSDP on kexec-ed kernel
From: Borislav Petkov
Date: Fri Apr 12 2019 - 04:50:07 EST
On Fri, Apr 12, 2019 at 02:54:17AM +0000, Junichi Nomura wrote:
> Without #ifdef CONFIG_X86_64, I got compiler warnings on 32bit build
> about casting u64 to pointer.
Yah, stupid ifdeffery.
> We need #ifdef CONFIG_EFI to avoid build failure about undefined
> __efi_get_rsdp_addr().
diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c
index c3020e2d8f67..4b1d4a0a4269 100644
--- a/arch/x86/boot/compressed/acpi.c
+++ b/arch/x86/boot/compressed/acpi.c
@@ -46,7 +46,6 @@ static acpi_physical_address get_acpi_rsdp(void)
return addr;
}
-#ifdef CONFIG_EFI
/*
* Search EFI system tables for RSDP. If both ACPI_20_TABLE_GUID and
* ACPI_TABLE_GUID are found, take the former, which has more features.
@@ -56,6 +55,8 @@ __efi_get_rsdp_addr(unsigned long config_tables, unsigned int nr_tables,
bool efi_64)
{
acpi_physical_address rsdp_addr = 0;
+
+#ifdef CONFIG_EFI
int i;
/* Get EFI tables from systab. */
@@ -85,10 +86,9 @@ __efi_get_rsdp_addr(unsigned long config_tables, unsigned int nr_tables,
else if (!(efi_guidcmp(guid, ACPI_20_TABLE_GUID)))
return table;
}
-
+#endif
return rsdp_addr;
}
-#endif
/* EFI/kexec support is 64-bit only. */
#ifdef CONFIG_X86_64
---
> I think that should be the other way around:
No, it shouldn't.
kexec_get_rsdp_addr() must do:
if (!kexec_kernel)
return 0:
esd = (struct efi_setup_data *)get_kexec_setup_data_addr();
if (!esd)
return EFI_SETUP_DATA_INVALID;
...
Now I need to go figure out whether there's a reliable way to know in
the kexec kernel that it *is* a kexec kernel.
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.