From patchwork Mon Aug 1 14:40:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 12933820 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 B6A93C25B06 for ; Mon, 1 Aug 2022 14:40:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1D1A46B0071; Mon, 1 Aug 2022 10:40:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1809F6B0072; Mon, 1 Aug 2022 10:40:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0709D8E0001; Mon, 1 Aug 2022 10:40:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id EC9466B0071 for ; Mon, 1 Aug 2022 10:40:44 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id CCF5D80568 for ; Mon, 1 Aug 2022 14:40:44 +0000 (UTC) X-FDA: 79751285208.13.A7F3DCC Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf22.hostedemail.com (Postfix) with ESMTP id 25513C00CB for ; Mon, 1 Aug 2022 14:40:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659364842; 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=OgqhE+gnu6wIXIAF0NLfff8Tx1dAcg+s0AiRearY4Bw=; b=cuy228sNBWCdc8Xgb0ucWL97DZqi/xWddooWAXn7+4FxD5JbDnnV1nU9OqCnos9/MyOHcE rB1766EvI7kFQH647IJ2Y31fItFt8xe+izbPfn8WQeRRP/kitQ9vXK0V/h5YRxo6x9wRHy JGpMhm/oM7WcuBdz0lB7RE/A44C1uEw= 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-441-lr3gSQvSPXGEkokmH3FIIg-1; Mon, 01 Aug 2022 10:40:37 -0400 X-MC-Unique: lr3gSQvSPXGEkokmH3FIIg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E694C85A587; Mon, 1 Aug 2022 14:40:36 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-103.pek2.redhat.com [10.72.12.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA143141510F; Mon, 1 Aug 2022 14:40:32 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, hch@infradead.org, wangkefeng.wang@huawei.com, linux-arm-kernel@lists.infradead.org, Baoquan He Subject: [PATCH 00/11] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Date: Mon, 1 Aug 2022 22:40:18 +0800 Message-Id: <20220801144029.57829-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659364843; a=rsa-sha256; cv=none; b=BMBARgSU4786sZ2TRQGTRXUK2aAfPIG5E7qsa9Ctqa8qqvQA1dk6PDv2lcyYqcApqMFV1q iFQXQcGpE3qEgxSVI1B0rqfPScksRg4adxWybFNXLbftk+PLHTqo0+oBL09FbVfQLORNR3 FOsCMoWKAm6MI8OemSTWfjvC8cDjtFg= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=cuy228sN; spf=pass (imf22.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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659364843; 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=OgqhE+gnu6wIXIAF0NLfff8Tx1dAcg+s0AiRearY4Bw=; b=q3MSki2XZ6xWM8czMYVdtw4HAynht8oISLNcKgwyjyj1AtyfBcWykQq8cIvV3rBOARHqFm Sns+XPcfnK4uJwwwMIBhZ/yNS/BHQtJZ2nSuNuPEXj7dxH+qg0utgiy5cHrGUWfra6rS8f JMkKZOG9rndlGlgxdR/fg6utGD1czVA= Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=cuy228sN; spf=pass (imf22.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-Stat-Signature: 5o78mt3pinjtkacxkws4h6grjsf3n9d3 X-Rspamd-Queue-Id: 25513C00CB X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1659364842-263119 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 For patch 1~3, I don't merge them because I made them in different rounds of changing. And splitting them makes me easily describe the intention and make review easier. I can merge them after v1 reviewing if anyone thinks they should be merged. Testing: It passes the testing on arm64 and s390. 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 mm: ioremap: fixup the physical address 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 | 3 +- arch/arm64/mm/ioremap.c | 17 ++++++--- 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 | 49 ++++++++----------------- arch/parisc/include/asm/io.h | 16 ++++++--- arch/parisc/mm/ioremap.c | 66 ++++------------------------------ 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 | 62 +++++++------------------------- arch/xtensa/Kconfig | 1 + arch/xtensa/include/asm/io.h | 39 ++++++++++---------- arch/xtensa/mm/ioremap.c | 56 +++++++---------------------- include/asm-generic/io.h | 24 +++++++------ mm/ioremap.c | 21 ++++++----- 27 files changed, 232 insertions(+), 485 deletions(-) delete mode 100644 arch/hexagon/mm/ioremap.c