diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2016-02-17 12:36:01 +0000 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-02-22 08:26:27 +0100 |
commit | 2ec0f0a3a4bfab90eda8b81656f62e07abf2321f (patch) | |
tree | ae303e5cd8d7906dab60de470e030658ff36ffac /drivers/firmware | |
parent | 2eec5dedf770dc85c1fdf6b86873165e61bb1fff (diff) | |
download | linux-stable-2ec0f0a3a4bfab90eda8b81656f62e07abf2321f.tar.gz linux-stable-2ec0f0a3a4bfab90eda8b81656f62e07abf2321f.tar.bz2 linux-stable-2ec0f0a3a4bfab90eda8b81656f62e07abf2321f.zip |
efi/arm: Check for LPAE support before booting a LPAE kernel
A kernel built with support for LPAE cannot boot to a state where it
can inform the user about if it has to fail due to missing LPAE support
in the hardware.
If we happen to be booting via UEFI, we can fail gracefully so check
for LPAE support in the hardware on CONFIG_ARM_LPAE builds before
entering the kernel proper.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Reviewed-by: Jeremy Linton <jeremy.linton@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/1455712566-16727-9-git-send-email-matt@codeblueprint.co.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/firmware')
-rw-r--r-- | drivers/firmware/efi/libstub/arm32-stub.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/firmware/efi/libstub/arm32-stub.c b/drivers/firmware/efi/libstub/arm32-stub.c index 495ebd657e38..6f42be4d0084 100644 --- a/drivers/firmware/efi/libstub/arm32-stub.c +++ b/drivers/firmware/efi/libstub/arm32-stub.c @@ -9,6 +9,23 @@ #include <linux/efi.h> #include <asm/efi.h> +efi_status_t check_platform_features(efi_system_table_t *sys_table_arg) +{ + int block; + + /* non-LPAE kernels can run anywhere */ + if (!IS_ENABLED(CONFIG_ARM_LPAE)) + return EFI_SUCCESS; + + /* LPAE kernels need compatible hardware */ + block = cpuid_feature_extract(CPUID_EXT_MMFR0, 0); + if (block < 5) { + pr_efi_err(sys_table_arg, "This LPAE kernel is not supported by your CPU\n"); + return EFI_UNSUPPORTED; + } + return EFI_SUCCESS; +} + efi_status_t handle_kernel_image(efi_system_table_t *sys_table, unsigned long *image_addr, unsigned long *image_size, |