From patchwork Wed Oct 14 21:13:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 7398741 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 776E99F1B9 for ; Wed, 14 Oct 2015 21:16:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9C968209C6 for ; Wed, 14 Oct 2015 21:16:25 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BA6BE208E8 for ; Wed, 14 Oct 2015 21:16:24 +0000 (UTC) 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 1ZmTNL-0000AM-Cg; Wed, 14 Oct 2015 21:14:19 +0000 Received: from eu-smtp-delivery-143.mimecast.com ([146.101.78.143]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZmTNI-0008UH-6v for linux-arm-kernel@lists.infradead.org; Wed, 14 Oct 2015 21:14:17 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-35-_Xesvy0GTAC1xJKdp7Vh0g-1; Wed, 14 Oct 2015 22:13:51 +0100 Received: from mammon-v1.localdomain ([10.1.2.79]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 14 Oct 2015 22:13:51 +0100 Subject: Re: [PATCHv3 08/11] arm64: Check for selected granule support To: "Suzuki K. Poulose" , linux-arm-kernel@lists.infradead.org References: <1444821634-1689-1-git-send-email-suzuki.poulose@arm.com> <1444821634-1689-9-git-send-email-suzuki.poulose@arm.com> From: Jeremy Linton Message-ID: <561EC58B.9080408@arm.com> Date: Wed, 14 Oct 2015 16:13:47 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <1444821634-1689-9-git-send-email-suzuki.poulose@arm.com> X-OriginalArrivalTime: 14 Oct 2015 21:13:51.0454 (UTC) FILETIME=[399057E0:01D106C5] X-MC-Unique: _Xesvy0GTAC1xJKdp7Vh0g-1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151014_141416_571661_3FCA7BC3 X-CRM114-Status: GOOD ( 12.76 ) X-Spam-Score: -5.2 (-----) 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, steve.capper@linaro.org, ard.biesheuvel@linaro.org, marc.zyngier@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, christoffer.dall@linaro.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 10/14/2015 06:20 AM, Suzuki K. Poulose wrote: > + * Checks if the selected granule size is supported by the CPU. > + * If it doesn't park the CPU The problem is when you park the boot CPU. I think for EFI there is a slightly better error mechanism. This tweak will print an error and return to the EFI boot manager rather than hanging the machine without any notification. Now it prints: EFI stub: Booting Linux Kernel... EFI stub: ERROR: 16K granule not supported by this machine EFI stub: ERROR: Failed to relocate kernel FS4:\> Signed-off-by: Jeremy Linton --- arch/arm64/kernel/efi-stub.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) /* Relocate the image, if required. */ kernel_size = _edata - _text; diff --git a/arch/arm64/kernel/efi-stub.c b/arch/arm64/kernel/efi-stub.c index 816120e..90fb868 100644 --- a/arch/arm64/kernel/efi-stub.c +++ b/arch/arm64/kernel/efi-stub.c @@ -25,6 +25,20 @@ efi_status_t __init handle_kernel_image(efi_system_table_t *sys_table_arg, unsigned long kernel_size, kernel_memsize = 0; unsigned long nr_pages; void *old_image_addr = (void *)*image_addr; + u32 aa64mmfr0_el1; + +#ifdef CONFIG_ARM64_16K_PAGES + /* + * check to see if this kernel image is + * compatible with the current system + */ + asm volatile("mrs %0, ID_AA64MMFR0_EL1" : "=r" (aa64mmfr0_el1)); + aa64mmfr0_el1 >>= ID_AA64MMFR0_TGRAN16_SHIFT; + if ((aa64mmfr0_el1 & ID_AA64MMFR0_TGRAN4_ON) == 0) { + pr_efi_err(sys_table_arg, "16K granule not supported by this machine\n"); + return EFI_UNSUPPORTED; + } +#endif