diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2020-06-07 15:41:35 +0200 |
---|---|---|
committer | Ard Biesheuvel <ardb@kernel.org> | 2020-06-17 15:29:11 +0200 |
commit | 2a55280a3675203496d302463b941834228b9875 (patch) | |
tree | fdf348d4f9ab6ac68f52c3011900d9a2e9845598 /drivers/firmware/efi/libstub/efi-stub.c | |
parent | efi/libstub: arm: Omit arch specific config table matching array on arm64 (diff) | |
download | linux-2a55280a3675203496d302463b941834228b9875.tar.xz linux-2a55280a3675203496d302463b941834228b9875.zip |
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>
Diffstat (limited to 'drivers/firmware/efi/libstub/efi-stub.c')
-rw-r--r-- | drivers/firmware/efi/libstub/efi-stub.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/firmware/efi/libstub/efi-stub.c b/drivers/firmware/efi/libstub/efi-stub.c index e97370bdfdb0..3318ec3f8e5b 100644 --- a/drivers/firmware/efi/libstub/efi-stub.c +++ b/drivers/firmware/efi/libstub/efi-stub.c @@ -329,6 +329,9 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle, if (status != EFI_SUCCESS) goto fail_free_initrd; + if (IS_ENABLED(CONFIG_ARM)) + efi_handle_post_ebs_state(); + efi_enter_kernel(image_addr, fdt_addr, fdt_totalsize((void *)fdt_addr)); /* not reached */ |