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 2115CC77B7A for ; Tue, 16 May 2023 07:02:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230427AbjEPHCX (ORCPT ); Tue, 16 May 2023 03:02:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230395AbjEPHCU (ORCPT ); Tue, 16 May 2023 03:02:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A7213C26; Tue, 16 May 2023 00:02:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B457B6354D; Tue, 16 May 2023 07:02:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2488C433EF; Tue, 16 May 2023 07:02:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684220537; bh=0oIdahxmDcks/2I2njxfN/C39E1GVYEqbwY+cPgU10U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lFWmtz+SVS8WKz6sXrGBaXts2fFXA+qshSS6blyCsJR6AqF7t0JOZgPVjyZSO6eLh gYGpj9NwRda+r4uaUo8fMKUvO84rzoo13pa2Ybxj5USHpSSKfxnhQblW8rkf2uiJ/y A0i0hdXKjG4H2DZY6LEqn+GBz7IQEdNiPv76r5/pvKryx2xdx6QizqQadPDdbe2srD XSRmH7K7f7rPVqroJe/wonig8z2ryl/UkWBJZxaAMGJhGMZ5uUwgPswVzHf08f02Cr PiUHfAWBeEvECflYTrM4I0vE0ipunJt0ENiq1Lu/T867LZ5X+c7n8rsEjfi1ftEyAB 0QrjywtKuLnsA== Date: Tue, 16 May 2023 10:02:08 +0300 From: Mike Rapoport To: Baoquan He Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, arnd@arndb.de, christophe.leroy@csgroup.eu, hch@infradead.org, agordeev@linux.ibm.com, wangkefeng.wang@huawei.com, schnelle@linux.ibm.com, David.Laight@aculab.com, shorne@gmail.com, willy@infradead.org, deller@gmx.de, Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v5 RESEND 16/17] arm64 : mm: add wrapper function ioremap_prot() Message-ID: References: <20230515090848.833045-1-bhe@redhat.com> <20230515090848.833045-17-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230515090848.833045-17-bhe@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org On Mon, May 15, 2023 at 05:08:47PM +0800, Baoquan He wrote: > Since hook functions ioremap_allowed() and iounmap_allowed() will be > obsoleted, add wrapper function ioremap_prot() to contain the > the specific handling in addition to generic_ioremap_prot() invocation. > > Signed-off-by: Baoquan He > Cc: Catalin Marinas > Cc: Will Deacon > Cc: linux-arm-kernel@lists.infradead.org Reviewed-by: Mike Rapoport (IBM) > --- > arch/arm64/include/asm/io.h | 3 +-- > arch/arm64/mm/ioremap.c | 10 ++++++---- > 2 files changed, 7 insertions(+), 6 deletions(-) > > diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h > index 877495a0fd0c..97dd4ff1253b 100644 > --- a/arch/arm64/include/asm/io.h > +++ b/arch/arm64/include/asm/io.h > @@ -139,8 +139,7 @@ extern void __memset_io(volatile void __iomem *, int, size_t); > * I/O memory mapping functions. > */ > > -bool ioremap_allowed(phys_addr_t phys_addr, size_t size, unsigned long prot); > -#define ioremap_allowed ioremap_allowed > +#define ioremap_prot ioremap_prot > > #define _PAGE_IOREMAP PROT_DEVICE_nGnRE > > diff --git a/arch/arm64/mm/ioremap.c b/arch/arm64/mm/ioremap.c > index c5af103d4ad4..269f2f63ab7d 100644 > --- a/arch/arm64/mm/ioremap.c > +++ b/arch/arm64/mm/ioremap.c > @@ -3,20 +3,22 @@ > #include > #include > > -bool ioremap_allowed(phys_addr_t phys_addr, size_t size, unsigned long prot) > +void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size, > + unsigned long prot) > { > unsigned long last_addr = phys_addr + size - 1; > > /* Don't allow outside PHYS_MASK */ > if (last_addr & ~PHYS_MASK) > - return false; > + return NULL; > > /* Don't allow RAM to be mapped. */ > if (WARN_ON(pfn_is_map_memory(__phys_to_pfn(phys_addr)))) > - return false; > + return NULL; > > - return true; > + return generic_ioremap_prot(phys_addr, size, __pgprot(prot)); > } > +EXPORT_SYMBOL(ioremap_prot); > > /* > * Must be called after early_fixmap_init > -- > 2.34.1 > > -- Sincerely yours, Mike.