linux_dsm_epyc7002/drivers/firmware/efi/libstub
Ard Biesheuvel 17054f492d efi/x86: Implement mixed mode boot without the handover protocol
Add support for booting 64-bit x86 kernels from 32-bit firmware running
on 64-bit capable CPUs without requiring the bootloader to implement
the EFI handover protocol or allocate the setup block, etc etc, all of
which can be done by the stub itself, using code that already exists.

Instead, create an ordinary EFI application entrypoint but implemented
in 32-bit code [so that it can be invoked by 32-bit firmware], and stash
the address of this 32-bit entrypoint in the .compat section where the
bootloader can find it.

Note that we use the setup block embedded in the binary to go through
startup_32(), but it gets reallocated and copied in efi_pe_entry(),
using the same code that runs when the x86 kernel is booted in EFI
mode from native firmware. This requires the loaded image protocol to
be installed on the kernel image's EFI handle, and point to the kernel
image itself and not to its loader. This, in turn, requires the
bootloader to use the LoadImage() boot service to load the 64-bit
image from 32-bit firmware, which is in fact supported by firmware
based on EDK2. (Only StartImage() will fail, and instead, the newly
added entrypoint needs to be invoked)

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2020-02-23 21:59:42 +01:00
..
arm32-stub.c efi/libstub/arm: Make efi_entry() an ordinary PE/COFF entrypoint 2020-02-22 23:37:37 +01:00
arm64-stub.c efi/libstub: Use hidden visibility for all source files 2020-02-23 21:57:12 +01:00
arm-stub.c efi/libstub: Take noinitrd cmdline argument into account for devpath initrd 2020-02-23 21:59:42 +01:00
efi-stub-helper.c efi/libstub/x86: Make loaded_image protocol handling mixed mode safe 2020-02-23 21:59:42 +01:00
efistub.h efi/libstub/x86: Use Exit() boot service to exit the stub on errors 2020-02-23 21:59:42 +01:00
fdt.c efi/libstub: Simplify efi_high_alloc() and rename to efi_allocate_pages() 2020-02-23 21:57:15 +01:00
file.c efi/libstub: Fix error message in handle_cmdline_files() 2020-02-23 21:57:31 +01:00
gop.c efi/libstub: Rename efi_call_early/_runtime macros to be more intuitive 2019-12-25 10:49:25 +01:00
hidden.h efi/libstub: Use hidden visibility for all source files 2020-02-23 21:57:12 +01:00
Makefile efi/libstub: Clean up command line parsing routine 2020-02-23 21:57:15 +01:00
mem.c efi/libstub: Describe efi_relocate_kernel() 2020-02-23 21:57:15 +01:00
pci.c efi: Allow disabling PCI busmastering on bridges during boot 2020-01-10 18:55:04 +01:00
random.c efi/libstub: Describe RNG functions 2020-02-23 21:57:19 +01:00
randomalloc.c efi/libstub: Move efi_random_alloc() into separate source file 2020-02-23 21:57:15 +01:00
secureboot.c efi/libstub: Rename efi_call_early/_runtime macros to be more intuitive 2019-12-25 10:49:25 +01:00
skip_spaces.c efi/libstub: Clean up command line parsing routine 2020-02-23 21:57:15 +01:00
string.c efi/libstub: Clean up command line parsing routine 2020-02-23 21:57:15 +01:00
tpm.c efi/libstub: Rename efi_call_early/_runtime macros to be more intuitive 2019-12-25 10:49:25 +01:00
x86-stub.c efi/x86: Implement mixed mode boot without the handover protocol 2020-02-23 21:59:42 +01:00