From patchwork Sat Aug 20 00:31:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 12949402 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB530C28D13 for ; Sat, 20 Aug 2022 00:31:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 51AE18D0003; Fri, 19 Aug 2022 20:31:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4C9B78D0002; Fri, 19 Aug 2022 20:31:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3916B8D0003; Fri, 19 Aug 2022 20:31:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 27AD68D0002 for ; Fri, 19 Aug 2022 20:31:41 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id EB98112047C for ; Sat, 20 Aug 2022 00:31:40 +0000 (UTC) X-FDA: 79818092760.23.D334C87 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf25.hostedemail.com (Postfix) with ESMTP id 4030EA0002 for ; Sat, 20 Aug 2022 00:31:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660955498; 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; bh=42gsKIYn+s2fiiEFNJGpewKFrU2tZQDzFSQvwNusdEA=; b=FJRkxJ3Z5gmE96qbTFbd68RtbDHNvYLpdDnMzugaP24L5j57cec0a8n5/PEJSekw2OhOTF fqnIqh/5e8VA8ej+1fG3ByZPaLeC1TnmvrqeFnsY+rmmvkwmIS5RwXT9pwa72iYTSp8Rul YUQzlQyABRQIh47gQoI9wdnNUqBhcOQ= 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-75-QLZDrCuTNu2uG6GJ8AmMrg-1; Fri, 19 Aug 2022 20:31:33 -0400 X-MC-Unique: QLZDrCuTNu2uG6GJ8AmMrg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C19DD1C05AE9; Sat, 20 Aug 2022 00:31:32 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-17.pek2.redhat.com [10.72.12.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F8D840D2827; Sat, 20 Aug 2022 00:31:28 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, hch@infradead.org, agordeev@linux.ibm.com, wangkefeng.wang@huawei.com, linux-arm-kernel@lists.infradead.org, Baoquan He Subject: [PATCH v2 00/11] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Date: Sat, 20 Aug 2022 08:31:14 +0800 Message-Id: <20220820003125.353570-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660955500; h=from:from:sender: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: references:dkim-signature; bh=42gsKIYn+s2fiiEFNJGpewKFrU2tZQDzFSQvwNusdEA=; b=kuM+Gnpfl4i5Q2FBKncPclfQ/Zz1nVkkeg+p1g4PR/kbRcfyjZULAMrfV3Ln8kuP5brV71 75a7SFNv9TpEVasBKlX38xKtGyXMzRjauwQaepgpg3FkoKXwQJTItgctSZx9jUIH5lsZzL KwL1RDG331Uvjh5uTyPI09jKS2dHwZU= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FJRkxJ3Z; spf=pass (imf25.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660955500; a=rsa-sha256; cv=none; b=tQLoWlY4Vj8+kZG98MzdSVcSlhmwUxeoDrT6QgIX69z2YkhrfIoqZP/iTxoQXakHVXpuMB dNXPO+VF2uST/ZHMKbGupSiXBnd/cnoRKjdYngtjIazuw/7R5yqRfabPenxOopv+y1i0MX 5ruJxciJHh8f/j2z6E9khMOVYBQYyB4= Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FJRkxJ3Z; spf=pass (imf25.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 4030EA0002 X-Stat-Signature: chz4ty8ibandh8b7nbjcd3qyg9u4ttfe X-Rspam-User: X-HE-Tag: 1660955499-429947 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Currently, many architecutres have't taken the standard GENERIC_IOREMAP way to implement ioremap_prot(), iounmap(), and ioremap_xx(), but make these functions specifically under each arch's folder. Those cause many duplicated codes of ioremap() and iounmap(). In this patchset, firstly adapt the hooks io[re|un]map_allowed, then make use of them to convert those ARCH-es to take GENERIC_IOREMAP method. With these change, duplicated ioremap/iounmap() code uder ARCH-es are removed. This is suggested by Christoph in below discussion: https://lore.kernel.org/all/Yp7h0Jv6vpgt6xdZ@infradead.org/T/#u And it's basically further action after arm64 has converted to GENERIC_IOREMAP way in below patchset. [PATCH v5 0/6] arm64: Cleanup ioremap() and support ioremap_prot() https://lore.kernel.org/all/20220607125027.44946-1-wangkefeng.wang@huawei.com/T/#u And some change of io[re|un]map_allowed() is borrowed from the v3 of arm64 converting patch. [PATCH v3 4/6] mm: ioremap: Add arch_ioremap/iounmap() https://lore.kernel.org/all/20220519082552.117736-5-wangkefeng.wang@huawei.com/T/#u v1->v2: Rename io[re|un]map_allowed() to arch_io[re|un]map() and made some minor changes in patch 1~2 as per Alexander and Kefeng's suggestions. Accordingly, adjust patches~4~11 because of the renaming arch_io[re|un]map(). Testing: It passes the testing on arm64. For other ARCHes, I only tried to pass build with existing RPMs of cross compiling tools. ARCHes like openrisc, parisc, don't build because of lack of cross compiling RPMS. Baoquan He (11): mm/ioremap: change the return value of io[re|un]map_allowed and rename mm: ioremap: fixup the physical address and page prot mm: ioremap: allow ARCH to have its own ioremap definition arc: mm: Convert to GENERIC_IOREMAP hexagon: mm: Convert to GENERIC_IOREMAP ia64: mm: Convert to GENERIC_IOREMAP openrisc: mm: Convert to GENERIC_IOREMAP parisc: mm: Convert to GENERIC_IOREMAP s390: mm: Convert to GENERIC_IOREMAP sh: mm: Convert to GENERIC_IOREMAP xtensa: mm: Convert to GENERIC_IOREMAP arch/arc/Kconfig | 1 + arch/arc/include/asm/io.h | 19 +++++++--- arch/arc/mm/ioremap.c | 60 +++++-------------------------- arch/arm64/include/asm/io.h | 5 +-- arch/arm64/mm/ioremap.c | 16 ++++++--- arch/hexagon/Kconfig | 1 + arch/hexagon/include/asm/io.h | 9 +++-- arch/hexagon/mm/ioremap.c | 44 ----------------------- arch/ia64/Kconfig | 1 + arch/ia64/include/asm/io.h | 26 ++++++++------ arch/ia64/mm/ioremap.c | 50 ++++++-------------------- arch/openrisc/Kconfig | 1 + arch/openrisc/include/asm/io.h | 16 ++++++--- arch/openrisc/mm/ioremap.c | 51 +++++++++----------------- arch/parisc/Kconfig | 1 + arch/parisc/include/asm/io.h | 16 ++++++--- arch/parisc/mm/ioremap.c | 65 ++++------------------------------ arch/s390/Kconfig | 1 + arch/s390/include/asm/io.h | 26 +++++++++----- arch/s390/pci/pci.c | 60 +++++-------------------------- arch/sh/Kconfig | 1 + arch/sh/include/asm/io.h | 47 ++++++++---------------- arch/sh/mm/ioremap.c | 61 ++++++------------------------- arch/xtensa/Kconfig | 1 + arch/xtensa/include/asm/io.h | 39 +++++++++----------- arch/xtensa/mm/ioremap.c | 56 +++++++---------------------- include/asm-generic/io.h | 34 ++++++++++-------- mm/ioremap.c | 12 ++++--- 28 files changed, 230 insertions(+), 490 deletions(-) delete mode 100644 arch/hexagon/mm/ioremap.c