From patchwork Thu Feb 16 12:34:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 58015 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp276732wrn; Thu, 16 Feb 2023 04:42:03 -0800 (PST) X-Google-Smtp-Source: AK7set8ZvXA8erJ0CmPPsG143F36eZz40CG9d5l34TjjZS3y856dazQiZroaptD022jgyXwNxzvb X-Received: by 2002:a05:6a21:30c4:b0:bc:c663:41be with SMTP id yf4-20020a056a2130c400b000bcc66341bemr4152221pzb.30.1676551322971; Thu, 16 Feb 2023 04:42:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676551322; cv=none; d=google.com; s=arc-20160816; b=U9bcZK1N+pDbGAL0lFunUebyge4cA6dPIh0xcsL1KTMljMx93QvDCspNe0diA5J/OP T5ta7mZxQ7SD8e0aS1wdVAgPIGZu722oALe9woFK6ChAPsp/s7VudkaMSndNVGm6Wnbn KfZV4QQX3ewD4JbTSZCITOTSGIJxQydaz4Asy6WBAxCMkmkiHYQ+0e0JdnO8x1+f4UkR ijhRnh+wCgKUeQby6u4HKI/IP7r5fPED4ePv5Q1fSgRSrNz7ZBmIZHXz7gmhy00sh8uW WPd7SWQs2JijCH5jsWWVae9zY1C8I+vQcqbFrLzMr4HwH/u3hVQzisRRiQjpEtFjCgwF zPpA== 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=5gn5xqT9XfmH8tKovLjSHCJ1d21jDbu3NIptvTi8Sio=; b=WLFthhUO4bSdPih3s7Y8U0/TiPT0b/NoHBXC8g1p/tRan4L11sppTwArudNqwJJ2zB 0q+4bMQSmAc+gRxGw7U3nMZyGM8+b6cRS7WZk5c7FBvka8J0tSk2DsukNTTf1NUjbpE4 HuqOOzacM4uNPl05PL2poCCDGIjUmICehYE5swcFs3Org1EhKMlnhWA4khI/VtsKcq8G azPrQp5sKppjgMEifUU6NMpx4XXLfw8Y8D5/Ogj+oWgpiftRtit3ODl88KqHcdp8t0nG Bt7Vq/+FKY4qVJ6FyGPEtAtqC8+EjH320NDdWVXa44UQvHN1ns6Zt/wxJdf6f3UR2i6A PSPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dOEUfaZn; 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 p47-20020a056a0026ef00b005a8abcba78bsi1374284pfw.22.2023.02.16.04.41.50; Thu, 16 Feb 2023 04:42:02 -0800 (PST) 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=dOEUfaZn; 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 S230290AbjBPMf4 (ORCPT + 99 others); Thu, 16 Feb 2023 07:35:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230326AbjBPMfx (ORCPT ); Thu, 16 Feb 2023 07:35:53 -0500 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 45ACD3B0D5 for ; Thu, 16 Feb 2023 04:35:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676550905; 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=5gn5xqT9XfmH8tKovLjSHCJ1d21jDbu3NIptvTi8Sio=; b=dOEUfaZnW8TNmkoNpc1/E61jGcfeO0jOFCakVoPq/FP4Pi7TVOtIL3kk16Oq5yUQ5SvyRM WBEgcLldzEYWVW7Ck/1egbzsOQJp/agetQj2pjjexqYebT7v4+gGBw1wP5zbvY2WuD/NuO VpDYcfT3VQc6zTDQVUe9H8kvKm2ErwU= 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-401-2MLUCqQ5OUieeNkqxfzfVw-1; Thu, 16 Feb 2023 07:35:00 -0500 X-MC-Unique: 2MLUCqQ5OUieeNkqxfzfVw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7027B381494E; Thu, 16 Feb 2023 12:34:59 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-99.pek2.redhat.com [10.72.12.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id C55D1492C3C; Thu, 16 Feb 2023 12:34:53 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, 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, arnd@arndb.de, Baoquan He , linux-arch@vger.kernel.org Subject: [PATCH v4 04/16] mm: ioremap: allow ARCH to have its own ioremap method definition Date: Thu, 16 Feb 2023 20:34:07 +0800 Message-Id: <20230216123419.461016-5-bhe@redhat.com> In-Reply-To: <20230216123419.461016-1-bhe@redhat.com> References: <20230216123419.461016-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757991480058846689?= X-GMAIL-MSGID: =?utf-8?q?1757991480058846689?= 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, allow these architecutres to have their own ioremap_prot(), ioremap() and iounmap() definitions. Signed-off-by: Baoquan He Cc: Arnd Bergmann Cc: Kefeng Wang Cc: linux-arch@vger.kernel.org Acked-by: Arnd Bergmann --- 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