From patchwork Thu Jan 28 17:02:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 60744 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp599006lbb; Thu, 28 Jan 2016 09:04:18 -0800 (PST) X-Received: by 10.98.68.220 with SMTP id m89mr6066799pfi.65.1454000657356; Thu, 28 Jan 2016 09:04:17 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id u16si17924163pfa.225.2016.01.28.09.04.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jan 2016 09:04:17 -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 1aOpyY-0007rW-PT; Thu, 28 Jan 2016 17:03:18 +0000 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aOpyE-0007P2-Uz for linux-arm-kernel@lists.infradead.org; Thu, 28 Jan 2016 17:03:00 +0000 Received: by mail-wm0-x230.google.com with SMTP id p63so33654431wmp.1 for ; Thu, 28 Jan 2016 09:02:38 -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=3jIKra8u9uI7GpuITnr8wPqtypJe8b7Sm65TT0dMNt8=; b=hyyxxOP+nWz7yNopg5/T92/dVmoSlQsPRDleN+lOXEqzlItbHpeg33Ir6W/e24IVR3 S5JQG2NzsRh3/lHCLv/X6GlVg2tGffYq4RkoBWEgXF/3J7qXbOAdO9H1tcVrId6RnurH 0VvCmWjaFWLAOdjR5mqOorCd/qbN4CXrzRXLE= 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=3jIKra8u9uI7GpuITnr8wPqtypJe8b7Sm65TT0dMNt8=; b=k+qq6DaoxNeHzieN0P9e7aiM1XgUtU2YKBn2uZvHJxSrIeEw1t4AQx0dNzAT/oTSai QNybZJ9k9hVlyjkf37jBw0iemtbuiWd/QZQZ2x/XDdhnxXyLdsvhqVBkbU5SsMbZw3LA lRohUzFn9ifG/j3GFgo7QxPN6Se2nQYuJr+YCZu0XD19vsdyA0vTt/oXrgCEpShqA5wv aL2OoamUw9P/X1uHkCtkHKAHFQ0tH0YPIH6sWmirdGdbHDMYyCNEF4fbkjl7zV34waQj PvWbT9W+KuQTzZs9Wouj9CYaKdLTp+eWEHAHp/2d48PG4AV4MBtZ2VBsF1SXrxsLQ/3Y H8RA== X-Gm-Message-State: AG10YOT3K+dsubNBLop6rL5+s8+OxjnjYRHvoOFvoN+oLfUjt0w2SPDFr5eMZrQUeWe1WhMm X-Received: by 10.194.205.5 with SMTP id lc5mr4191064wjc.163.1454000557283; Thu, 28 Jan 2016 09:02:37 -0800 (PST) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id b127sm3709301wmh.9.2016.01.28.09.02.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Jan 2016 09:02:36 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, will.deacon@arm.com, catalin.marinas@arm.com, mark.rutland@arm.com, jeremy.linton@arm.com, Suzuki.Poulose@arm.com Subject: [PATCH 1/3] ARM: efistub: check for LPAE support before booting a LPAE kernel Date: Thu, 28 Jan 2016 18:02:27 +0100 Message-Id: <1454000549-9189-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1454000549-9189-1-git-send-email-ard.biesheuvel@linaro.org> References: <1454000549-9189-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160128_090259_397142_DE22F1AA X-CRM114-Status: GOOD ( 12.35 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:230 listed in] [list.dnswl.org] -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: Ard Biesheuvel , dann.frazier@canonical.com, dhdang@apm.com, leif.lindholm@linaro.org, lho@apm.com, ksankaran@apm.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. Suggested-by: Mark Rutland 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,