linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 RESEND 01/17] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros
       [not found] <20230515090848.833045-1-bhe@redhat.com>
@ 2023-05-15  9:08 ` Baoquan He
  2023-05-16  6:15   ` Mike Rapoport
                     ` (2 more replies)
  2023-05-15  9:08 ` [PATCH v5 RESEND 15/17] powerpc: mm: Convert to GENERIC_IOREMAP Baoquan He
  1 sibling, 3 replies; 8+ messages in thread
From: Baoquan He @ 2023-05-15  9:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, wangkefeng.wang, Baoquan He, arnd, schnelle, netdev,
	deller, x86, linux-mips, hch, linux-mm, linux-m68k, David.Laight,
	willy, loongarch, agordeev, linuxppc-dev, shorne

Let's use '#define ioremap_xx' and "#ifdef ioremap_xx" instead.

For each architecture to remove defined ARCH_HAS_IOREMAP_xx macros in
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>.

Signed-off-by: Baoquan He <bhe@redhat.com>
Cc: loongarch@lists.linux.dev
Cc: linux-m68k@lists.linux-m68k.org
Cc: linux-mips@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: x86@kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-arch@vger.kernel.org
---
 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(-)

diff --git a/arch/loongarch/include/asm/io.h b/arch/loongarch/include/asm/io.h
index 545e2708fbf7..5fef1246c6fb 100644
--- a/arch/loongarch/include/asm/io.h
+++ b/arch/loongarch/include/asm/io.h
@@ -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>
 
diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h
index d41fa488453b..6a0abd4846c6 100644
--- a/arch/m68k/include/asm/io_mm.h
+++ b/arch/m68k/include/asm/io_mm.h
@@ -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
diff --git a/arch/m68k/include/asm/kmap.h b/arch/m68k/include/asm/kmap.h
index dec05743d426..4efb3efa593a 100644
--- a/arch/m68k/include/asm/kmap.h
+++ b/arch/m68k/include/asm/kmap.h
@@ -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
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index cc28d207a061..477773328a06 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -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 *addr);
 #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
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index f1e657c9bbe8..67a3fb6de498 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -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.
  */
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index e9025640f634..76238842406a 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -35,9 +35,6 @@
   *  - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
   */
 
-#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 *, int, size_t);
 #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
diff --git a/drivers/net/ethernet/sfc/io.h b/drivers/net/ethernet/sfc/io.h
index 30439cc83a89..07f99ad14bf3 100644
--- a/drivers/net/ethernet/sfc/io.h
+++ b/drivers/net/ethernet/sfc/io.h
@@ -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
diff --git a/drivers/net/ethernet/sfc/siena/io.h b/drivers/net/ethernet/sfc/siena/io.h
index 30439cc83a89..07f99ad14bf3 100644
--- a/drivers/net/ethernet/sfc/siena/io.h
+++ b/drivers/net/ethernet/sfc/siena/io.h
@@ -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
diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h
index 08237ae8b840..196087a8126e 100644
--- a/include/asm-generic/iomap.h
+++ b/include/asm-generic/iomap.h
@@ -93,15 +93,15 @@ extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
 extern 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_np
 static inline void __iomem *ioremap_np(phys_addr_t offset, size_t size)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v5 RESEND 15/17] powerpc: mm: Convert to GENERIC_IOREMAP
       [not found] <20230515090848.833045-1-bhe@redhat.com>
  2023-05-15  9:08 ` [PATCH v5 RESEND 01/17] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros Baoquan He
@ 2023-05-15  9:08 ` Baoquan He
  2023-05-16  7:00   ` Mike Rapoport
  2023-05-17  6:42   ` Christoph Hellwig
  1 sibling, 2 replies; 8+ messages in thread
From: Baoquan He @ 2023-05-15  9:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, wangkefeng.wang, Baoquan He, arnd, schnelle, deller,
	Nicholas Piggin, hch, linux-mm, David.Laight, willy, agordeev,
	linuxppc-dev, shorne

From: Christophe Leroy <christophe.leroy@csgroup.eu>

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 versions if there's
arch specific handling in its ioremap_prot(), ioremap() or iounmap().
This change will simplify implementation by removing duplicated codes
with generic_ioremap_prot() and generic_iounmap(), and has the equivalent
functioality as before.

Here, add wrapper functions ioremap_prot() and iounmap() for powerpc's
special operation when ioremap() and iounmap().

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Baoquan He <bhe@redhat.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org
---
 arch/powerpc/Kconfig          |  1 +
 arch/powerpc/include/asm/io.h |  8 +++-----
 arch/powerpc/mm/ioremap.c     | 26 +-------------------------
 arch/powerpc/mm/ioremap_32.c  | 19 +++++++++----------
 arch/powerpc/mm/ioremap_64.c  | 12 ++----------
 5 files changed, 16 insertions(+), 50 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 539d1f03ff42..e0a88ebcd026 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -194,6 +194,7 @@ config PPC
 	select GENERIC_CPU_VULNERABILITIES	if PPC_BARRIER_NOSPEC
 	select GENERIC_EARLY_IOREMAP
 	select GENERIC_GETTIMEOFDAY
+	select GENERIC_IOREMAP
 	select GENERIC_IRQ_SHOW
 	select GENERIC_IRQ_SHOW_LEVEL
 	select GENERIC_PCI_IOMAP		if PCI
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index 67a3fb6de498..0732b743e099 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -889,8 +889,8 @@ static inline void iosync(void)
  *
  */
 extern void __iomem *ioremap(phys_addr_t address, unsigned long size);
-extern void __iomem *ioremap_prot(phys_addr_t address, unsigned long size,
-				  unsigned long flags);
+#define ioremap ioremap
+#define ioremap_prot ioremap_prot
 extern void __iomem *ioremap_wc(phys_addr_t address, unsigned long size);
 #define ioremap_wc ioremap_wc
 
@@ -904,14 +904,12 @@ void __iomem *ioremap_coherent(phys_addr_t address, unsigned long size);
 #define ioremap_cache(addr, size) \
 	ioremap_prot((addr), (size), pgprot_val(PAGE_KERNEL))
 
-extern void iounmap(volatile void __iomem *addr);
+#define iounmap iounmap
 
 void __iomem *ioremap_phb(phys_addr_t paddr, unsigned long size);
 
 int early_ioremap_range(unsigned long ea, phys_addr_t pa,
 			unsigned long size, pgprot_t prot);
-void __iomem *do_ioremap(phys_addr_t pa, phys_addr_t offset, unsigned long size,
-			 pgprot_t prot, void *caller);
 
 extern void __iomem *__ioremap_caller(phys_addr_t, unsigned long size,
 				      pgprot_t prot, void *caller);
diff --git a/arch/powerpc/mm/ioremap.c b/arch/powerpc/mm/ioremap.c
index 4f12504fb405..705e8e8ffde4 100644
--- a/arch/powerpc/mm/ioremap.c
+++ b/arch/powerpc/mm/ioremap.c
@@ -41,7 +41,7 @@ void __iomem *ioremap_coherent(phys_addr_t addr, unsigned long size)
 	return __ioremap_caller(addr, size, prot, caller);
 }
 
-void __iomem *ioremap_prot(phys_addr_t addr, unsigned long size, unsigned long flags)
+void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long flags)
 {
 	pte_t pte = __pte(flags);
 	void *caller = __builtin_return_address(0);
@@ -74,27 +74,3 @@ int early_ioremap_range(unsigned long ea, phys_addr_t pa,
 
 	return 0;
 }
-
-void __iomem *do_ioremap(phys_addr_t pa, phys_addr_t offset, unsigned long size,
-			 pgprot_t prot, void *caller)
-{
-	struct vm_struct *area;
-	int ret;
-	unsigned long va;
-
-	area = __get_vm_area_caller(size, VM_IOREMAP, IOREMAP_START, IOREMAP_END, caller);
-	if (area == NULL)
-		return NULL;
-
-	area->phys_addr = pa;
-	va = (unsigned long)area->addr;
-
-	ret = ioremap_page_range(va, va + size, pa, prot);
-	if (!ret)
-		return (void __iomem *)area->addr + offset;
-
-	vunmap_range(va, va + size);
-	free_vm_area(area);
-
-	return NULL;
-}
diff --git a/arch/powerpc/mm/ioremap_32.c b/arch/powerpc/mm/ioremap_32.c
index 9d13143b8be4..ca5bc6be3e6f 100644
--- a/arch/powerpc/mm/ioremap_32.c
+++ b/arch/powerpc/mm/ioremap_32.c
@@ -21,6 +21,13 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, pgprot_t prot, void *call
 	phys_addr_t p, offset;
 	int err;
 
+	/*
+	 * If the address lies within the first 16 MB, assume it's in ISA
+	 * memory space
+	 */
+	if (addr < SZ_16M)
+		addr += _ISA_MEM_BASE;
+
 	/*
 	 * Choose an address to map it to.
 	 * Once the vmalloc system is running, we use it.
@@ -31,13 +38,6 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, pgprot_t prot, void *call
 	offset = addr & ~PAGE_MASK;
 	size = PAGE_ALIGN(addr + size) - p;
 
-	/*
-	 * If the address lies within the first 16 MB, assume it's in ISA
-	 * memory space
-	 */
-	if (p < 16 * 1024 * 1024)
-		p += _ISA_MEM_BASE;
-
 #ifndef CONFIG_CRASH_DUMP
 	/*
 	 * Don't allow anybody to remap normal RAM that we're using.
@@ -63,7 +63,7 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, pgprot_t prot, void *call
 		return (void __iomem *)v + offset;
 
 	if (slab_is_available())
-		return do_ioremap(p, offset, size, prot, caller);
+		return generic_ioremap_prot(addr, size, prot);
 
 	/*
 	 * Should check if it is a candidate for a BAT mapping
@@ -87,7 +87,6 @@ void iounmap(volatile void __iomem *addr)
 	if (v_block_mapped((unsigned long)addr))
 		return;
 
-	if (addr > high_memory && (unsigned long)addr < ioremap_bot)
-		vunmap((void *)(PAGE_MASK & (unsigned long)addr));
+	generic_iounmap(addr);
 }
 EXPORT_SYMBOL(iounmap);
diff --git a/arch/powerpc/mm/ioremap_64.c b/arch/powerpc/mm/ioremap_64.c
index 3acece00b33e..d24e5f166723 100644
--- a/arch/powerpc/mm/ioremap_64.c
+++ b/arch/powerpc/mm/ioremap_64.c
@@ -29,7 +29,7 @@ void __iomem *__ioremap_caller(phys_addr_t addr, unsigned long size,
 		return NULL;
 
 	if (slab_is_available())
-		return do_ioremap(paligned, offset, size, prot, caller);
+		return generic_ioremap_prot(addr, size, prot);
 
 	pr_warn("ioremap() called early from %pS. Use early_ioremap() instead\n", caller);
 
@@ -49,17 +49,9 @@ void __iomem *__ioremap_caller(phys_addr_t addr, unsigned long size,
  */
 void iounmap(volatile void __iomem *token)
 {
-	void *addr;
-
 	if (!slab_is_available())
 		return;
 
-	addr = (void *)((unsigned long __force)PCI_FIX_ADDR(token) & PAGE_MASK);
-
-	if ((unsigned long)addr < ioremap_bot) {
-		pr_warn("Attempt to iounmap early bolted mapping at 0x%p\n", addr);
-		return;
-	}
-	vunmap(addr);
+	generic_iounmap(PCI_FIX_ADDR(token));
 }
 EXPORT_SYMBOL(iounmap);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v5 RESEND 01/17] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros
  2023-05-15  9:08 ` [PATCH v5 RESEND 01/17] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros Baoquan He
@ 2023-05-16  6:15   ` Mike Rapoport
  2023-05-16 12:54     ` Baoquan He
  2023-05-16  7:07   ` Geert Uytterhoeven
  2023-05-17  6:27   ` Christoph Hellwig
  2 siblings, 1 reply; 8+ messages in thread
From: Mike Rapoport @ 2023-05-16  6:15 UTC (permalink / raw)
  To: Baoquan He
  Cc: linux-arch, wangkefeng.wang, arnd, schnelle, netdev, deller, x86,
	linux-kernel, linux-mips, hch, linux-mm, linux-m68k, David.Laight,
	willy, loongarch, agordeev, linuxppc-dev, shorne

Hi,

On Mon, May 15, 2023 at 05:08:32PM +0800, Baoquan He wrote:
> Let's use '#define ioremap_xx' and "#ifdef ioremap_xx" instead.
> 
> For each architecture to remove defined ARCH_HAS_IOREMAP_xx macros in

This sentence seems to be stale.

> 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>.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>
> Cc: loongarch@lists.linux.dev
> Cc: linux-m68k@lists.linux-m68k.org
> Cc: linux-mips@vger.kernel.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: x86@kernel.org
> Cc: netdev@vger.kernel.org
> Cc: linux-arch@vger.kernel.org

Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>

> ---
>  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(-)
> 
> diff --git a/arch/loongarch/include/asm/io.h b/arch/loongarch/include/asm/io.h
> index 545e2708fbf7..5fef1246c6fb 100644
> --- a/arch/loongarch/include/asm/io.h
> +++ b/arch/loongarch/include/asm/io.h
> @@ -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>
>  
> diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h
> index d41fa488453b..6a0abd4846c6 100644
> --- a/arch/m68k/include/asm/io_mm.h
> +++ b/arch/m68k/include/asm/io_mm.h
> @@ -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
> diff --git a/arch/m68k/include/asm/kmap.h b/arch/m68k/include/asm/kmap.h
> index dec05743d426..4efb3efa593a 100644
> --- a/arch/m68k/include/asm/kmap.h
> +++ b/arch/m68k/include/asm/kmap.h
> @@ -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
> diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
> index cc28d207a061..477773328a06 100644
> --- a/arch/mips/include/asm/io.h
> +++ b/arch/mips/include/asm/io.h
> @@ -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 *addr);
>  #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
> diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
> index f1e657c9bbe8..67a3fb6de498 100644
> --- a/arch/powerpc/include/asm/io.h
> +++ b/arch/powerpc/include/asm/io.h
> @@ -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.
>   */
> diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
> index e9025640f634..76238842406a 100644
> --- a/arch/x86/include/asm/io.h
> +++ b/arch/x86/include/asm/io.h
> @@ -35,9 +35,6 @@
>    *  - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
>    */
>  
> -#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 *, int, size_t);
>  #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
> diff --git a/drivers/net/ethernet/sfc/io.h b/drivers/net/ethernet/sfc/io.h
> index 30439cc83a89..07f99ad14bf3 100644
> --- a/drivers/net/ethernet/sfc/io.h
> +++ b/drivers/net/ethernet/sfc/io.h
> @@ -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
> diff --git a/drivers/net/ethernet/sfc/siena/io.h b/drivers/net/ethernet/sfc/siena/io.h
> index 30439cc83a89..07f99ad14bf3 100644
> --- a/drivers/net/ethernet/sfc/siena/io.h
> +++ b/drivers/net/ethernet/sfc/siena/io.h
> @@ -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
> diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h
> index 08237ae8b840..196087a8126e 100644
> --- a/include/asm-generic/iomap.h
> +++ b/include/asm-generic/iomap.h
> @@ -93,15 +93,15 @@ extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
>  extern 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_np
>  static inline void __iomem *ioremap_np(phys_addr_t offset, size_t size)
> -- 
> 2.34.1
> 
> 

-- 
Sincerely yours,
Mike.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v5 RESEND 15/17] powerpc: mm: Convert to GENERIC_IOREMAP
  2023-05-15  9:08 ` [PATCH v5 RESEND 15/17] powerpc: mm: Convert to GENERIC_IOREMAP Baoquan He
@ 2023-05-16  7:00   ` Mike Rapoport
  2023-05-17  6:42   ` Christoph Hellwig
  1 sibling, 0 replies; 8+ messages in thread
From: Mike Rapoport @ 2023-05-16  7:00 UTC (permalink / raw)
  To: Baoquan He
  Cc: linux-arch, wangkefeng.wang, arnd, schnelle, deller,
	Nicholas Piggin, linux-kernel, hch, linux-mm, David.Laight, willy,
	agordeev, linuxppc-dev, shorne

On Mon, May 15, 2023 at 05:08:46PM +0800, Baoquan He wrote:
> From: Christophe Leroy <christophe.leroy@csgroup.eu>
> 
> 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 versions if there's
> arch specific handling in its ioremap_prot(), ioremap() or iounmap().
> This change will simplify implementation by removing duplicated codes
> with generic_ioremap_prot() and generic_iounmap(), and has the equivalent
> functioality as before.
> 
> Here, add wrapper functions ioremap_prot() and iounmap() for powerpc's
> special operation when ioremap() and iounmap().
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> Signed-off-by: Baoquan He <bhe@redhat.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: linuxppc-dev@lists.ozlabs.org

Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>

> ---
>  arch/powerpc/Kconfig          |  1 +
>  arch/powerpc/include/asm/io.h |  8 +++-----
>  arch/powerpc/mm/ioremap.c     | 26 +-------------------------
>  arch/powerpc/mm/ioremap_32.c  | 19 +++++++++----------
>  arch/powerpc/mm/ioremap_64.c  | 12 ++----------
>  5 files changed, 16 insertions(+), 50 deletions(-)
> 
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 539d1f03ff42..e0a88ebcd026 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -194,6 +194,7 @@ config PPC
>  	select GENERIC_CPU_VULNERABILITIES	if PPC_BARRIER_NOSPEC
>  	select GENERIC_EARLY_IOREMAP
>  	select GENERIC_GETTIMEOFDAY
> +	select GENERIC_IOREMAP
>  	select GENERIC_IRQ_SHOW
>  	select GENERIC_IRQ_SHOW_LEVEL
>  	select GENERIC_PCI_IOMAP		if PCI
> diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
> index 67a3fb6de498..0732b743e099 100644
> --- a/arch/powerpc/include/asm/io.h
> +++ b/arch/powerpc/include/asm/io.h
> @@ -889,8 +889,8 @@ static inline void iosync(void)
>   *
>   */
>  extern void __iomem *ioremap(phys_addr_t address, unsigned long size);
> -extern void __iomem *ioremap_prot(phys_addr_t address, unsigned long size,
> -				  unsigned long flags);
> +#define ioremap ioremap
> +#define ioremap_prot ioremap_prot
>  extern void __iomem *ioremap_wc(phys_addr_t address, unsigned long size);
>  #define ioremap_wc ioremap_wc
>  
> @@ -904,14 +904,12 @@ void __iomem *ioremap_coherent(phys_addr_t address, unsigned long size);
>  #define ioremap_cache(addr, size) \
>  	ioremap_prot((addr), (size), pgprot_val(PAGE_KERNEL))
>  
> -extern void iounmap(volatile void __iomem *addr);
> +#define iounmap iounmap
>  
>  void __iomem *ioremap_phb(phys_addr_t paddr, unsigned long size);
>  
>  int early_ioremap_range(unsigned long ea, phys_addr_t pa,
>  			unsigned long size, pgprot_t prot);
> -void __iomem *do_ioremap(phys_addr_t pa, phys_addr_t offset, unsigned long size,
> -			 pgprot_t prot, void *caller);
>  
>  extern void __iomem *__ioremap_caller(phys_addr_t, unsigned long size,
>  				      pgprot_t prot, void *caller);
> diff --git a/arch/powerpc/mm/ioremap.c b/arch/powerpc/mm/ioremap.c
> index 4f12504fb405..705e8e8ffde4 100644
> --- a/arch/powerpc/mm/ioremap.c
> +++ b/arch/powerpc/mm/ioremap.c
> @@ -41,7 +41,7 @@ void __iomem *ioremap_coherent(phys_addr_t addr, unsigned long size)
>  	return __ioremap_caller(addr, size, prot, caller);
>  }
>  
> -void __iomem *ioremap_prot(phys_addr_t addr, unsigned long size, unsigned long flags)
> +void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long flags)
>  {
>  	pte_t pte = __pte(flags);
>  	void *caller = __builtin_return_address(0);
> @@ -74,27 +74,3 @@ int early_ioremap_range(unsigned long ea, phys_addr_t pa,
>  
>  	return 0;
>  }
> -
> -void __iomem *do_ioremap(phys_addr_t pa, phys_addr_t offset, unsigned long size,
> -			 pgprot_t prot, void *caller)
> -{
> -	struct vm_struct *area;
> -	int ret;
> -	unsigned long va;
> -
> -	area = __get_vm_area_caller(size, VM_IOREMAP, IOREMAP_START, IOREMAP_END, caller);
> -	if (area == NULL)
> -		return NULL;
> -
> -	area->phys_addr = pa;
> -	va = (unsigned long)area->addr;
> -
> -	ret = ioremap_page_range(va, va + size, pa, prot);
> -	if (!ret)
> -		return (void __iomem *)area->addr + offset;
> -
> -	vunmap_range(va, va + size);
> -	free_vm_area(area);
> -
> -	return NULL;
> -}
> diff --git a/arch/powerpc/mm/ioremap_32.c b/arch/powerpc/mm/ioremap_32.c
> index 9d13143b8be4..ca5bc6be3e6f 100644
> --- a/arch/powerpc/mm/ioremap_32.c
> +++ b/arch/powerpc/mm/ioremap_32.c
> @@ -21,6 +21,13 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, pgprot_t prot, void *call
>  	phys_addr_t p, offset;
>  	int err;
>  
> +	/*
> +	 * If the address lies within the first 16 MB, assume it's in ISA
> +	 * memory space
> +	 */
> +	if (addr < SZ_16M)
> +		addr += _ISA_MEM_BASE;
> +
>  	/*
>  	 * Choose an address to map it to.
>  	 * Once the vmalloc system is running, we use it.
> @@ -31,13 +38,6 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, pgprot_t prot, void *call
>  	offset = addr & ~PAGE_MASK;
>  	size = PAGE_ALIGN(addr + size) - p;
>  
> -	/*
> -	 * If the address lies within the first 16 MB, assume it's in ISA
> -	 * memory space
> -	 */
> -	if (p < 16 * 1024 * 1024)
> -		p += _ISA_MEM_BASE;
> -
>  #ifndef CONFIG_CRASH_DUMP
>  	/*
>  	 * Don't allow anybody to remap normal RAM that we're using.
> @@ -63,7 +63,7 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, pgprot_t prot, void *call
>  		return (void __iomem *)v + offset;
>  
>  	if (slab_is_available())
> -		return do_ioremap(p, offset, size, prot, caller);
> +		return generic_ioremap_prot(addr, size, prot);
>  
>  	/*
>  	 * Should check if it is a candidate for a BAT mapping
> @@ -87,7 +87,6 @@ void iounmap(volatile void __iomem *addr)
>  	if (v_block_mapped((unsigned long)addr))
>  		return;
>  
> -	if (addr > high_memory && (unsigned long)addr < ioremap_bot)
> -		vunmap((void *)(PAGE_MASK & (unsigned long)addr));
> +	generic_iounmap(addr);
>  }
>  EXPORT_SYMBOL(iounmap);
> diff --git a/arch/powerpc/mm/ioremap_64.c b/arch/powerpc/mm/ioremap_64.c
> index 3acece00b33e..d24e5f166723 100644
> --- a/arch/powerpc/mm/ioremap_64.c
> +++ b/arch/powerpc/mm/ioremap_64.c
> @@ -29,7 +29,7 @@ void __iomem *__ioremap_caller(phys_addr_t addr, unsigned long size,
>  		return NULL;
>  
>  	if (slab_is_available())
> -		return do_ioremap(paligned, offset, size, prot, caller);
> +		return generic_ioremap_prot(addr, size, prot);
>  
>  	pr_warn("ioremap() called early from %pS. Use early_ioremap() instead\n", caller);
>  
> @@ -49,17 +49,9 @@ void __iomem *__ioremap_caller(phys_addr_t addr, unsigned long size,
>   */
>  void iounmap(volatile void __iomem *token)
>  {
> -	void *addr;
> -
>  	if (!slab_is_available())
>  		return;
>  
> -	addr = (void *)((unsigned long __force)PCI_FIX_ADDR(token) & PAGE_MASK);
> -
> -	if ((unsigned long)addr < ioremap_bot) {
> -		pr_warn("Attempt to iounmap early bolted mapping at 0x%p\n", addr);
> -		return;
> -	}
> -	vunmap(addr);
> +	generic_iounmap(PCI_FIX_ADDR(token));
>  }
>  EXPORT_SYMBOL(iounmap);
> -- 
> 2.34.1
> 
> 

-- 
Sincerely yours,
Mike.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v5 RESEND 01/17] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros
  2023-05-15  9:08 ` [PATCH v5 RESEND 01/17] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros Baoquan He
  2023-05-16  6:15   ` Mike Rapoport
@ 2023-05-16  7:07   ` Geert Uytterhoeven
  2023-05-17  6:27   ` Christoph Hellwig
  2 siblings, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2023-05-16  7:07 UTC (permalink / raw)
  To: Baoquan He
  Cc: linux-arch, wangkefeng.wang, arnd, schnelle, netdev, deller, x86,
	linux-kernel, linux-mips, hch, linux-mm, linux-m68k, David.Laight,
	willy, loongarch, agordeev, linuxppc-dev, shorne

On Mon, May 15, 2023 at 11:14 AM Baoquan He <bhe@redhat.com> wrote:
> Let's use '#define ioremap_xx' and "#ifdef ioremap_xx" instead.
>
> For each architecture to remove defined ARCH_HAS_IOREMAP_xx macros in
> 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>.
>
> Signed-off-by: Baoquan He <bhe@redhat.com>

>  arch/m68k/include/asm/io_mm.h       | 2 --
>  arch/m68k/include/asm/kmap.h        | 2 --

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v5 RESEND 01/17] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros
  2023-05-16  6:15   ` Mike Rapoport
@ 2023-05-16 12:54     ` Baoquan He
  0 siblings, 0 replies; 8+ messages in thread
From: Baoquan He @ 2023-05-16 12:54 UTC (permalink / raw)
  To: Mike Rapoport
  Cc: linux-arch, wangkefeng.wang, arnd, schnelle, netdev, deller, x86,
	linux-kernel, linux-mips, hch, linux-mm, linux-m68k, David.Laight,
	willy, loongarch, agordeev, linuxppc-dev, shorne

On 05/16/23 at 09:15am, Mike Rapoport wrote:
> Hi,
> 
> On Mon, May 15, 2023 at 05:08:32PM +0800, Baoquan He wrote:
> > Let's use '#define ioremap_xx' and "#ifdef ioremap_xx" instead.
> > 
> > For each architecture to remove defined ARCH_HAS_IOREMAP_xx macros in
> 
> This sentence seems to be stale.

Right, will remove this, thanks a lot for careful reviewing.

> 
> > 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>.
> > 
> > Signed-off-by: Baoquan He <bhe@redhat.com>
> > Cc: loongarch@lists.linux.dev
> > Cc: linux-m68k@lists.linux-m68k.org
> > Cc: linux-mips@vger.kernel.org
> > Cc: linuxppc-dev@lists.ozlabs.org
> > Cc: x86@kernel.org
> > Cc: netdev@vger.kernel.org
> > Cc: linux-arch@vger.kernel.org
> 
> Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
> 
> > ---
> >  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(-)
> > 
> > diff --git a/arch/loongarch/include/asm/io.h b/arch/loongarch/include/asm/io.h
> > index 545e2708fbf7..5fef1246c6fb 100644
> > --- a/arch/loongarch/include/asm/io.h
> > +++ b/arch/loongarch/include/asm/io.h
> > @@ -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>
> >  
> > diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h
> > index d41fa488453b..6a0abd4846c6 100644
> > --- a/arch/m68k/include/asm/io_mm.h
> > +++ b/arch/m68k/include/asm/io_mm.h
> > @@ -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
> > diff --git a/arch/m68k/include/asm/kmap.h b/arch/m68k/include/asm/kmap.h
> > index dec05743d426..4efb3efa593a 100644
> > --- a/arch/m68k/include/asm/kmap.h
> > +++ b/arch/m68k/include/asm/kmap.h
> > @@ -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
> > diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
> > index cc28d207a061..477773328a06 100644
> > --- a/arch/mips/include/asm/io.h
> > +++ b/arch/mips/include/asm/io.h
> > @@ -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 *addr);
> >  #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
> > diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
> > index f1e657c9bbe8..67a3fb6de498 100644
> > --- a/arch/powerpc/include/asm/io.h
> > +++ b/arch/powerpc/include/asm/io.h
> > @@ -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.
> >   */
> > diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
> > index e9025640f634..76238842406a 100644
> > --- a/arch/x86/include/asm/io.h
> > +++ b/arch/x86/include/asm/io.h
> > @@ -35,9 +35,6 @@
> >    *  - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
> >    */
> >  
> > -#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 *, int, size_t);
> >  #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
> > diff --git a/drivers/net/ethernet/sfc/io.h b/drivers/net/ethernet/sfc/io.h
> > index 30439cc83a89..07f99ad14bf3 100644
> > --- a/drivers/net/ethernet/sfc/io.h
> > +++ b/drivers/net/ethernet/sfc/io.h
> > @@ -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
> > diff --git a/drivers/net/ethernet/sfc/siena/io.h b/drivers/net/ethernet/sfc/siena/io.h
> > index 30439cc83a89..07f99ad14bf3 100644
> > --- a/drivers/net/ethernet/sfc/siena/io.h
> > +++ b/drivers/net/ethernet/sfc/siena/io.h
> > @@ -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
> > diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h
> > index 08237ae8b840..196087a8126e 100644
> > --- a/include/asm-generic/iomap.h
> > +++ b/include/asm-generic/iomap.h
> > @@ -93,15 +93,15 @@ extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
> >  extern 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_np
> >  static inline void __iomem *ioremap_np(phys_addr_t offset, size_t size)
> > -- 
> > 2.34.1
> > 
> > 
> 
> -- 
> Sincerely yours,
> Mike.
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v5 RESEND 01/17] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros
  2023-05-15  9:08 ` [PATCH v5 RESEND 01/17] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros Baoquan He
  2023-05-16  6:15   ` Mike Rapoport
  2023-05-16  7:07   ` Geert Uytterhoeven
@ 2023-05-17  6:27   ` Christoph Hellwig
  2 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2023-05-17  6:27 UTC (permalink / raw)
  To: Baoquan He
  Cc: linux-arch, wangkefeng.wang, arnd, schnelle, netdev, deller, x86,
	linux-kernel, linux-mips, hch, linux-mm, linux-m68k, David.Laight,
	willy, loongarch, agordeev, linuxppc-dev, shorne

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v5 RESEND 15/17] powerpc: mm: Convert to GENERIC_IOREMAP
  2023-05-15  9:08 ` [PATCH v5 RESEND 15/17] powerpc: mm: Convert to GENERIC_IOREMAP Baoquan He
  2023-05-16  7:00   ` Mike Rapoport
@ 2023-05-17  6:42   ` Christoph Hellwig
  1 sibling, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2023-05-17  6:42 UTC (permalink / raw)
  To: Baoquan He
  Cc: linux-arch, wangkefeng.wang, arnd, schnelle, deller,
	Nicholas Piggin, linux-kernel, hch, linux-mm, David.Laight, willy,
	agordeev, linuxppc-dev, shorne

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-05-17  6:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230515090848.833045-1-bhe@redhat.com>
2023-05-15  9:08 ` [PATCH v5 RESEND 01/17] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros Baoquan He
2023-05-16  6:15   ` Mike Rapoport
2023-05-16 12:54     ` Baoquan He
2023-05-16  7:07   ` Geert Uytterhoeven
2023-05-17  6:27   ` Christoph Hellwig
2023-05-15  9:08 ` [PATCH v5 RESEND 15/17] powerpc: mm: Convert to GENERIC_IOREMAP Baoquan He
2023-05-16  7:00   ` Mike Rapoport
2023-05-17  6:42   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).