All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/8] efi: disentangle the generic EFI stub from FDT
@ 2022-09-20 18:35 Ard Biesheuvel
  2022-09-20 18:35 ` [PATCH v2 1/8] efi: libstub: drop pointless get_memory_map() call Ard Biesheuvel
                   ` (7 more replies)
  0 siblings, 8 replies; 27+ messages in thread
From: Ard Biesheuvel @ 2022-09-20 18:35 UTC (permalink / raw)
  To: linux-efi
  Cc: loongarch, Ard Biesheuvel, Arnd Bergmann, Ilias Apalodimas,
	Huacai Chen, Xi Ruoyao

EFI architectures other than x86 rely on FDT to pass information between
the stub and the core kernel. In hindsight, this is probably a mistake,
given the issues around abuse of the internal ABI, and potential
inconsistencies between two sources of information that both originate
in the firmware (memory map, command line, etc)

Another reason for avoiding updates to the DT is the fact that it
interferes with secure boot and measured boot. Even if we measure the
original firmware provided DT into the TPM, the DT that the kernel
receives is a completely different blob, and verifying it against the
TPM event log is currently impossible.

So let's start hacking away at this, and refactor the generic stub so
that all the FDT pieces are isolated in a singe source file, and rely on
generic EFI config tables for passing the initrd base and size.
Ultimately, this should permit all EFI architectures doing DT boot to
perform the handover to the core kernel in a different way, and pass on
the firmware provided DT unmodified, but this requires some future work
for ARM/arm64 and RISC-V.

However, we can easily convert the newly added LoongArch code to adopt
this approach, and to consume the DT strictly for hardware descriptions
(if not doing ACPI boot), and pass the initrd, memory map and everything
else via EFI config tables. Generating empty DTBs on ACPI platforms will
no longer be needed.

The first six patches as well as patch #10 are general cleanup, and can
be merged separately. The remaining patches refactor the FDT code in the
EFI stub so that we can avoid it on platforms that don't need it for
other reasons. Finally, LoongArch is updated to use DT only for hardware
descriptions when doing EFI boot.

Changes since v1:
- to ease merging this with the loongarch tree, drop unrelated cleanup
  changes, which will be merged separately;
- drop the patch to enable DT for hw descriptions - it will be picked up
  again later
- avoid creating the INITRD table if no initrd was actually loaded;
- incorporate feedback from Huacai on the arch/loongarch changes;
- other minor tweaks.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Huacai Chen <chenhuacai@loongson.cn>
Cc: Xi Ruoyao <xry111@xry111.site>

Ard Biesheuvel (8):
  efi: libstub: drop pointless get_memory_map() call
  efi: libstub: avoid efi_get_memory_map() for allocating the virt map
  efi: libstub: simplify efi_get_memory_map() and struct efi_boot_memmap
  efi: libstub: remove pointless goto kludge
  efi: libstub: unify initrd loading between architectures
  efi: libstub: remove DT dependency from generic stub
  efi: libstub: install boot-time memory map as config table
  efi/loongarch: libstub: remove dependency on flattened DT

 Documentation/arm/uefi.rst                     |   4 -
 arch/loongarch/Kconfig                         |   3 -
 arch/loongarch/include/asm/bootinfo.h          |   2 +-
 arch/loongarch/kernel/efi.c                    |  30 +++-
 arch/loongarch/kernel/env.c                    |  13 +-
 arch/loongarch/kernel/head.S                   |   2 +
 arch/loongarch/kernel/setup.c                  |   4 +-
 drivers/firmware/efi/efi.c                     |  15 ++
 drivers/firmware/efi/libstub/Makefile          |  13 +-
 drivers/firmware/efi/libstub/arm64-stub.c      |  19 +--
 drivers/firmware/efi/libstub/efi-stub-helper.c | 139 ++++++++--------
 drivers/firmware/efi/libstub/efi-stub.c        |  90 ++++------
 drivers/firmware/efi/libstub/efistub.h         |  28 +---
 drivers/firmware/efi/libstub/fdt.c             | 176 +++++++++++---------
 drivers/firmware/efi/libstub/loongarch-stub.c  |  56 ++++++-
 drivers/firmware/efi/libstub/mem.c             |  93 +++++------
 drivers/firmware/efi/libstub/randomalloc.c     |  25 +--
 drivers/firmware/efi/libstub/relocate.c        |  21 +--
 drivers/firmware/efi/libstub/x86-stub.c        |  30 +---
 include/linux/efi.h                            |  15 ++
 20 files changed, 395 insertions(+), 383 deletions(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2022-09-22 14:48 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-20 18:35 [PATCH v2 0/8] efi: disentangle the generic EFI stub from FDT Ard Biesheuvel
2022-09-20 18:35 ` [PATCH v2 1/8] efi: libstub: drop pointless get_memory_map() call Ard Biesheuvel
2022-09-20 18:35 ` [PATCH v2 2/8] efi: libstub: avoid efi_get_memory_map() for allocating the virt map Ard Biesheuvel
2022-09-20 18:35 ` [PATCH v2 3/8] efi: libstub: simplify efi_get_memory_map() and struct efi_boot_memmap Ard Biesheuvel
2022-09-20 18:35 ` [PATCH v2 4/8] efi: libstub: remove pointless goto kludge Ard Biesheuvel
2022-09-20 18:35 ` [PATCH v2 5/8] efi: libstub: unify initrd loading between architectures Ard Biesheuvel
2022-09-20 18:35 ` [PATCH v2 6/8] efi: libstub: remove DT dependency from generic stub Ard Biesheuvel
2022-09-20 18:35 ` [PATCH v2 7/8] efi: libstub: install boot-time memory map as config table Ard Biesheuvel
2022-09-20 18:35 ` [PATCH v2 8/8] efi/loongarch: libstub: remove dependency on flattened DT Ard Biesheuvel
2022-09-21  4:00   ` Huacai Chen
2022-09-21  8:14     ` Ard Biesheuvel
2022-09-22  2:15       ` Huacai Chen
2022-09-22  7:12         ` Ard Biesheuvel
2022-09-22  7:21           ` Huacai Chen
2022-09-22  7:24             ` Ard Biesheuvel
2022-09-22  7:41               ` Huacai Chen
2022-09-22  8:59                 ` Ard Biesheuvel
2022-09-22 12:07                   ` Huacai Chen
2022-09-22 12:50                     ` Ard Biesheuvel
2022-09-22 12:57                       ` Ard Biesheuvel
2022-09-22 13:08                       ` Huacai Chen
2022-09-22 13:10                         ` Ard Biesheuvel
2022-09-22 13:12                           ` Huacai Chen
2022-09-22 13:18                             ` Ard Biesheuvel
2022-09-22 13:19                               ` Ard Biesheuvel
2022-09-22 13:51                                 ` Ard Biesheuvel
2022-09-22 14:48                                   ` Huacai Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.