From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752041AbcBWJ0C (ORCPT ); Tue, 23 Feb 2016 04:26:02 -0500 Received: from terminus.zytor.com ([198.137.202.10]:57980 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754223AbcBWJJl (ORCPT ); Tue, 23 Feb 2016 04:09:41 -0500 Date: Mon, 22 Feb 2016 04:15:43 -0800 From: =?UTF-8?B?dGlwLWJvdCBmb3IgQXJkIEJpZXNoZXV2ZWwgPHRpcGJvdEB6eXRvci5jb20+?=@zytor.com Message-ID: Cc: matt@codeblueprint.co.uk, linux-kernel@vger.kernel.org, tglx@linutronix.de, hpa@zytor.com, jeremy.linton@arm.com, mark.rutland@arm.com, torvalds@linux-foundation.org, peterz@infradead.org, ard.biesheuvel@linaro.org, mingo@kernel.org Reply-To: torvalds@linux-foundation.org, jeremy.linton@arm.com, mark.rutland@arm.com, tglx@linutronix.de, hpa@zytor.com, matt@codeblueprint.co.uk, linux-kernel@vger.kernel.org, peterz@infradead.org, ard.biesheuvel@linaro.org, mingo@kernel.org In-Reply-To: <1455712566-16727-9-git-send-email-matt@codeblueprint.co.uk> References: <1455712566-16727-9-git-send-email-matt@codeblueprint.co.uk> To: =?UTF-8?B?bGludXgtdGlwLWNvbW1pdHNAdmdlci5rZXJuZWwub3Jn?=@zytor.com Subject: =?UTF-8?B?W3RpcDplZmkvY29yZV0gZWZpL2FybTogQ2hlY2sgZm9yIExQQUUgc3VwcG9ydCA=?= =?UTF-8?B?YmVmb3JlIGJvb3RpbmcgYSBMUEFFIGtlcm5lbA==?= Git-Commit-ID: =?UTF-8?B?MmVjMGYwYTNhNGJmYWI5MGVkYThiODE2NTZmNjJlMDdhYmYyMzIxZg==?= X-Mailer: =?UTF-8?B?dGlwLWdpdC1sb2ctZGFlbW9u?= Robot-ID: =?UTF-8?B?PHRpcC1ib3QuZ2l0Lmtlcm5lbC5vcmc+?= Robot-Unsubscribe: =?UTF-8?B?Q29udGFjdCA8bWFpbHRvOmhwYUBrZXJuZWwub3JnPiB0byBnZXQgYmxhY2tsaXM=?= =?UTF-8?B?dGVkIGZyb20gdGhlc2UgZW1haWxz?= MIME-Version: =?UTF-8?B?MS4w?= Content-Transfer-Encoding: =?UTF-8?B?OGJpdA==?= Content-Type: =?UTF-8?B?dGV4dC9wbGFpbjsgY2hhcnNldD1VVEYtOA==?= Content-Disposition: =?UTF-8?B?aW5saW5l?= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 2ec0f0a3a4bfab90eda8b81656f62e07abf2321f Gitweb: http://git.kernel.org/tip/2ec0f0a3a4bfab90eda8b81656f62e07abf2321f Author: Ard Biesheuvel AuthorDate: Wed, 17 Feb 2016 12:36:01 +0000 Committer: Ingo Molnar CommitDate: Mon, 22 Feb 2016 08:26:27 +0100 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 Signed-off-by: Matt Fleming Reviewed-by: Jeremy Linton Acked-by: Mark Rutland Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner 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 --- drivers/firmware/efi/libstub/arm32-stub.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/firmware/efi/libstub/arm32-stub.c b/drivers/firmware/efi/libstub/arm32-stub.c index 495ebd6..6f42be4 100644 --- a/drivers/firmware/efi/libstub/arm32-stub.c +++ b/drivers/firmware/efi/libstub/arm32-stub.c @@ -9,6 +9,23 @@ #include #include +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,