Re: [PATCH v2] x86/boot: Use EFI setup data if provided

From: Borislav Petkov
Date: Mon Mar 25 2019 - 08:32:26 EST


On Mon, Mar 25, 2019 at 08:23:02PM +0800, Dave Young wrote:
> efi_enter_virtual_mode() can only run once because of efi firmware/spec
> limitation, and after entered virtual mode, efi firmware just updated

I should remember that - I did it at the time.

> Kexec saved the original physical addresses, and pass them to kexeced
> kernel via x86 setup_data, so both the early parsing or efi init code
> need to get those physical values from setup_data.

So efi_get_rsdp_addr() needs to be refactored in such a way so that at
least the loop towards the end gets carved out into a separate function
- __efi_get_rsdp_addr() or so - which gets config_tables, nr_tables and
size as arguments and finds the RSDP address in the kexec-ed kernel.

So we'd need something like that:

acpi_physical_address get_rsdp_addr(void)
{
acpi_physical_address pa;

pa = get_acpi_rsdp();

if (!pa)
pa = boot_params->acpi_rsdp_addr;

if (!pa)
pa = efi_get_rsdp_addr();

if (!pa)
pa = kexec_get_rdsp_addr(); <--- new function

if (!pa)
pa = bios_get_rsdp_addr();

return pa;
}

which would get config_tables from setup_data and call
__efi_get_rsdp_addr() to dig it out in the kexec'ed kernel.

Junichi, ask if it is still unclear what needs to be done.

Thx.

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.