From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753388AbbJOOsF (ORCPT ); Thu, 15 Oct 2015 10:48:05 -0400 Received: from eu-smtp-delivery-143.mimecast.com ([146.101.78.143]:49967 "EHLO eu-smtp-delivery-143.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751782AbbJOOsC convert rfc822-to-8bit (ORCPT ); Thu, 15 Oct 2015 10:48:02 -0400 Subject: Re: [PATCHv3 08/11] arm64: Check for selected granule support To: "Suzuki K. Poulose" , Mark Rutland References: <1444821634-1689-1-git-send-email-suzuki.poulose@arm.com> <1444821634-1689-9-git-send-email-suzuki.poulose@arm.com> <561EC58B.9080408@arm.com> <20151015104515.GE8825@leverpostej> <20151015112532.GA16125@e106634-lin.cambridge.arm.com> Cc: linux-arm-kernel@lists.infradead.org, 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: <561FBC99.9090501@arm.com> Date: Thu, 15 Oct 2015 09:47:53 -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: <20151015112532.GA16125@e106634-lin.cambridge.arm.com> X-OriginalArrivalTime: 15 Oct 2015 14:47:57.0858 (UTC) FILETIME=[7B5BB820:01D10758] X-MC-Unique: fa__FyWYTdOd3BXywQre6g-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/15/2015 06:25 AM, Suzuki K. Poulose wrote: > + /* > + * Check to see if the CPU supports the requested pagesize > + */ > + asm volatile("mrs %0, ID_AA64MMFR0_EL1" : "=r" (aa64mmfr0_el1)); > + aa64mmfr0_el1 >>= ID_AA64MMFR0_TGRAN_SHIFT; > + if ((aa64mmfr0_el1 & 0xf) != ID_AA64MMFR0_TGRAN_SUPPORTED) { > + pr_efi_err(sys_table_arg, PAGE_SIZE_STR" granule not supported by the CPU\n"); > + return EFI_UNSUPPORTED; > + } This is definitely an improvement over my original hack job. I would like to add, that I actually think this should be in a new function "check_kernel_compatibility" (or whatever) that is called before handle_kernel_image. That is because I don't really think it belongs in handle_kernel_image which is focused on relocation. Plus, if you add another function, you can avoid the "Failed to relocate kernel" error that comes out following the granule not supported message. Further, checks like this in the future will have a place to live. Of course you will then need a matching stubbed out function for the normal arm kernel as well. Thanks,