linux/drivers/firmware/efi/libstub
Ard Biesheuvel 2a55280a36 efi/libstub: arm: Print CPU boot mode and MMU state at boot
On 32-bit ARM, we may boot at HYP mode, or with the MMU and caches off
(or both), even though the EFI spec does not actually support this.
While booting at HYP mode is something we might tolerate, fiddling
with the caches is a more serious issue, as disabling the caches is
tricky to do safely from C code, and running without the Dcache makes
it impossible to support unaligned memory accesses, which is another
explicit requirement imposed by the EFI spec.

So take note of the CPU mode and MMU state in the EFI stub diagnostic
output so that we can easily diagnose any issues that may arise from
this. E.g.,

  EFI stub: Entering in SVC mode with MMU enabled

Also, capture the CPSR and SCTLR system register values at EFI stub
entry, and after ExitBootServices() returns, and check whether the
MMU and Dcache were disabled at any point. If this is the case, a
diagnostic message like the following will be emitted:

  efi: [Firmware Bug]: EFI stub was entered with MMU and Dcache disabled, please fix your firmware!
  efi: CPSR at EFI stub entry        : 0x600001d3
  efi: SCTLR at EFI stub entry       : 0x00c51838
  efi: CPSR after ExitBootServices() : 0x600001d3
  efi: SCTLR after ExitBootServices(): 0x00c50838

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
2020-06-17 15:29:11 +02:00
..
alignedmem.c efi/libstub: Add API function to allocate aligned memory 2020-04-24 14:52:16 +02:00
arm32-stub.c efi/libstub: arm: Print CPU boot mode and MMU state at boot 2020-06-17 15:29:11 +02:00
arm64-stub.c efi/libstub: Move pr_efi/pr_efi_err into efi namespace 2020-05-01 09:40:02 +02:00
efi-stub-helper.c efi/libstub: Descriptions for stub helper functions 2020-06-16 11:01:07 +02:00
efi-stub.c efi/libstub: arm: Print CPU boot mode and MMU state at boot 2020-06-17 15:29:11 +02:00
efistub.h efi/libstub: arm: Print CPU boot mode and MMU state at boot 2020-06-17 15:29:11 +02:00
fdt.c efi/libstub: Move pr_efi/pr_efi_err into efi namespace 2020-05-01 09:40:02 +02:00
file.c efi/libstub: Fix path separator regression 2020-06-15 19:43:59 +02:00
gop.c efi/gop: Add an option to list out the available GOP modes 2020-05-20 19:09:20 +02:00
hidden.h efi/libstub: Use hidden visibility for all source files 2020-02-23 21:57:12 +01:00
Makefile efi/x86: Fix build with gcc 4 2020-06-15 11:41:14 +02:00
mem.c Linux 5.7-rc7 2020-05-25 15:10:37 +02:00
pci.c efi/libstub: Correct comment typos 2020-05-06 11:27:55 +02:00
random.c efi/libstub: Describe RNG functions 2020-02-23 21:57:19 +01:00
randomalloc.c efi/libstub/random: Increase random alloc granularity 2020-04-23 20:15:06 +02:00
relocate.c efi/libstub: Correct comment typos 2020-05-06 11:27:55 +02:00
secureboot.c efi/libstub: Move pr_efi/pr_efi_err into efi namespace 2020-05-01 09:40:02 +02:00
skip_spaces.c efi/libstub: Fix missing-prototype warning for skip_spaces() 2020-06-15 19:43:58 +02:00
string.c efi/libstub: Clean up command line parsing routine 2020-02-23 21:57:15 +01:00
tpm.c More EFI changes for v5.8: 2020-05-25 15:11:14 +02:00
vsprintf.c efi/printf: Add support for wchar_t (UTF-16) 2020-05-20 19:09:20 +02:00
x86-stub.c efi/x86: Don't blow away existing initrd 2020-05-28 14:18:43 +02:00