Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp30698099rwd; Thu, 6 Jul 2023 09:24:00 -0700 (PDT) X-Google-Smtp-Source: APBJJlHmHvl2M+FPQYuy/gjWzuruum/Of4rUpYhfkfGtM8JvBGT5eCJfbBLV12WC7NR+SUL+51um X-Received: by 2002:a05:6a20:5499:b0:12d:d37a:29c2 with SMTP id i25-20020a056a20549900b0012dd37a29c2mr4027252pzk.13.1688660639588; Thu, 06 Jul 2023 09:23:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688660639; cv=none; d=google.com; s=arc-20160816; b=E5ZYBlyyGGcVwFQG4GqRdCjvimbqWjSp4Mhe5RPi0cJzycQKWMYNRPPlussv3Uo1Qt +VCHiDDBY20TO8jNFwLD/pgfMdyHLsCKKe8+ghrfzmGrU67gr2gE4i2NLtHD+AkvCA5L /qfCPX9/FuWgIhOxBkKWp5YiUsQxzd9cGfJ4VyVTtC7c4PQ/HpAncq2hgh7or7GEpgVL ph5uH+BKRFCL0Gcp1oq8mom80gZ5sCuBirRLuqvAUHWDqVYjpSQGDTWVAiZOqI5Gsmup koA9JQP3SZaJRSXitGYfCNj908usfdK22muxZanPRpN4hjWV9a6G8QRemolm6bXxfA0U 8/Dw== 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=; fh=Gzorixg490ZTdswETp+N6V5LjCPPpoJF3e6I9RXS4U0=; b=JngIioCFplfNnzE2y1qnVdwlB7NOtutuHOc275pJg+KZcDtSObKrLPqi697AwNX3AE rL5EKiTom9AlCnFR6xjkAjUUngNFhtQkl2fvu9Hh9YC0sfefo8hZT9inSHvAOw1AtzQ3 +L38ReSnZM5bZHsDmPBldc+lqIjnny8p0pDID54T6dWQjAcUXrGFx8y7pe+m3VVXJIwb KTNbjBZbuyH5+QQSrWAyqO9+H88hO7IvpEMN62QoOFtUWqKEwQG2xawy94i4Sxd79v28 +EwflwrxTF7BVdjKl9BeaKckXxALnI0r+g5N8lcCALKAo/haqhhQAuwPP9wmGAegE/TI c60w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Qhzgkb89; 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 l62-20020a632541000000b0054fe372aa7bsi1749356pgl.609.2023.07.06.09.23.44; Thu, 06 Jul 2023 09:23:59 -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=Qhzgkb89; 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 S229770AbjGFPrJ (ORCPT + 99 others); Thu, 6 Jul 2023 11:47:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232159AbjGFPrI (ORCPT ); Thu, 6 Jul 2023 11:47:08 -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 C133719BD for ; Thu, 6 Jul 2023 08:46:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688658382; 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=Qhzgkb89fvvil1jeBqxthWSNoFmBx5Qfe/6jwsGKhViu7vvZFLvarauRp4kUAEKybp1hul yzUHXgdkocJhhPxBbVvMmXtRhZo+JGviKyfrkWg+KNd79+QOYAM+bDqDXM60Wlq8ZyWyuh zzDxlE3V/DYtzc0PDeE5xxgwhk8I57Y= 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-113-ySB3notAN_2JJ180Qz1p8g-1; Thu, 06 Jul 2023 11:46:19 -0400 X-MC-Unique: ySB3notAN_2JJ180Qz1p8g-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7F2CF858F1E; Thu, 6 Jul 2023 15:46:18 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-39.pek2.redhat.com [10.72.12.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE6B8F5CF0; Thu, 6 Jul 2023 15:46:09 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.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, shorne@gmail.com, David.Laight@ACULAB.COM, deller@gmx.de, nathan@kernel.org, glaubitz@physik.fu-berlin.de, Baoquan He , linux-arch@vger.kernel.org Subject: [PATCH v8 05/19] mm: ioremap: allow ARCH to have its own ioremap method definition Date: Thu, 6 Jul 2023 23:45:06 +0800 Message-Id: <20230706154520.11257-6-bhe@redhat.com> In-Reply-To: <20230706154520.11257-1-bhe@redhat.com> References: <20230706154520.11257-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.5 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_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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