From patchwork Wed Mar 1 03:42:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 62748 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3410919wrd; Tue, 28 Feb 2023 19:47:24 -0800 (PST) X-Google-Smtp-Source: AK7set88+wXtUF0zICMRebrMIKbRnevFJlFN6/LI9Lj4drW+tPEz8gx/3kcawRPUYqpNgUQNO8Rn X-Received: by 2002:a17:90b:4a0a:b0:237:f018:6433 with SMTP id kk10-20020a17090b4a0a00b00237f0186433mr5547783pjb.27.1677642444006; Tue, 28 Feb 2023 19:47:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677642443; cv=none; d=google.com; s=arc-20160816; b=pcbcKXRwurWTQH1heVqGKGdInNYOjAs49JfWyH5fnC15H2aTIlWR0Kd5sqXlox7g4i gqsW/BnpCD5a1nSu5ejfBr6nVFD4H/axxfO6XdtnSeuArha05WxqnCvienjxgiwNAxfm o8Z6moCb1GkEN2c1SsiwDtU6oMBdeUpUsnQ9FZTzey1yY1nw7IffMViUYjQX0QW2+Iic ej9Mz+xmn3FfL5aR1fku6LmBiAsEVX15okh5kT37xrHVPGYUznxVbcpAi5ZhNx4uPf1p VYUxdJs+DHnkI55sBxPP3D/SEgIFjyUzI8ynh9+N2qMhv+q01N1ME9100FTt17bYMmI9 Y60w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KvHGJst0IkvQ0Vuf5Tj32ZIlvLsLevbPi0IYfAk1ZKA=; b=A8KFoATVEa9s6Geg6p3vkC4NQtZT/NtvWxo64SP/S5c+qnakDTEfioTkHEerL8ks6z 7nooxPsBgZyJ6de9sNFIphh/gtZ6ebk/daYeL/9SCZmmAqbWWkgEvWiycf0DdboGtBBZ V3osVo0jqN3D/jiI+zIxUf1SxMsTtCOPLaJ9eWZXs9XTxkO71OoOfhV1sRnk+/dTNtAU vFGQF5mLTfg5tRUW45NZk4td4B/sk8JFiqit2hV+VnupuqKrQoqw3yw/Ozfv4pOPtQ2P 9GY+9wEeihqSuPoXiB25zY5fYF9/tHlv2T5t5xL/WKSontYddxTE8dGo+221Ddu73TZq ds8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HFa3+zQb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b24-20020a17090a8c9800b0023310de2d8esi15277553pjo.7.2023.02.28.19.47.10; Tue, 28 Feb 2023 19:47:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HFa3+zQb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229876AbjCADoi (ORCPT + 99 others); Tue, 28 Feb 2023 22:44:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229659AbjCADoZ (ORCPT ); Tue, 28 Feb 2023 22:44:25 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08BCB30E92 for ; Tue, 28 Feb 2023 19:43:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677642212; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KvHGJst0IkvQ0Vuf5Tj32ZIlvLsLevbPi0IYfAk1ZKA=; b=HFa3+zQb+YACnaXY8aJQxlR5eUnrxXUmr1IwcrFPIadaJrOyxnbPsZEqjJwZmtLA2OWqIJ etUkV53ogY+JWHP+5LM/LJAmHy2ylIkWgIeQlZ2T0Z2lhCluJyIfAQdi7x1yzNczr0qjui rsVRrI26BzTNAVsssiTI6nKMu9apzd8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-423-zqkofzQROHm8mYaPK5jd-A-1; Tue, 28 Feb 2023 22:43:29 -0500 X-MC-Unique: zqkofzQROHm8mYaPK5jd-A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 46E2E87B2A2; Wed, 1 Mar 2023 03:43:28 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-13-180.pek2.redhat.com [10.72.13.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD46CC15BAD; Wed, 1 Mar 2023 03:43:23 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: 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, Baoquan He Subject: [PATCH v5 05/17] mm: ioremap: allow ARCH to have its own ioremap method definition Date: Wed, 1 Mar 2023 11:42:35 +0800 Message-Id: <20230301034247.136007-6-bhe@redhat.com> In-Reply-To: <20230301034247.136007-1-bhe@redhat.com> References: <20230301034247.136007-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759135603476948493?= X-GMAIL-MSGID: =?utf-8?q?1759135603476948493?= Architectures can be converted to GENERIC_IOREMAP, to take standard ioremap_xxx() and iounmap() way. But some ARCH-es could have specific handling for ioremap_prot(), ioremap() and iounmap(), than standard methods. In oder to convert these ARCH-es to take GENERIC_IOREMAP method, allow these architecutres to have their own ioremap_prot(), ioremap() and iounmap() definitions. Signed-off-by: Baoquan He Acked-by: Arnd Bergmann Cc: linux-arch@vger.kernel.org Cc: Kefeng Wang --- include/asm-generic/io.h | 3 +++ mm/ioremap.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index 5a9cf16ee0c2..29ee791164ac 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -1081,11 +1081,14 @@ void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size, void iounmap(volatile void __iomem *addr); void generic_iounmap(volatile void __iomem *addr); +#ifndef ioremap +#define ioremap ioremap static inline void __iomem *ioremap(phys_addr_t addr, size_t size) { /* _PAGE_IOREMAP needs to be supplied by the architecture */ return ioremap_prot(addr, size, _PAGE_IOREMAP); } +#endif #endif /* !CONFIG_MMU || CONFIG_GENERIC_IOREMAP */ #ifndef ioremap_wc diff --git a/mm/ioremap.c b/mm/ioremap.c index db6234b9db59..9f34a8f90b58 100644 --- a/mm/ioremap.c +++ b/mm/ioremap.c @@ -46,12 +46,14 @@ void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size, return (void __iomem *)(vaddr + offset); } +#ifndef ioremap_prot void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size, unsigned long prot) { return generic_ioremap_prot(phys_addr, size, __pgprot(prot)); } EXPORT_SYMBOL(ioremap_prot); +#endif void generic_iounmap(volatile void __iomem *addr) { @@ -64,8 +66,10 @@ void generic_iounmap(volatile void __iomem *addr) vunmap(vaddr); } +#ifndef iounmap void iounmap(volatile void __iomem *addr) { generic_iounmap(addr); } EXPORT_SYMBOL(iounmap); +#endif