On 32-bit ARM, we may boot at HYP mode, or with the MMU and caches off (or both), even though the EFI spec actually does not support this. Take note of this in the EFI stub diagnostic output so that we can easily see whether this is the case or not. Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx> --- drivers/firmware/efi/libstub/arm32-stub.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/firmware/efi/libstub/arm32-stub.c b/drivers/firmware/efi/libstub/arm32-stub.c index 40243f524556..659aaa5003a2 100644 --- a/drivers/firmware/efi/libstub/arm32-stub.c +++ b/drivers/firmware/efi/libstub/arm32-stub.c @@ -9,8 +9,19 @@ efi_status_t check_platform_features(void) { + u32 cpsr, sctlr; int block; + asm("mrs %0, cpsr" : "=r"(cpsr)); + if ((cpsr & MODE_MASK) == HYP_MODE) + asm("mrc p15, 4, %0, c1, c0, 0" : "=r"(sctlr)); + else + asm("mrc p15, 0, %0, c1, c0, 0" : "=r"(sctlr)); + + efi_info("Running in %s mode with MMU %sabled\n", + ((cpsr & MODE_MASK) == HYP_MODE) ? "HYP" : "SVC", + (sctlr & 1) ? "en" : "dis"); + /* non-LPAE kernels can run anywhere */ if (!IS_ENABLED(CONFIG_ARM_LPAE)) return EFI_SUCCESS; -- 2.26.2