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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 624C6C64EC7 for ; Wed, 1 Mar 2023 03:43:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 015036B0073; Tue, 28 Feb 2023 22:43:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F074C6B0081; Tue, 28 Feb 2023 22:43:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD1A26B0082; Tue, 28 Feb 2023 22:43:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id CE2F56B0073 for ; Tue, 28 Feb 2023 22:43:33 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B1843160D6C for ; Wed, 1 Mar 2023 03:43:33 +0000 (UTC) X-FDA: 80518934706.13.7E8C194 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf23.hostedemail.com (Postfix) with ESMTP id F322B14000E for ; Wed, 1 Mar 2023 03:43:31 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ekTjSgrf; spf=pass (imf23.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677642212; a=rsa-sha256; cv=none; b=7ubcz5dmHXNfAqp72JXv52m3n3DKeFDtlraR0R3cjl3uPZKam+IJSD191K+ePA4f8Vyw3e VeVNU70ZnAQXh0t2IX1VcHo/MdYfXZBKUIz5jzr4m+Cd/t4iO8tMtRK1SAWRhyRC/a0Mqm p3lT4VobVlsviJw0J9FzP8YQREGNjbg= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ekTjSgrf; spf=pass (imf23.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.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=1677642212; 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=KvHGJst0IkvQ0Vuf5Tj32ZIlvLsLevbPi0IYfAk1ZKA=; b=IHRpCntCvv9H0vO4iA3qGRBPNKgBLww/83zsMs9lN7/NMy/ynslrsA+EFOMOAaJNvQT+AI 6qJtdyQLH5DrRZHJEUe0B4Mlz/xbbzT4CwT+rf+4a7joBOqB4S/vKipEu9PhVKntcW16j/ l7lTrn+mlorDkkvJihZHStc+lrie0Q8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677642211; 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=ekTjSgrfQOn2g5oJOIU5qH3583lMLw+cjkZ+huTGKfnl+KcZqxguYSPilXd8SCAZE4oDIZ qC2vcuOm5JAX0TTJJMrel0GEqpFlfVdnCDu+s4nMND4IxrelTr6kfaA8bIOOMEPxpjiGJk YRYe/6ytvN9AZHOru+BjOT9bdUTVwtw= 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 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Rspam-User: X-Rspamd-Queue-Id: F322B14000E X-Rspamd-Server: rspam01 X-Stat-Signature: yqf4o6nbg4cxxy3j555m4j9a77rnjdfu X-HE-Tag: 1677642211-722259 X-HE-Meta: U2FsdGVkX187fInf+dGRV0Px5HbOpMJCSA02nPWOs2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OjrFijgeENjD+/9g0IWWlbvQmKWnd5DAusV6GR0Y3omFa8mkjnxK9nFRhmB3VMBUI2WyU/Q2yGIwqQyfDhStzmGvFtXG9ofOT8atqtH0Y2MscT6h7DegetN/xHKLAgdiRoTjYPOIc08zNHrmAA== 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 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 -- 2.34.1