Skip to content

arm64: efi: boot with MMU and caches on if possible

Ard Biesheuvel linux-arm-kernel 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6arm64: lds: reduce effective minimum image alignment to 64karch/arm64/include/asm/efi.h arch/arm64/kernel/head.S arch/arm64/kernel/vmlinux.lds.S +2 more+15 -140 replies
2/6arm64: kernel: move ID map out of .text mappingarch/arm64/kernel/head.S arch/arm64/kernel/vmlinux.lds.S arch/arm64/mm/proc.S+5 -40 replies
3/6arm64: head: record the MMU state at primary entryarch/arm64/kernel/head.S+16 -00 replies
4/6arm64: head: avoid cache invalidation when entering with the MMU onarch/arm64/kernel/head.S+5 -20 replies
5/6arm64: head: clean the ID map page to the PoCarch/arm64/kernel/head.S+13 -10 replies
6/6arm64: efi/libstub: enter with the MMU on if executing in placearch/arm64/kernel/efi-entry.S+4 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/6] arm64: efi: boot with MMU and caches on if possible

This small series is what remains now that much of the prerequisite changes that are shared with other work have landed. This is a follow-up to [0], and implements the necessary changes that allow the EFI stub to enter the kernel proper with MMU and caches enabled.

This is possible because the EFI spec mandates that all of memory is mapped, and so we can rely on this mapping to set up the initial ID map, instead of taking down the MMU first, and populating those page tables using non-cacheable accesses that require special care in terms of cache coherency. This also means that there is no need to clean the executable image to the point of coherency (with the exception of the contents of .idmap.text, which contains the code that switches from the firmware's ID map to the kernel one)

Given that the image will typically be mapped by the firmware according to the section descriptors in the PE/COFF header (R-X for .text and .rodata, RW- for .data and .bss), this also has a slight robustness advantage.

Note that this does not update the documented boot protocol [yet], although any loader could take advantage of this, and load the kernel image at any 64k aligned physical offset, and enter the image with the MMU still enabled, either at EL2 or EL1.

[0] https://lore.kernel.org/linux-arm-kernel/[email protected]/

Cc Will Deacon <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Pierre-Clément Tosi <[email protected]>
Cc Quentin Perret <[email protected]>
Cc Mark Rutland <[email protected]>

Ard Biesheuvel (6):
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: enter with the MMU on if executing in place

 arch/arm64/include/asm/efi.h              |  7 ---
 arch/arm64/kernel/efi-entry.S             |  4 ++
 arch/arm64/kernel/head.S                  | 45 ++++++++++++++++++--
 arch/arm64/kernel/vmlinux.lds.S           | 13 +++++-
 arch/arm64/mm/proc.S                      |  2 -
 drivers/firmware/efi/libstub/arm64-stub.c |  2 +-
 include/linux/efi.h                       |  6 +--
 7 files changed, 58 insertions(+), 21 deletions(-)
Signature · 7 lines
2.35.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel