Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp7801915rwd; Tue, 20 Jun 2023 06:30:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7VdoVSKxLBoweGdVI671qlCKP27vwJBzpmrsk0fjNyWiWqKneL68fHILmvhdWAIgr24jP+ X-Received: by 2002:a17:903:120e:b0:1ae:8b4b:327d with SMTP id l14-20020a170903120e00b001ae8b4b327dmr9537385plh.42.1687267814585; Tue, 20 Jun 2023 06:30:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687267814; cv=none; d=google.com; s=arc-20160816; b=ZJ2BPG2+Uy4wvILRcvflkzPrKwifAvgPwjXcgs64tf06AV3u4/KIk0DWfMGjrBbzXs qoY0rbqXyFbFN3qBHokiSG/D94lfNz3EFNkGNZ5mXLf4jM7FkGDLZgvTyuoRuyNTRnBO 3fvdD48dm82gRCtZKVrc8JB7BpJanlJnqSN5EC6AnjkOTlDiCInGeOGjrIl+yWdA+M8g ysmsHgSQrZEvPqCb5zMa+JAmo3f7eKQyCUL9vzfWET7UVLsQJe41FPaBR5wmQb3AUkTU LhgAeQ8HAhpi3NmTMjuqwKtsGD/7tigXU1ihwuOTsi97JlCzHxnM+qO26GsJyeE8+S/G 413w== 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=7Tl0uNK3iTFKABiIz7zb0nAC1GuwS9Iddx7rewdSaxU=; b=qb0xpDihTz+1EFL9TlItv9fT1xbVrC9IT/SO8HfB66PB4e3OGWPBqk4ZFA/7VkItQn jVZuvirm36HLTMbSkxeXBX1kyqeASCYB2dKMXrECSh3C19r/W/eTsWwq/AjAve/za8FG gARbat8D6zZS27rtICFY1ZLaOLmKGwcxv9fYBCJ9DY7HIF4HKzfFYrxv5gRbWVIMjptR nlle9aKLn6nJPv6Ix6nFJStHYRKQHzoujcr923NIs6ckoeWgREqs/tMBgMIXzq6mv1yK ySx2GYyzrIIuN26Exi++mOW9vpvU+dTsXVtffJLSRzZAmzcdhdXHvtOjv+Ceuxq1dgY6 dNUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TI2MeI7d; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r13-20020a170902c7cd00b001b540c128bbsi1814023pla.308.2023.06.20.06.30.01; Tue, 20 Jun 2023 06:30:14 -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=TI2MeI7d; 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 S232804AbjFTNQ1 (ORCPT + 99 others); Tue, 20 Jun 2023 09:16:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232542AbjFTNQG (ORCPT ); Tue, 20 Jun 2023 09:16:06 -0400 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 189081709 for ; Tue, 20 Jun 2023 06:15:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687266919; 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=TI2MeI7dRwhD+YG+5/NV+8+1xTavqmmZdgeQMCFaQVEMnKvtioyVFtCgg1Wj3iBJF+gQ9q feQnLhRRdn9bHCjNpSZguyD6llYfbHioOuISGiyGB/yjS6AtfeJK5LslcLVsVv/lW+nPD3 uVkDvKo87oSlFNIPrp63kGVIeOJdEG8= 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-629-Q2tGUubEN3aW2VLS-NxC6w-1; Tue, 20 Jun 2023 09:15:17 -0400 X-MC-Unique: Q2tGUubEN3aW2VLS-NxC6w-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 61C0B89C7F3; Tue, 20 Jun 2023 13:14:54 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-166.pek2.redhat.com [10.72.12.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id B8A0AC1ED96; Tue, 20 Jun 2023 13:14:46 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, linux-mm@kvack.org, arnd@arndb.de, hch@lst.de, christophe.leroy@csgroup.eu, 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, nathan@kernel.org, glaubitz@physik.fu-berlin.de, Baoquan He Subject: [PATCH v7 05/19] mm: ioremap: allow ARCH to have its own ioremap method definition Date: Tue, 20 Jun 2023 21:13:42 +0800 Message-Id: <20230620131356.25440-6-bhe@redhat.com> In-Reply-To: <20230620131356.25440-1-bhe@redhat.com> References: <20230620131356.25440-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-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, 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 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 -- 2.34.1