From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754680AbbJNVOT (ORCPT ); Wed, 14 Oct 2015 17:14:19 -0400 Received: from eu-smtp-delivery-143.mimecast.com ([146.101.78.143]:49857 "EHLO eu-smtp-delivery-143.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754557AbbJNVNz convert rfc822-to-8bit (ORCPT ); Wed, 14 Oct 2015 17:13:55 -0400 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> 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 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 Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(+) 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 /* Relocate the image, if required. */ kernel_size = _edata - _text; -- 2.4.3