From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A522C433EF for ; Wed, 16 Feb 2022 05:15:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344580AbiBPFPK (ORCPT ); Wed, 16 Feb 2022 00:15:10 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238207AbiBPFPK (ORCPT ); Wed, 16 Feb 2022 00:15:10 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D611C27B2D for ; Tue, 15 Feb 2022 21:14:58 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9CEFA113E; Tue, 15 Feb 2022 21:14:58 -0800 (PST) Received: from [10.163.47.182] (unknown [10.163.47.182]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 696843F66F; Tue, 15 Feb 2022 21:14:57 -0800 (PST) Subject: Re: [PATCH] arm64/mm: Drop use_1G_block() To: linux-arm-kernel@lists.infradead.org Cc: Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org References: <1644988012-25455-1-git-send-email-anshuman.khandual@arm.com> From: Anshuman Khandual Message-ID: Date: Wed, 16 Feb 2022 10:44:54 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <1644988012-25455-1-git-send-email-anshuman.khandual@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/16/22 10:36 AM, Anshuman Khandual wrote: > pud_sect_supported() already checks for PUD level block mapping support i.e > on ARM64_4K_PAGES config. Hence pud_sect_supported(), along with some other > required alignment checks can help completely drop use_1G_block(). > > Cc: Catalin Marinas > Cc: Will Deacon > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Anshuman Khandual > --- > This applies on v5.17-rc4 > > arch/arm64/mm/mmu.c | 15 ++------------- > 1 file changed, 2 insertions(+), 13 deletions(-) > > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index acfae9b41cc8..5a7954c9e6ec 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -294,18 +294,6 @@ static void alloc_init_cont_pmd(pud_t *pudp, unsigned long addr, > } while (addr = next, addr != end); > } > > -static inline bool use_1G_block(unsigned long addr, unsigned long next, > - unsigned long phys) > -{ > - if (PAGE_SHIFT != 12) > - return false; > - > - if (((addr | next | phys) & ~PUD_MASK) != 0) > - return false; > - > - return true; > -} > - > static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end, > phys_addr_t phys, pgprot_t prot, > phys_addr_t (*pgtable_alloc)(int), > @@ -338,7 +326,8 @@ static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end, > /* > * For 4K granule only, attempt to put down a 1GB block > */ > - if (use_1G_block(addr, next, phys) && > + if (pud_sect_supported() && > + ((addr | next | phys) & ~PUD_MASK) == 0 && > (flags & NO_BLOCK_MAPPINGS) == 0) { This is now very similar to init_pmd() block mapping check. > pud_set_huge(pudp, phys, prot); > >