[PATCH v3 0/7] arm64: efi: leave MMU and caches on at boot

Ard Biesheuvel ardb at kernel.org
Sat Aug 27 08:58:45 PDT 2022


Even though some of the patches in this series made an appearance in my
WXN series as well, this set amounts to a v3 of $SUBJECT, with only the
pieces that remain now that the groundwork has been merged into
v6.0-rc1. The v2 can be found here:
https://lore.kernel.org/all/20220330154205.2483167-1-ardb@kernel.org/

The purpose of this series is to remove any explicit cache maintenance
for coherency during early boot that becomes unnecessary if we simply
retain the cacheable 1:1 mapping of all of system RAM provided by EFI,
and use it to populate the ID map page tables. After setting up this
preliminary ID map, we disable the MMU, drop to EL1, reprogram the MAIR,
TCR and SCTLR registers as before, and proceed as usual, avoiding the
need for any manipulations of memory while the MMU and caches are off.

The only property of the firmware provided 1:1 map we rely on is that it
does not require any explicit cache maintenance for coherency - all else
is under control of the kernel itself, as before.

Ard Biesheuvel (7):
  arm64: lds: reduce effective minimum image alignment to 64k
  arm64: kernel: move ID map out of .text mapping
  arm64: head: record the MMU state at primary entry
  arm64: head: avoid cache invalidation when entering with the MMU on
  arm64: head: clean the ID map page to the PoC
  arm64: efi/libstub: use EFI_LOADER_CODE region when moving the kernel
    in memory
  arm64: efi/libstub: enter with the MMU on

 arch/arm64/include/asm/efi.h               |  7 --
 arch/arm64/kernel/Makefile                 |  9 +--
 arch/arm64/kernel/efi-entry.S              | 69 --------------------
 arch/arm64/kernel/head.S                   | 46 +++++++++++--
 arch/arm64/kernel/image-vars.h             |  6 +-
 arch/arm64/kernel/vmlinux.lds.S            | 13 +++-
 arch/arm64/mm/cache.S                      |  5 +-
 arch/arm64/mm/proc.S                       |  2 -
 drivers/firmware/efi/libstub/alignedmem.c  |  5 +-
 drivers/firmware/efi/libstub/arm64-stub.c  | 26 ++++++--
 drivers/firmware/efi/libstub/efistub.h     |  6 +-
 drivers/firmware/efi/libstub/mem.c         |  3 +-
 drivers/firmware/efi/libstub/randomalloc.c |  5 +-
 include/linux/efi.h                        |  6 +-
 14 files changed, 95 insertions(+), 113 deletions(-)
 delete mode 100644 arch/arm64/kernel/efi-entry.S

-- 
2.35.1




More information about the linux-arm-kernel mailing list