From patchwork Fri Jun 9 07:55:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 105376 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp789569vqr; Fri, 9 Jun 2023 01:16:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4PREIOqbT/WUoUGoiy9Mb3SDsyOAkUY+EiCpkY1dwyZL/MvxeLmZ/zXrsNqKcjezygIbVs X-Received: by 2002:a05:6a00:c88:b0:65d:83d8:c3e3 with SMTP id a8-20020a056a000c8800b0065d83d8c3e3mr702150pfv.32.1686298596792; Fri, 09 Jun 2023 01:16:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686298596; cv=none; d=google.com; s=arc-20160816; b=I7Mk7o0E9FOTtWFqrroh9t3V8f5ZdHD7AnyXHf8yj3G3LJVpFMFhjcHJQv1U8i/G0i oB6mM2JQ/EGf+RK0zbp3JSqCs7mt6Sq0zjpFa2N54LqW19Lfm5gQdrZ2LFV1cEHev8xu ZmKhv+6o8vtN+IB2pRbyIVx081VmP8xzHCQ3djBNgIkC37HgI2vs1YT166BWExQJPduS gRbwzlqpSTNxVafsd5SzrVk84isqTu7rZkLrwxikYlNcWbbJ9ONT2Whc+8NOO54kkxvD RPRcJa8Rfxzsp7RbXa3rihMF+R8B2YtF6im/WBfVCC92QPXkrdDDLDl6FakiuBl+zTnZ gMIw== 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=etYP+T4HjlSM6yBo/sJoXSIWAqdWBixvLwjZer8GNJx6Z5brPNMN5MvGOlh85pkjWS Jd2V0bqlJODXN/NdrukmM98zPbcgR+bDJzbsegxyCzTiOMejuquylxHckKNahmXB7bZ7 DC7CIrijkdriX0jv5kiPHNPDkkOyxvGbq4ehTFLB6/2c8pstbEgzEiUFH6Ub8zCf8uFn PubU1NJGkjkfnAHx0ldGnk7q2Exlm5Q23IsydzOcMufKq6XsDDhpzdXLQPsgq91KAJdG ysPuboqmqLYurJCh6KAU/wM1kYuyStmLCn8VCCvl7leTWiZPwTtApZtccCFV58zwiBO8 Duzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hJ+d55OM; 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 y82-20020a626455000000b00643652c8879si2018328pfb.326.2023.06.09.01.16.23; Fri, 09 Jun 2023 01:16:36 -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=hJ+d55OM; 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 S239662AbjFIH6G (ORCPT + 99 others); Fri, 9 Jun 2023 03:58:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239387AbjFIH5a (ORCPT ); Fri, 9 Jun 2023 03:57:30 -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 976994224 for ; Fri, 9 Jun 2023 00:56:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686297379; 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=hJ+d55OMRgIpuQtE3NzLKw6sj4a3FFES/G+axssZnwpmLHmCp2So3pn/gKwKMn5cLCXQjJ ImF20cWyOoJiAY41d15fCuJVMLYpeFrWvxnkbaVoUUhKIXKx1xViXRxrSiZnVtTSDKiSZe G5ovi0FCP9+Sphnzs0cQM9rKat9i+Ts= 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-562-XLUSNABUP-uOYtCvZesmAg-1; Fri, 09 Jun 2023 03:56:14 -0400 X-MC-Unique: XLUSNABUP-uOYtCvZesmAg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9E61C384952B; Fri, 9 Jun 2023 07:56:13 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-92.pek2.redhat.com [10.72.12.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2DC1720268C7; Fri, 9 Jun 2023 07:56:07 +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@lst.de, 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, Baoquan He Subject: [PATCH v6 05/19] mm: ioremap: allow ARCH to have its own ioremap method definition Date: Fri, 9 Jun 2023 15:55:14 +0800 Message-Id: <20230609075528.9390-6-bhe@redhat.com> In-Reply-To: <20230609075528.9390-1-bhe@redhat.com> References: <20230609075528.9390-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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_H5,RCVD_IN_MSPIKE_WL,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?1768212237454635066?= X-GMAIL-MSGID: =?utf-8?q?1768212237454635066?= 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