From patchwork Mon May 15 09:08:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13240986 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 490F9C77B75 for ; Mon, 15 May 2023 09:09:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DDF3A900008; Mon, 15 May 2023 05:09:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D8F7B900002; Mon, 15 May 2023 05:09:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C575A900008; Mon, 15 May 2023 05:09:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id B829D900002 for ; Mon, 15 May 2023 05:09:49 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 45021161387 for ; Mon, 15 May 2023 09:09:48 +0000 (UTC) X-FDA: 80791916856.01.B7EDAFC Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf30.hostedemail.com (Postfix) with ESMTP id 77B2880005 for ; Mon, 15 May 2023 09:09:46 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=AK95B4Z5; spf=pass (imf30.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=1684141786; 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=9r4k6GMEtwaHs0eyrctTCZaY/jYlipAlomuLvm3n9yA=; b=JexgMDuB/Ix87ZivJ7FEPLHaj/rVagbO4QCDNTCEEO3cTN6eQmjA1lSzssofbkl3Z3goxw AcIaBBjBLJwEq7BimHWZ3UFXwPhssEIfaidme65xd68XKUOqSCm4cazd4j9+SgnRqcPTrP 8o64UBSgLkUOFuusOkyhgm3NOkVtrPQ= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=AK95B4Z5; spf=pass (imf30.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684141786; a=rsa-sha256; cv=none; b=uF1F14VeV+MkZ4clyu3oaCr/wvgTjEc/z7jSWLnrItQMJMmQYhIfAZc8dRZhNfKDUGFGQg DQxUGdir2RWyQb2su1kk9IeHVtdf2z3E9xxHwPeFAE5Kr2lr9X7KfBann1mFjvUPMyArXb 2zwM8uiYTgwzTi7+4PGws1vWbZMbra4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684141785; 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=9r4k6GMEtwaHs0eyrctTCZaY/jYlipAlomuLvm3n9yA=; b=AK95B4Z54lT+4iEpABOgnxzt9iq0zsv0fBMdvnjppaIr/jSEey6A+sEhwD2JMtgrwP143e TQy/Zfn8psuwturPiL729rQAq9fpLaVN/H7ka3VOauAgxVaAew7iDXpiNU6FQ8DXEwk8T6 NRRyLiLXFLUcPSSQy1+yQwnhPH7wd+k= 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-198-ytjTTgK7Oim1HJHE23zSuQ-1; Mon, 15 May 2023 05:09:39 -0400 X-MC-Unique: ytjTTgK7Oim1HJHE23zSuQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BFED13C0CF02; Mon, 15 May 2023 09:09:38 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-32.pek2.redhat.com [10.72.12.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 542EA40C2063; Mon, 15 May 2023 09:09:32 +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, deller@gmx.de, Baoquan He Subject: [PATCH v5 RESEND 05/17] mm: ioremap: allow ARCH to have its own ioremap method definition Date: Mon, 15 May 2023 17:08:36 +0800 Message-Id: <20230515090848.833045-6-bhe@redhat.com> In-Reply-To: <20230515090848.833045-1-bhe@redhat.com> References: <20230515090848.833045-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Stat-Signature: igis53bgf4turwnnrm8ah3xogniio13x X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 77B2880005 X-Rspam-User: X-HE-Tag: 1684141786-233916 X-HE-Meta: U2Fs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tz0CDet4sg5nqRsihX9MK3hyj+FFqgmSL8yfXWntRAka8t5Kv6Scb0nFkgRUHKptOUF1KYA/78Tg9eidtjaoH+Q5FLNJbG+r+jrRT+Z8++wPngWsU0Enq74OWQryT5qYNm9caG8+y0SnFKbqwm7BLSHZ+J1D1V1LyDjPlu 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 Reviewed-by: Mike Rapoport (IBM) Reviewed-by: Christoph Hellwig Reviewed-by: 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 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