[PATCH v2 00/11] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way

Baoquan He
2022-08-20T00:31:51Z

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

--
2.34.1