asm-generic-iomaph-remove-arch_has_ioremap_xx-macros.patch removed from -mm tree
The quilt patch titled
Subject: asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros
has been removed from the -mm tree. Its filename was
asm-generic-iomaph-remove-arch_has_ioremap_xx-macros.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Baoquan He <[email protected]>
Subject: asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros
Date: Thu, 6 Jul 2023 23:45:02 +0800
Patch series "mm: ioremap: Convert architectures to take GENERIC_IOREMAP way", v8.
Motivation and implementation:
==============================
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 code of ioremap() and iounmap().
In this patchset, firstly introduce generic_ioremap_prot() and generic_iounmap() to extract the generic code for GENERIC_IOREMAP. By taking GENERIC_IOREMAP method, the generic generic_ioremap_prot(), generic_iounmap(), and their generic wrapper ioremap_prot(), ioremap() and iounmap() are all visible and available to arch. Arch needs to provide wrapper functions to override the generic version if there's arch specific handling in its corresponding ioremap_prot(), ioremap() or iounmap(). With these changes, duplicated ioremap/iounmap() code uder ARCH-es are removed, and the equivalent functioality is kept as before.
Background info:
================
1) The converting more architectures to take GENERIC_IOREMAP way is suggested by Christoph in below discussion:
https://lore.kernel.org/all/[email protected]/T/#u
2) In the previous v1 to v3, it's basically further action after arm64 has converted to GENERIC_IOREMAP way in below patchset. It's done by adding hook ioremap_allowed() and iounmap_allowed() in ARCH to add ARCH specific handling the middle of ioremap_prot() and iounmap().
[PATCH v5 0/6] arm64: Cleanup ioremap() and support ioremap_prot()
https://lore.kernel.org/all/[email protected]/T/#u
Later, during v3 reviewing, Christophe Leroy suggested to introduce generic_ioremap_prot() and generic_iounmap() to generic codes, and ARCH can provide wrapper function ioremap_prot(), ioremap() or iounmap() if needed. Christophe made a RFC patchset as below to specially demonstrate his idea. This is what v4 and now v5 is doing.
[RFC PATCH 0/8] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way
https://lore.kernel.org/all/[email protected]/T/#u
Testing:
========
In v8, I only applied this patchset onto the latest linus's tree to build and run on arm64 and s390.
This patch (of 19):
Let's use '#define ioremap_xx' and "#ifdef ioremap_xx" instead.
To remove defined ARCH_HAS_IOREMAP_xx macros in <asm/io.h> of each ARCH, the ARCH's own ioremap_wc|wt|np definition need be above "#include <asm-generic/iomap.h>. Otherwise the redefinition error would be seen during compiling. So the relevant adjustments are made to avoid compiling error:
loongarch:
- doesn't include <asm-generic/iomap.h>, defining ARCH_HAS_IOREMAP_WC is redundant, so simply remove it.
m68k:
- selected GENERIC_IOMAP, <asm-generic/iomap.h> has been added in <asm-generic/io.h>, and <asm/kmap.h> is included above <asm-generic/iomap.h>, so simply remove ARCH_HAS_IOREMAP_WT defining.
mips:
- move "#include <asm-generic/iomap.h>" below ioremap_wc definition
in <asm/io.h>
powerpc:
- remove "#include <asm-generic/iomap.h>" in <asm/io.h> because it's duplicated with the one in <asm-generic/io.h>, let's rely on the latter.
x86:
- selected GENERIC_IOMAP, remove #include <asm-generic/iomap.h> in the middle of <asm/io.h>. Let's rely on <asm-generic/io.h>.
---
arch/loongarch/include/asm/io.h | 2 -- arch/m68k/include/asm/io_mm.h | 2 -- arch/m68k/include/asm/kmap.h | 2 -- arch/mips/include/asm/io.h | 5 ++--- arch/powerpc/include/asm/io.h | 9 +-------- arch/x86/include/asm/io.h | 5 ----- drivers/net/ethernet/sfc/io.h | 2 +- drivers/net/ethernet/sfc/siena/io.h | 2 +- include/asm-generic/iomap.h | 6 +++--- 9 files changed, 8 insertions(+), 27 deletions(-)
arch/loongarch/include/asm/io.h renamed from arch/loongarch/include/asm/io.h~asm-generic-iomaph-remove-arch_has_ioremap_xx-macros +0 -2
@@ -5,8 +5,6 @@#ifndef _ASM_IO_H#define _ASM_IO_H -#define ARCH_HAS_IOREMAP_WC -#include <linux/kernel.h> #include <linux/types.h>
arch/m68k/include/asm/io_mm.h renamed from arch/m68k/include/asm/io_mm.h~asm-generic-iomaph-remove-arch_has_ioremap_xx-macros +0 -2
@@ -26,8 +26,6 @@#include <asm/virtconvert.h> #include <asm/kmap.h> -#include <asm-generic/iomap.h> -#ifdef CONFIG_ATARI #define atari_readb raw_inb#define atari_writeb raw_outb
arch/m68k/include/asm/kmap.h renamed from arch/m68k/include/asm/kmap.h~asm-generic-iomaph-remove-arch_has_ioremap_xx-macros +0 -2
@@ -4,8 +4,6 @@#ifdef CONFIG_MMU -#define ARCH_HAS_IOREMAP_WT -/* Values for nocacheflag and cmode */ #define IOMAP_FULL_CACHING 0#define IOMAP_NOCACHE_SER 1
arch/mips/include/asm/io.h renamed from arch/mips/include/asm/io.h~asm-generic-iomaph-remove-arch_has_ioremap_xx-macros +2 -3
@@ -12,8 +12,6 @@#ifndef _ASM_IO_H#define _ASM_IO_H -#define ARCH_HAS_IOREMAP_WC -#include <linux/compiler.h> #include <linux/kernel.h> #include <linux/types.h>
@@ -25,7 +23,6 @@#include <asm/byteorder.h> #include <asm/cpu.h> #include <asm/cpu-features.h> -#include <asm-generic/iomap.h> #include <asm/page.h> #include <asm/pgtable-bits.h> #include <asm/processor.h>
@@ -210,6 +207,8 @@ void iounmap(const volatile void __iomem#define ioremap_wc (offset, size) \ ioremap_prot((offset), (size), boot_cpu_data.writecombine) +#include <asm-generic/iomap.h> +#if defined(CONFIG_CPU_CAVIUM_OCTEON )#define war_io_reorder_wmb () wmb()#else
arch/powerpc/include/asm/io.h renamed from arch/powerpc/include/asm/io.h~asm-generic-iomaph-remove-arch_has_ioremap_xx-macros +1 -8
@@ -3,11 +3,6 @@#define _ASM_POWERPC_IO_H#ifdef __KERNEL__ -#define ARCH_HAS_IOREMAP_WC -#ifdef CONFIG_PPC32 -#define ARCH_HAS_IOREMAP_WT -#endif -/* */
@@ -732,9 +727,7 @@ static inline void name at \#define writel_relaxed (v, addr) writel(v, addr)#define writeq_relaxed (v, addr) writeq(v, addr) -#ifdef CONFIG_GENERIC_IOMAP -#include <asm-generic/iomap.h> -#else +#ifndef CONFIG_GENERIC_IOMAP /* * Here comes the implementation of the IOMAP interfaces. */
arch/x86/include/asm/io.h renamed from arch/x86/include/asm/io.h~asm-generic-iomaph-remove-arch_has_ioremap_xx-macros +0 -5
@@ -35,9 +35,6 @@* - Arnaldo Carvalho de Melo <[email protected]> */ -#define ARCH_HAS_IOREMAP_WC -#define ARCH_HAS_IOREMAP_WT -#include <linux/string.h> #include <linux/compiler.h> #include <linux/cc_platform.h>
@@ -212,8 +209,6 @@ void memset_io(volatile void __iomem *,#define memcpy_toio memcpy_toio#define memset_io memset_io -#include <asm-generic/iomap.h> -/* * ISA space is 'always mapped' on a typical x86 system, no need to * explicitly ioremap() it. The fact that the ISA IO space is mapped
drivers/net/ethernet/sfc/io.h renamed from drivers/net/ethernet/sfc/io.h~asm-generic-iomaph-remove-arch_has_ioremap_xx-macros +1 -1
@@ -70,7 +70,7 @@*/ #ifdef CONFIG_X86_64 /* PIO is a win only if write-combining is possible */ -#ifdef ARCH_HAS_IOREMAP_WC +#ifdef ioremap_wc#define EFX_USE_PIO 1#endif #endif
drivers/net/ethernet/sfc/siena/io.h renamed from drivers/net/ethernet/sfc/siena/io.h~asm-generic-iomaph-remove-arch_has_ioremap_xx-macros +1 -1
@@ -70,7 +70,7 @@*/ #ifdef CONFIG_X86_64 /* PIO is a win only if write-combining is possible */ -#ifdef ARCH_HAS_IOREMAP_WC +#ifdef ioremap_wc#define EFX_USE_PIO 1#endif #endif
include/asm-generic/iomap.h renamed from include/asm-generic/iomap.h~asm-generic-iomaph-remove-arch_has_ioremap_xx-macros +3 -3
@@ -93,15 +93,15 @@ extern void __iomem *ioport_map(unsignedextern void ioport_unmap (void __iomem *);#endif -#ifndef ARCH_HAS_IOREMAP_WC +#ifndef ioremap_wc#define ioremap_wc ioremap#endif -#ifndef ARCH_HAS_IOREMAP_WT +#ifndef ioremap_wt#define ioremap_wt ioremap#endif -#ifndef ARCH_HAS_IOREMAP_NP +#ifndef ioremap_np/* See the comment in asm-generic/io.h about ioremap_np(). */ #define ioremap_np ioremap_npstatic inline void __iomem *ioremap_np (phys_addr_t offset,size_t size)
_
Patches currently in -mm which might be from [email protected] are
net-altera-tse-make-altera_tse-depend-on-has_iomem.patch irqchip-al-fic-make-al_fic-depend-on-has_iomem.patch