From patchwork Wed Feb 17 12:36:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Fleming X-Patchwork-Id: 62103 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp2257625lbl; Wed, 17 Feb 2016 04:38:00 -0800 (PST) X-Received: by 10.66.236.132 with SMTP id uu4mr1710459pac.95.1455712680596; Wed, 17 Feb 2016 04:38:00 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 133si1745976pfa.203.2016.02.17.04.38.00; Wed, 17 Feb 2016 04:38:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=pass header.i=@codeblueprint-co-uk.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422795AbcBQMg3 (ORCPT + 30 others); Wed, 17 Feb 2016 07:36:29 -0500 Received: from mail-wm0-f53.google.com ([74.125.82.53]:36999 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965289AbcBQMgY (ORCPT ); Wed, 17 Feb 2016 07:36:24 -0500 Received: by mail-wm0-f53.google.com with SMTP id g62so26134393wme.0 for ; Wed, 17 Feb 2016 04:36:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeblueprint-co-uk.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DO5WcqS/hgUGoOzhzA3WpFFJsd+586uwTTMuofL2fNQ=; b=kgMwMzNkF15DPItawbddMUtRVw7KI+DKaN1UD2fokeUGiodIJS3yArDkk4E8HNVY6G ASTmgNbhahsOTWShDHZok9B5rVlpO1EeUNSDOTrJDIsSX/x8HCfYcgAMO+7zKTygu0LD thheye4N9Uu7Eax4a1yLX+irysvum0AgzauMqSfP8ZNfMRCJA3mjTymeHAFI8rrnY22T WAUyZHvUvNjZ6bg6EYA2G/KPpgOjdBUz9XT0Oq5pO3UIeFwX34YvlaKauG9iHyTovY1l jxhc+URrCLZ1m0L126TRn46X2TBDO3WqljadPqw5ZBAyvSA6/AhYM1NJm2SWOsoSPDU8 b7Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DO5WcqS/hgUGoOzhzA3WpFFJsd+586uwTTMuofL2fNQ=; b=i7moPRlJzqbccQ/cMj1TJ6r9MFUVyfDTgfk88tszTXQMNtVYdeQtKm0e1/psWPR2TA qzzOYLnf9RQJcVyQhO99lNDosQLLm+0QBnxQKeZYJSRMwhfMXJjYMvuqFvnP8f2aYNhz VxP6KkGDW20hx9ao4iZsF6MX6FVnqHZoFkKkDBH1GQr0ACLzqXdP4l2muHNcDF3OWcFQ KP8KMSJ70V3mM73dcvP/ePfnMvPG0wlhUVy/H2l1qmT/VL54wTLmYdjIFbBsLe+C2gtC 4b3clEIzRGfPBjjHdNucEUjMGc34xEr+MB1nwZ4DndentTyAg75Riqtm2hhC4vnoXmBr N/Pg== X-Gm-Message-State: AG10YOS9CmsXrqmZemMvVws6DVfdg9soy3LCuWQzTDrTgVp/4n/erK4RAIIayPdAxnuhuQ== X-Received: by 10.28.102.69 with SMTP id a66mr21590375wmc.8.1455712583384; Wed, 17 Feb 2016 04:36:23 -0800 (PST) Received: from localhost (5ec16434.skybroadband.com. [94.193.100.52]) by smtp.gmail.com with ESMTPSA id e9sm1314849wja.25.2016.02.17.04.36.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Feb 2016 04:36:22 -0800 (PST) From: Matt Fleming To: Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, Matt Fleming , Jeremy Linton , Mark Rutland Subject: [PATCH 08/13] efi/arm: Check for LPAE support before booting a LPAE kernel Date: Wed, 17 Feb 2016 12:36:01 +0000 Message-Id: <1455712566-16727-9-git-send-email-matt@codeblueprint.co.uk> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1455712566-16727-1-git-send-email-matt@codeblueprint.co.uk> References: <1455712566-16727-1-git-send-email-matt@codeblueprint.co.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ard Biesheuvel A kernel built with support for LPAE cannot boot to a state where it can inform the user about it if it fails 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. Reviewed-by: Jeremy Linton Signed-off-by: Ard Biesheuvel Acked-by: Mark Rutland Signed-off-by: Matt Fleming --- drivers/firmware/efi/libstub/arm32-stub.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) -- 2.6.2 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 #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,