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: 93993 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6781740vqo; Mon, 15 May 2023 02:25:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7sbVPCjSzEYbz93ruT7ADTsZ/ZOH/WwqZz765dkOIOPQsGw9FwcHjxsCsFn/jZKvMZdmch X-Received: by 2002:a17:902:c945:b0:1a9:546c:1593 with SMTP id i5-20020a170902c94500b001a9546c1593mr42311092pla.14.1684142704587; Mon, 15 May 2023 02:25:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684142704; cv=none; d=google.com; s=arc-20160816; b=Mh/PAS8knEm4OkC8W6zxp9QK1pHBqvpXMN3smKbR4mig9FQjkdIWwqUpGJ510CBs0s 2YsC/Rh359Ykl/imBa+L8EJDxp9YDne1cWrxT8b0zl0ti1EDzcEkkfv0xvKEkFUd9/ZC 6+Aqr4yngIGFH8qaMLfGVK+YcIvum6Tff8b2/YjOIwEDLRNxI4wey+UmWwIQBwHn6bzP MUuYsJPLE/9Bkako5gMvCzGXKeFdL8Dq4O4E1zjfN3tSR3V0jf3ncFPd7gRzl2j8Zp8A E1Ywtck1v6q0xfSc6kfk9DGZMaPR60au7pgVHldZ5qh3ec9EasFr2CTheMRId/64WTls qaow== 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=9r4k6GMEtwaHs0eyrctTCZaY/jYlipAlomuLvm3n9yA=; b=SOYqJr77BPxgmUfbGVu6i/JtYVAlM5K4mwD6Wio5/qpngglgcLZ6cEkGh5bjJ1/1Aa KR523W109Obcn018B766eL11p1wkiatjS5BSgYvuIClPpcPAUIXQT+Mj3Fqi5JlVviRE 9XnvNDySuRfnGz6yGGu0uh+fHHsHdmFW3aXf67fJWYIOff31kHg8vG5ee7FR4tTHBtrX RmSsaTrHpXMfCF10EKJ7tSFfQtzxgW9L8tyOC3mN6o2fSap/SAVE524+V50bBS/1t+qJ W7C9TwCPgFaoOiH2kCRnfOjNNQiv2402JpgRiWkJRJpg7u0YIDl3mGB0aCmvv7AnblBg w//A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DJjIF3KA; 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 c15-20020a170903234f00b001a9baadecc0si15794234plh.160.2023.05.15.02.24.51; Mon, 15 May 2023 02:25:04 -0700 (PDT) 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=DJjIF3KA; 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 S237928AbjEOJLF (ORCPT + 99 others); Mon, 15 May 2023 05:11:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238620AbjEOJK2 (ORCPT ); Mon, 15 May 2023 05:10:28 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CA8FE7D for ; Mon, 15 May 2023 02:09:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684141782; 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=DJjIF3KA+1NNaP+yK5eVWoWBxtrrrR0KH2sGhC7YcUhiWfVANh353u3iU0eU9n/LKPgMEt RCoH7oB2q+kcFuRk3/Ob0+36+2k2nnkO3yXFn1lCr2FNqJ7v/M12sGyLqn6M8/Ma+c/7RT 7YTKUyBDvOm4KGryhXoZmOjfcmAZG/U= 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-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,T_SCC_BODY_TEXT_LINE 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?1765951620381707870?= X-GMAIL-MSGID: =?utf-8?q?1765951620381707870?= 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 --- 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