From patchwork Thu Feb 4 15:50:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 61205 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp536638lbl; Thu, 4 Feb 2016 07:53:39 -0800 (PST) X-Received: by 10.66.90.133 with SMTP id bw5mr11840181pab.22.1454601218852; Thu, 04 Feb 2016 07:53:38 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id g12si17464419pfj.135.2016.02.04.07.53.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Feb 2016 07:53:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aRMCs-0005Pt-Cd; Thu, 04 Feb 2016 15:52:30 +0000 Received: from casper.infradead.org ([85.118.1.10]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aRMCn-0005Jt-Hh for linux-arm-kernel@bombadil.infradead.org; Thu, 04 Feb 2016 15:52:25 +0000 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]) by casper.infradead.org with esmtps (Exim 4.85 #2 (Red Hat Linux)) id 1aRMBW-0008F5-SW for linux-arm-kernel@lists.infradead.org; Thu, 04 Feb 2016 15:51:08 +0000 Received: by mail-wm0-x229.google.com with SMTP id g62so10741780wme.0 for ; Thu, 04 Feb 2016 07:50:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AONzgZxCkwosL4uXjTfiwYvfwWmaiVjQ2mhHbNfYjps=; b=iVDZgfP4L/A0L2mc8BnuT9/HNiMLEtzi9QjPz+9tcB0s+SMr9MF944jUbxaItB3/Ba LGgG3qEelMgYHwWewFW3eJdQR6FJO8zJS6r17si5WxjfCORtUor7iHzdBX46vNpqBQsz xR7o1eaFRZhI2bQVW2mBFz6IUSmRrf0nHj8AM= 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=AONzgZxCkwosL4uXjTfiwYvfwWmaiVjQ2mhHbNfYjps=; b=AkF2vWBLGbM13qhSorVHnNc0RK4SeNGMjSZxeTcIbXcoP66TTMgMf0pYn99GQaSoAs 4VUNH4FxkymNVQ/84mpHkQxkft7uQavV+UgQi19HiuAdmPaSRrOZew9W7NMfpftaJUwN AXbi0RvURFF1bWXISH+dG5FOZsCfqFQlk3idJphcz7pBxkUP8Ph0gQE9TqfiJkXYR3lq 30cJPQtuHWFRFuMWU/QNw01pDGV44vvmE6YFrj4FZE1OxbJHL5OpQ+TiGAV82d6astHi Y8xWLWJmDiNjY8eLi4MMf3M2CAAf6JDmboVI8BItFG5z22ux4h23XTehbBmb1Rx53nad qrMw== X-Gm-Message-State: AG10YOSPTKzFxg67LzDX80evpx1R+Qx1qxUnOZBM5ZUaA8zmoCz5oFGEfBi41lCssDKRilIm X-Received: by 10.194.200.106 with SMTP id jr10mr9893946wjc.100.1454601045555; Thu, 04 Feb 2016 07:50:45 -0800 (PST) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id q73sm26885838wmb.1.2016.02.04.07.50.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Feb 2016 07:50:44 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, matt@codeblueprint.co.uk, catalin.marinas@arm.com Subject: [PATCH v2 5/7] ARM: efistub: check for LPAE support before booting a LPAE kernel Date: Thu, 4 Feb 2016 16:50:28 +0100 Message-Id: <1454601030-9093-6-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1454601030-9093-1-git-send-email-ard.biesheuvel@linaro.org> References: <1454601030-9093-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160204_155107_030327_85745CC4 X-CRM114-Status: GOOD ( 13.86 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.0 on casper.infradead.org summary: Content analysis details: (-2.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, Ard Biesheuvel , will.deacon@arm.com, jeremy.linton@arm.com, suzuki.poulose@arm.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org 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 --- drivers/firmware/efi/libstub/arm32-stub.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) -- 2.5.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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,