From patchwork Fri Jun 9 07:55:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13273355 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C991C7EE2F for ; Fri, 9 Jun 2023 07:56:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B24498E0009; Fri, 9 Jun 2023 03:56:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AD2608E0001; Fri, 9 Jun 2023 03:56:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 972CE8E0009; Fri, 9 Jun 2023 03:56:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 8B4E38E0001 for ; Fri, 9 Jun 2023 03:56:21 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 5625C8015F for ; Fri, 9 Jun 2023 07:56:21 +0000 (UTC) X-FDA: 80882451762.27.C64C65D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf12.hostedemail.com (Postfix) with ESMTP id 5CDE340017 for ; Fri, 9 Jun 2023 07:56:19 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ild4EO3d; spf=pass (imf12.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686297379; h=from:from:sender: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:dkim-signature; bh=7Tl0uNK3iTFKABiIz7zb0nAC1GuwS9Iddx7rewdSaxU=; b=IBGaPDzJ20O0mQpAJ47vcuOLDxxP4c+UnZ3CcA4gTs779DM56VnVsc21nHwADaXo8GPMJ4 /GWJJci/1XuPUIUco0EYtobgXXZzFxykBu1pflotbdsUsRtkvNPAP6TDz6nqQotGm56G1A Q861IC2hTgIw8Y7+pVrwXLlrnEYW9pM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686297379; a=rsa-sha256; cv=none; b=gGtQmfHvXR4qwfz+uNmPgB+1YZ+YyN26NDHQEdFNYgbBlQ3urdP/6sO1w/kqKxOTYte/wT FO9SWUg21USosoARJejbq8xD5sDj3ZBxKbzhCh6yvUEVCJ3RoFbrOggJ4f04LvIhYq3hr5 8/xOP3820vAB/14ngZRFqOkKRTBslps= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ild4EO3d; spf=pass (imf12.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686297378; 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=7Tl0uNK3iTFKABiIz7zb0nAC1GuwS9Iddx7rewdSaxU=; b=ild4EO3d1vlq0dWCOc/DB13nyc/wkDMpgXLzXiZzl0PiUmGd/zKu3cmnNlEASBsn9YgmoU gYWmGnPtvhhD5Pet6TXhE1rz+kYDnhW2vz0vQfDfeHv32Lna7kTltPiQqORtcXeiWnn4xs zv0xKnrZ4PTKL8TevNAkBpp4s8jdyq8= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-562-XLUSNABUP-uOYtCvZesmAg-1; Fri, 09 Jun 2023 03:56:14 -0400 X-MC-Unique: XLUSNABUP-uOYtCvZesmAg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9E61C384952B; Fri, 9 Jun 2023 07:56:13 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-92.pek2.redhat.com [10.72.12.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2DC1720268C7; Fri, 9 Jun 2023 07:56:07 +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@lst.de, rppt@kernel.org, willy@infradead.org, agordeev@linux.ibm.com, wangkefeng.wang@huawei.com, schnelle@linux.ibm.com, David.Laight@ACULAB.COM, shorne@gmail.com, deller@gmx.de, Baoquan He Subject: [PATCH v6 05/19] mm: ioremap: allow ARCH to have its own ioremap method definition Date: Fri, 9 Jun 2023 15:55:14 +0800 Message-Id: <20230609075528.9390-6-bhe@redhat.com> In-Reply-To: <20230609075528.9390-1-bhe@redhat.com> References: <20230609075528.9390-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Rspamd-Queue-Id: 5CDE340017 X-Rspam-User: X-Stat-Signature: kesaeqed75wu61fowm8ixsgrispn6sew X-Rspamd-Server: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hmOOS8SZ4rF0+1uRgYU0gp8QNCAiCBIuzC+7lqKuyxqL3L5O7JENhtV0uzVu5CXA6PYHVWIrCcAxX2MJCK+gzRc+HgBiHbOE8C5qrWrvskycy7cXoRKlQvcTuVFXZxhkBGqoEqn0So6k5x/GBi9ywR84WSE7TAjoRR8O0ZqZ4xh7K+HraW6qd5ZF6AcnbZh7WBaSUL5+odGfZ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Reviewed-by: Christoph Hellwig Reviewed-by: Kefeng Wang Reviewed-by: Mike Rapoport (IBM) Cc: linux-arch@vger.kernel.org --- 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 a7ca2099ba19..39244c3ee797 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