2023-07-06 16:05:31

by Baoquan He

[permalink] [raw]
Subject: [PATCH v8 00/19] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way

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.

History:
=======
v7->v8:
- Fix the error reported by lkp test robot on patch
[PATCH v7 02/19] hexagon: mm: Convert to GENERIC_IOREMAP
Thanks to Nathan for providing the code fix after reproducing.
- Fix the conflict in patch 15 when rebasing to latest linus's
tree because of earlier commit ef104443bffa.

v6->v7:
- Fix the building error on s390 and hexagon reported by lkp test robot.
- Add Christoph, Mike, Catalin and Helge's ack.

v5->v6:
- Remove stale descriptions in log - Mike
- Remove the early unmapping handling from fixmap pool in iounmap() in
openrisc; Based on that, iounmap() in openrisc ARCH can be removed - Mike
- Add WARN_ON_ONCE to aid debugging in generic_ioremap_prot() - Christoph
- Split the inclusion of include/asm-generic/io.h and redefining of the
helpers from the old patch 11 into a prep patch; The following patch
can only contain code converting to GENERIC_IOREMAP for SuperH - Christoph
- Add header file linux/ioremap.h and move is_ioremap_addr() over
there - Christoph

v4->v5:
- Ard and Christophe suggested adding a preparation patch to remove
ARCH_HAS_IOREMAP_xx macros, this is done in newly added patch 1.
- In the current patch 13 ("parisc: mm: Convert to GENERIC_IOREMAP"),
so we don't need to add ARCH_HAS_IOREMAP_WC.

v3->v4:
- Change to contain arch specific handling in wrapper function
ioremap(), ioremap_prot() or iounmap() to replace the old hook
ioremap|iounmap_allowed() hook way for each arch.
- Add two patches to convert powerpc to GENERIC_IOREMAP. They are
picked from above Christophe's RFC patchset, I made some changes
to make them formal.

v2->v3:
- Rewrite log of all patches to add more details as Christoph suggested.

- Merge the old patch 1 and 2 which adjusts return values and
parameters of arch_ioremap() into one patch, namely the current
patch 3. Christoph suggested this.

- Change the return value of arch_iounmap() to bool type since we only
do arch specific address filtering or address checking, bool value
can reflect the checking better. This is pointed out by Niklas when
he reviewed the s390 patch.

- Put hexagon patch at the beginning of patchset since hexagon has the
same ioremap() and iounmap() as standard ones, no arch_ioremap() and
arch_iounmap() hooks need be introduced. So the later arch_ioremap
and arch_iounmap() adjustment are not related in hexagon. Christophe
suggested this.

- Remove the early ioremap code from openrisc ioremap() firstly since
openrisc doesn't have early ioremap handling in openrisc arch code.
This simplifies the later converting to GENERIC_IOREMAP method.
Christoph and Stafford suggersted this.

- Fix compiling erorrs reported by lkp in parisc and sh patches.
Adding macro defintions for those port|mem io functions in
<asm/io.h> to avoid repeated definition in <asm-generic/io.h>.

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().

Baoquan He (16):
asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros
hexagon: mm: Convert to GENERIC_IOREMAP
openrisc: mm: remove unneeded early ioremap code
mm: ioremap: allow ARCH to have its own ioremap method definition
mm/ioremap: add slab availability checking in ioremap_prot
arc: mm: Convert to GENERIC_IOREMAP
ia64: mm: Convert to GENERIC_IOREMAP
openrisc: mm: Convert to GENERIC_IOREMAP
s390: mm: Convert to GENERIC_IOREMAP
sh: add <asm-generic/io.h> including
sh: mm: Convert to GENERIC_IOREMAP
xtensa: mm: Convert to GENERIC_IOREMAP
parisc: mm: Convert to GENERIC_IOREMAP
mm: move is_ioremap_addr() into new header file
arm64 : mm: add wrapper function ioremap_prot()
mm: ioremap: remove unneeded ioremap_allowed and iounmap_allowed

Christophe Leroy (3):
mm/ioremap: Define generic_ioremap_prot() and generic_iounmap()
mm/ioremap: Consider IOREMAP space in generic ioremap
powerpc: mm: Convert to GENERIC_IOREMAP

arch/arc/Kconfig | 1 +
arch/arc/include/asm/io.h | 7 ++-
arch/arc/mm/ioremap.c | 49 ++---------------
arch/arm64/include/asm/io.h | 3 +-
arch/arm64/mm/ioremap.c | 10 ++--
arch/hexagon/Kconfig | 1 +
arch/hexagon/include/asm/io.h | 11 ++--
arch/hexagon/kernel/hexagon_ksyms.c | 2 -
arch/hexagon/mm/Makefile | 2 +-
arch/hexagon/mm/ioremap.c | 44 ----------------
arch/ia64/Kconfig | 1 +
arch/ia64/include/asm/io.h | 13 ++---
arch/ia64/mm/ioremap.c | 41 +++------------
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/openrisc/Kconfig | 1 +
arch/openrisc/include/asm/io.h | 11 ++--
arch/openrisc/mm/ioremap.c | 82 -----------------------------
arch/parisc/Kconfig | 1 +
arch/parisc/include/asm/io.h | 15 ++++--
arch/parisc/mm/ioremap.c | 62 ++--------------------
arch/powerpc/Kconfig | 1 +
arch/powerpc/include/asm/io.h | 17 ++----
arch/powerpc/include/asm/pgtable.h | 10 ----
arch/powerpc/mm/ioremap.c | 26 +--------
arch/powerpc/mm/ioremap_32.c | 19 ++++---
arch/powerpc/mm/ioremap_64.c | 12 +----
arch/s390/Kconfig | 1 +
arch/s390/include/asm/io.h | 21 ++++----
arch/s390/kernel/perf_cpum_sf.c | 2 +-
arch/s390/pci/pci.c | 57 ++++----------------
arch/sh/Kconfig | 1 +
arch/sh/include/asm/io.h | 65 ++++++++++++-----------
arch/sh/include/asm/io_noioport.h | 7 +++
arch/sh/mm/ioremap.c | 65 ++++-------------------
arch/x86/include/asm/io.h | 5 --
arch/xtensa/Kconfig | 1 +
arch/xtensa/include/asm/io.h | 32 +++++------
arch/xtensa/mm/ioremap.c | 58 +++++---------------
drivers/net/ethernet/sfc/io.h | 2 +-
drivers/net/ethernet/sfc/siena/io.h | 2 +-
include/asm-generic/io.h | 31 +++--------
include/asm-generic/iomap.h | 6 +--
include/linux/ioremap.h | 30 +++++++++++
include/linux/mm.h | 5 --
kernel/iomem.c | 1 +
mm/ioremap.c | 41 ++++++++++-----
49 files changed, 249 insertions(+), 637 deletions(-)
delete mode 100644 arch/hexagon/mm/ioremap.c
create mode 100644 include/linux/ioremap.h

--
2.34.1



2023-07-06 16:07:16

by Baoquan He

[permalink] [raw]
Subject: [PATCH v8 08/19] ia64: mm: Convert to 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 versions if there's
arch specific handling in its ioremap_prot(), ioremap() or iounmap().
This change will simplify implementation by removing duplicated code
with generic_ioremap_prot() and generic_iounmap(), and has the equivalent
functioality as before.

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

Signed-off-by: Baoquan He <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Mike Rapoport (IBM) <[email protected]>
Cc: [email protected]
---
arch/ia64/Kconfig | 1 +
arch/ia64/include/asm/io.h | 13 +++++-------
arch/ia64/mm/ioremap.c | 41 ++++++--------------------------------
3 files changed, 12 insertions(+), 43 deletions(-)

diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 2cd93e6bf0fe..3ab75f36c037 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -47,6 +47,7 @@ config IA64
select GENERIC_IRQ_LEGACY
select ARCH_HAVE_NMI_SAFE_CMPXCHG
select GENERIC_IOMAP
+ select GENERIC_IOREMAP
select GENERIC_SMP_IDLE_THREAD
select ARCH_TASK_STRUCT_ON_STACK
select ARCH_TASK_STRUCT_ALLOCATOR
diff --git a/arch/ia64/include/asm/io.h b/arch/ia64/include/asm/io.h
index 83a492c8d298..eedc0afa8cad 100644
--- a/arch/ia64/include/asm/io.h
+++ b/arch/ia64/include/asm/io.h
@@ -243,15 +243,12 @@ static inline void outsl(unsigned long port, const void *src,

# ifdef __KERNEL__

-extern void __iomem * ioremap(unsigned long offset, unsigned long size);
+#define _PAGE_IOREMAP pgprot_val(PAGE_KERNEL)
+
extern void __iomem * ioremap_uc(unsigned long offset, unsigned long size);
-extern void iounmap (volatile void __iomem *addr);
-static inline void __iomem * ioremap_cache (unsigned long phys_addr, unsigned long size)
-{
- return ioremap(phys_addr, size);
-}
-#define ioremap ioremap
-#define ioremap_cache ioremap_cache
+
+#define ioremap_prot ioremap_prot
+#define ioremap_cache ioremap
#define ioremap_uc ioremap_uc
#define iounmap iounmap

diff --git a/arch/ia64/mm/ioremap.c b/arch/ia64/mm/ioremap.c
index 92b81bc91397..711b6abc822e 100644
--- a/arch/ia64/mm/ioremap.c
+++ b/arch/ia64/mm/ioremap.c
@@ -29,13 +29,9 @@ early_ioremap (unsigned long phys_addr, unsigned long size)
return __ioremap_uc(phys_addr);
}

-void __iomem *
-ioremap (unsigned long phys_addr, unsigned long size)
+void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
+ unsigned long flags)
{
- void __iomem *addr;
- struct vm_struct *area;
- unsigned long offset;
- pgprot_t prot;
u64 attr;
unsigned long gran_base, gran_size;
unsigned long page_base;
@@ -68,36 +64,12 @@ ioremap (unsigned long phys_addr, unsigned long size)
*/
page_base = phys_addr & PAGE_MASK;
size = PAGE_ALIGN(phys_addr + size) - page_base;
- if (efi_mem_attribute(page_base, size) & EFI_MEMORY_WB) {
- prot = PAGE_KERNEL;
-
- /*
- * Mappings have to be page-aligned
- */
- offset = phys_addr & ~PAGE_MASK;
- phys_addr &= PAGE_MASK;
-
- /*
- * Ok, go for it..
- */
- area = get_vm_area(size, VM_IOREMAP);
- if (!area)
- return NULL;
-
- area->phys_addr = phys_addr;
- addr = (void __iomem *) area->addr;
- if (ioremap_page_range((unsigned long) addr,
- (unsigned long) addr + size, phys_addr, prot)) {
- vunmap((void __force *) addr);
- return NULL;
- }
-
- return (void __iomem *) (offset + (char __iomem *)addr);
- }
+ if (efi_mem_attribute(page_base, size) & EFI_MEMORY_WB)
+ return generic_ioremap_prot(phys_addr, size, __pgprot(flags));

return __ioremap_uc(phys_addr);
}
-EXPORT_SYMBOL(ioremap);
+EXPORT_SYMBOL(ioremap_prot);

void __iomem *
ioremap_uc(unsigned long phys_addr, unsigned long size)
@@ -114,8 +86,7 @@ early_iounmap (volatile void __iomem *addr, unsigned long size)
{
}

-void
-iounmap (volatile void __iomem *addr)
+void iounmap(volatile void __iomem *addr)
{
if (REGION_NUMBER(addr) == RGN_GATE)
vunmap((void *) ((unsigned long) addr & PAGE_MASK));
--
2.34.1


2023-07-06 16:09:55

by Baoquan He

[permalink] [raw]
Subject: [PATCH v8 16/19] mm: move is_ioremap_addr() into new header file

Now is_ioremap_addr() is only used in kernel/iomem.c and gonna be used
in mm/ioremap.c. Move it into its own new header file linux/ioremap.h.

Suggested-by: Christoph Hellwig <[email protected]>
Signed-off-by: Baoquan He <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
---
v7->v8:
Fix conflict when rebasing to the latest linus's tree, it's caused by
commit ef104443bffa ("procfs: consolidate arch_report_meminfo declaration")
in file arch/powerpc/include/asm/pgtable.h.

arch/powerpc/include/asm/pgtable.h | 10 ----------
include/linux/ioremap.h | 30 ++++++++++++++++++++++++++++++
include/linux/mm.h | 5 -----
kernel/iomem.c | 1 +
mm/ioremap.c | 10 +---------
5 files changed, 32 insertions(+), 24 deletions(-)
create mode 100644 include/linux/ioremap.h

diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
index 6a88bfdaa69b..445a22987aa3 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -157,16 +157,6 @@ static inline pgtable_t pmd_pgtable(pmd_t pmd)
return (pgtable_t)pmd_page_vaddr(pmd);
}

-#ifdef CONFIG_PPC64
-#define is_ioremap_addr is_ioremap_addr
-static inline bool is_ioremap_addr(const void *x)
-{
- unsigned long addr = (unsigned long)x;
-
- return addr >= IOREMAP_BASE && addr < IOREMAP_END;
-}
-#endif /* CONFIG_PPC64 */
-
#endif /* __ASSEMBLY__ */

#endif /* _ASM_POWERPC_PGTABLE_H */
diff --git a/include/linux/ioremap.h b/include/linux/ioremap.h
new file mode 100644
index 000000000000..f0e99fc7dd8b
--- /dev/null
+++ b/include/linux/ioremap.h
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_IOREMAP_H
+#define _LINUX_IOREMAP_H
+
+#include <linux/kasan.h>
+#include <asm/pgtable.h>
+
+#if defined(CONFIG_HAS_IOMEM) || defined(CONFIG_GENERIC_IOREMAP)
+/*
+ * Ioremap often, but not always uses the generic vmalloc area. E.g on
+ * Power ARCH, it could have different ioremap space.
+ */
+#ifndef IOREMAP_START
+#define IOREMAP_START VMALLOC_START
+#define IOREMAP_END VMALLOC_END
+#endif
+static inline bool is_ioremap_addr(const void *x)
+{
+ unsigned long addr = (unsigned long)kasan_reset_tag(x);
+
+ return addr >= IOREMAP_START && addr < IOREMAP_END;
+}
+#else
+static inline bool is_ioremap_addr(const void *x)
+{
+ return false;
+}
+#endif
+
+#endif /* _LINUX_IOREMAP_H */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 2dd73e4f3d8e..2bac9ec3527e 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1055,11 +1055,6 @@ unsigned long vmalloc_to_pfn(const void *addr);
* On nommu, vmalloc/vfree wrap through kmalloc/kfree directly, so there
* is no special casing required.
*/
-
-#ifndef is_ioremap_addr
-#define is_ioremap_addr(x) is_vmalloc_addr(x)
-#endif
-
#ifdef CONFIG_MMU
extern bool is_vmalloc_addr(const void *x);
extern int is_vmalloc_or_module_addr(const void *x);
diff --git a/kernel/iomem.c b/kernel/iomem.c
index 62c92e43aa0d..9682471e6471 100644
--- a/kernel/iomem.c
+++ b/kernel/iomem.c
@@ -3,6 +3,7 @@
#include <linux/types.h>
#include <linux/io.h>
#include <linux/mm.h>
+#include <linux/ioremap.h>

#ifndef ioremap_cache
/* temporary while we convert existing ioremap_cache users to memremap */
diff --git a/mm/ioremap.c b/mm/ioremap.c
index 68d9895144ad..a21a6c9fa5ab 100644
--- a/mm/ioremap.c
+++ b/mm/ioremap.c
@@ -10,15 +10,7 @@
#include <linux/mm.h>
#include <linux/io.h>
#include <linux/export.h>
-
-/*
- * Ioremap often, but not always uses the generic vmalloc area. E.g on
- * Power ARCH, it could have different ioremap space.
- */
-#ifndef IOREMAP_START
-#define IOREMAP_START VMALLOC_START
-#define IOREMAP_END VMALLOC_END
-#endif
+#include <linux/ioremap.h>

void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size,
pgprot_t prot)
--
2.34.1


2023-07-06 16:10:07

by Baoquan He

[permalink] [raw]
Subject: [PATCH v8 01/19] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros

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>.

Signed-off-by: Baoquan He <[email protected]>
Acked-by: Geert Uytterhoeven <[email protected]>
Reviewed-by: Mike Rapoport (IBM) <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
---
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 1c9410220040..0dcb36b32cb2 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 affd21e9c20b..062dd4e6b954 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 <[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 *, 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


2023-07-06 16:12:33

by Baoquan He

[permalink] [raw]
Subject: [PATCH v8 09/19] openrisc: mm: Convert to 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 versions if there's
arch specific handling in its ioremap_prot(), ioremap() or iounmap().
This change will simplify implementation by removing duplicated code
with generic_ioremap_prot() and generic_iounmap(), and has the equivalent
functioality as before.

For openrisc, the current ioremap() and iounmap() are the same as
generic version. After taking GENERIC_IOREMAP way, the old ioremap()
and iounmap() can be completely removed.

Signed-off-by: Baoquan He <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Mike Rapoport (IBM) <[email protected]>
Cc: Stafford Horne <[email protected]>
Cc: Jonas Bonn <[email protected]>
Cc: Stefan Kristiansson <[email protected]>
Cc: [email protected]
---
arch/openrisc/Kconfig | 1 +
arch/openrisc/include/asm/io.h | 11 ++++----
arch/openrisc/mm/ioremap.c | 49 ----------------------------------
3 files changed, 7 insertions(+), 54 deletions(-)

diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index c7f282f60f64..fd9bb76a610b 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -21,6 +21,7 @@ config OPENRISC
select GENERIC_IRQ_PROBE
select GENERIC_IRQ_SHOW
select GENERIC_PCI_IOMAP
+ select GENERIC_IOREMAP
select GENERIC_CPU_DEVICES
select HAVE_PCI
select HAVE_UID16
diff --git a/arch/openrisc/include/asm/io.h b/arch/openrisc/include/asm/io.h
index ee6043a03173..5a6f0f16a5ce 100644
--- a/arch/openrisc/include/asm/io.h
+++ b/arch/openrisc/include/asm/io.h
@@ -15,6 +15,8 @@
#define __ASM_OPENRISC_IO_H

#include <linux/types.h>
+#include <asm/pgalloc.h>
+#include <asm/pgtable.h>

/*
* PCI: We do not use IO ports in OpenRISC
@@ -27,11 +29,10 @@
#define PIO_OFFSET 0
#define PIO_MASK 0

-#define ioremap ioremap
-void __iomem *ioremap(phys_addr_t offset, unsigned long size);
-
-#define iounmap iounmap
-extern void iounmap(volatile void __iomem *addr);
+/*
+ * I/O memory mapping functions.
+ */
+#define _PAGE_IOREMAP (pgprot_val(PAGE_KERNEL) | _PAGE_CI)

#include <asm-generic/io.h>

diff --git a/arch/openrisc/mm/ioremap.c b/arch/openrisc/mm/ioremap.c
index cdbcc7e73684..91c8259d4b7e 100644
--- a/arch/openrisc/mm/ioremap.c
+++ b/arch/openrisc/mm/ioremap.c
@@ -22,55 +22,6 @@

extern int mem_init_done;

-/*
- * Remap an arbitrary physical address space into the kernel virtual
- * address space. Needed when the kernel wants to access high addresses
- * directly.
- *
- * NOTE! We need to allow non-page-aligned mappings too: we will obviously
- * have to convert them into an offset in a page-aligned mapping, but the
- * caller shouldn't need to know that small detail.
- */
-void __iomem *__ref ioremap(phys_addr_t addr, unsigned long size)
-{
- phys_addr_t p;
- unsigned long v;
- unsigned long offset, last_addr;
- struct vm_struct *area = NULL;
-
- /* Don't allow wraparound or zero size */
- last_addr = addr + size - 1;
- if (!size || last_addr < addr)
- return NULL;
-
- /*
- * Mappings have to be page-aligned
- */
- offset = addr & ~PAGE_MASK;
- p = addr & PAGE_MASK;
- size = PAGE_ALIGN(last_addr + 1) - p;
-
- area = get_vm_area(size, VM_IOREMAP);
- if (!area)
- return NULL;
- v = (unsigned long)area->addr;
-
- if (ioremap_page_range(v, v + size, p,
- __pgprot(pgprot_val(PAGE_KERNEL) | _PAGE_CI))) {
- vfree(area->addr);
- return NULL;
- }
-
- return (void __iomem *)(offset + (char *)v);
-}
-EXPORT_SYMBOL(ioremap);
-
-void iounmap(volatile void __iomem *addr)
-{
- return vfree((void *)(PAGE_MASK & (unsigned long)addr));
-}
-EXPORT_SYMBOL(iounmap);
-
/**
* OK, this one's a bit tricky... ioremap can get called before memory is
* initialized (early serial console does this) and will want to alloc a page
--
2.34.1


2023-07-06 16:13:35

by Baoquan He

[permalink] [raw]
Subject: [PATCH v8 18/19] arm64 : mm: add wrapper function ioremap_prot()

Since hook functions ioremap_allowed() and iounmap_allowed() will be
obsoleted, add wrapper function ioremap_prot() to contain the
the specific handling in addition to generic_ioremap_prot() invocation.

Signed-off-by: Baoquan He <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Kefeng Wang <[email protected]>
Reviewed-by: Mike Rapoport (IBM) <[email protected]>
Acked-by: Catalin Marinas <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: [email protected]
---
arch/arm64/include/asm/io.h | 3 +--
arch/arm64/mm/ioremap.c | 10 ++++++----
2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index 51d92abf945e..3b694511b98f 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -139,8 +139,7 @@ extern void __memset_io(volatile void __iomem *, int, size_t);
* I/O memory mapping functions.
*/

-bool ioremap_allowed(phys_addr_t phys_addr, size_t size, unsigned long prot);
-#define ioremap_allowed ioremap_allowed
+#define ioremap_prot ioremap_prot

#define _PAGE_IOREMAP PROT_DEVICE_nGnRE

diff --git a/arch/arm64/mm/ioremap.c b/arch/arm64/mm/ioremap.c
index c5af103d4ad4..269f2f63ab7d 100644
--- a/arch/arm64/mm/ioremap.c
+++ b/arch/arm64/mm/ioremap.c
@@ -3,20 +3,22 @@
#include <linux/mm.h>
#include <linux/io.h>

-bool ioremap_allowed(phys_addr_t phys_addr, size_t size, unsigned long prot)
+void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
+ unsigned long prot)
{
unsigned long last_addr = phys_addr + size - 1;

/* Don't allow outside PHYS_MASK */
if (last_addr & ~PHYS_MASK)
- return false;
+ return NULL;

/* Don't allow RAM to be mapped. */
if (WARN_ON(pfn_is_map_memory(__phys_to_pfn(phys_addr))))
- return false;
+ return NULL;

- return true;
+ return generic_ioremap_prot(phys_addr, size, __pgprot(prot));
}
+EXPORT_SYMBOL(ioremap_prot);

/*
* Must be called after early_fixmap_init
--
2.34.1


2023-07-06 16:14:57

by Baoquan He

[permalink] [raw]
Subject: [PATCH v8 15/19] mm/ioremap: Consider IOREMAP space in generic ioremap

From: Christophe Leroy <[email protected]>

Architectures like powerpc have a dedicated space for IOREMAP mappings.

If so, use it in generic_ioremap_prot().

Signed-off-by: Christophe Leroy <[email protected]>
Signed-off-by: Baoquan He <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
---
mm/ioremap.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/mm/ioremap.c b/mm/ioremap.c
index 86b82ec27d2b..68d9895144ad 100644
--- a/mm/ioremap.c
+++ b/mm/ioremap.c
@@ -11,6 +11,15 @@
#include <linux/io.h>
#include <linux/export.h>

+/*
+ * Ioremap often, but not always uses the generic vmalloc area. E.g on
+ * Power ARCH, it could have different ioremap space.
+ */
+#ifndef IOREMAP_START
+#define IOREMAP_START VMALLOC_START
+#define IOREMAP_END VMALLOC_END
+#endif
+
void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size,
pgprot_t prot)
{
@@ -35,8 +44,8 @@ void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size,
if (!ioremap_allowed(phys_addr, size, pgprot_val(prot)))
return NULL;

- area = get_vm_area_caller(size, VM_IOREMAP,
- __builtin_return_address(0));
+ area = __get_vm_area_caller(size, VM_IOREMAP, IOREMAP_START,
+ IOREMAP_END, __builtin_return_address(0));
if (!area)
return NULL;
vaddr = (unsigned long)area->addr;
@@ -66,7 +75,7 @@ void generic_iounmap(volatile void __iomem *addr)
if (!iounmap_allowed(vaddr))
return;

- if (is_vmalloc_addr(vaddr))
+ if (is_ioremap_addr(vaddr))
vunmap(vaddr);
}

--
2.34.1


2023-07-06 16:15:00

by Baoquan He

[permalink] [raw]
Subject: [PATCH v8 17/19] powerpc: mm: Convert to GENERIC_IOREMAP

From: Christophe Leroy <[email protected]>

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 code
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 <[email protected]>
Signed-off-by: Baoquan He <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Mike Rapoport (IBM) <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Nicholas Piggin <[email protected]>
Cc: [email protected]
---
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 0b1172cbeccb..9222c138c457 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -193,6 +193,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


2023-07-06 16:15:02

by Baoquan He

[permalink] [raw]
Subject: [PATCH v8 10/19] s390: mm: Convert to 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 versions if there's
arch specific handling in its ioremap_prot(), ioremap() or iounmap().
This change will simplify implementation by removing duplicated code
with generic_ioremap_prot() and generic_iounmap(), and has the equivalent
functioality as before.

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

And also replace including <asm-generic/io.h> with <asm/io.h> in
arch/s390/kernel/perf_cpum_sf.c, otherwise building error will be seen
because macro defined in <asm/io.h> can't be seen in perf_cpum_sf.c.

Signed-off-by: Baoquan He <[email protected]>
Reviewed-by: Niklas Schnelle <[email protected]>
Tested-by: Niklas Schnelle <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Mike Rapoport (IBM) <[email protected]>
Cc: Gerald Schaefer <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: Vasily Gorbik <[email protected]>
Cc: Alexander Gordeev <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Sven Schnelle <[email protected]>
Cc: [email protected]
---
arch/s390/Kconfig | 1 +
arch/s390/include/asm/io.h | 21 ++++++------
arch/s390/kernel/perf_cpum_sf.c | 2 +-
arch/s390/pci/pci.c | 57 ++++++---------------------------
4 files changed, 24 insertions(+), 57 deletions(-)

diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 5b39918b7042..290b6f93b816 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -143,6 +143,7 @@ config S390
select GENERIC_SMP_IDLE_THREAD
select GENERIC_TIME_VSYSCALL
select GENERIC_VDSO_TIME_NS
+ select GENERIC_IOREMAP if PCI
select HAVE_ALIGNED_STRUCT_PAGE if SLUB
select HAVE_ARCH_AUDITSYSCALL
select HAVE_ARCH_JUMP_LABEL
diff --git a/arch/s390/include/asm/io.h b/arch/s390/include/asm/io.h
index e3882b012bfa..4453ad7c11ac 100644
--- a/arch/s390/include/asm/io.h
+++ b/arch/s390/include/asm/io.h
@@ -22,11 +22,18 @@ void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr);

#define IO_SPACE_LIMIT 0

-void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot);
-void __iomem *ioremap(phys_addr_t addr, size_t size);
-void __iomem *ioremap_wc(phys_addr_t addr, size_t size);
-void __iomem *ioremap_wt(phys_addr_t addr, size_t size);
-void iounmap(volatile void __iomem *addr);
+/*
+ * I/O memory mapping functions.
+ */
+#define ioremap_prot ioremap_prot
+#define iounmap iounmap
+
+#define _PAGE_IOREMAP pgprot_val(PAGE_KERNEL)
+
+#define ioremap_wc(addr, size) \
+ ioremap_prot((addr), (size), pgprot_val(pgprot_writecombine(PAGE_KERNEL)))
+#define ioremap_wt(addr, size) \
+ ioremap_prot((addr), (size), pgprot_val(pgprot_writethrough(PAGE_KERNEL)))

static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
{
@@ -51,10 +58,6 @@ static inline void ioport_unmap(void __iomem *p)
#define pci_iomap_wc pci_iomap_wc
#define pci_iomap_wc_range pci_iomap_wc_range

-#define ioremap ioremap
-#define ioremap_wt ioremap_wt
-#define ioremap_wc ioremap_wc
-
#define memcpy_fromio(dst, src, count) zpci_memcpy_fromio(dst, src, count)
#define memcpy_toio(dst, src, count) zpci_memcpy_toio(dst, src, count)
#define memset_io(dst, val, count) zpci_memset_io(dst, val, count)
diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c
index 8ecfbce4ac92..dc6afc2221b4 100644
--- a/arch/s390/kernel/perf_cpum_sf.c
+++ b/arch/s390/kernel/perf_cpum_sf.c
@@ -22,7 +22,7 @@
#include <asm/irq.h>
#include <asm/debug.h>
#include <asm/timex.h>
-#include <asm-generic/io.h>
+#include <asm/io.h>

/* Minimum number of sample-data-block-tables:
* At least one table is required for the sampling buffer structure.
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index afc3f33788da..d34d5813d006 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -244,62 +244,25 @@ void __iowrite64_copy(void __iomem *to, const void *from, size_t count)
zpci_memcpy_toio(to, from, count);
}

-static void __iomem *__ioremap(phys_addr_t addr, size_t size, pgprot_t prot)
+void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
+ unsigned long prot)
{
- unsigned long offset, vaddr;
- struct vm_struct *area;
- phys_addr_t last_addr;
-
- last_addr = addr + size - 1;
- if (!size || last_addr < addr)
- return NULL;
-
+ /*
+ * When PCI MIO instructions are unavailable the "physical" address
+ * encodes a hint for accessing the PCI memory space it represents.
+ * Just pass it unchanged such that ioread/iowrite can decode it.
+ */
if (!static_branch_unlikely(&have_mio))
- return (void __iomem *) addr;
+ return (void __iomem *)phys_addr;

- offset = addr & ~PAGE_MASK;
- addr &= PAGE_MASK;
- size = PAGE_ALIGN(size + offset);
- area = get_vm_area(size, VM_IOREMAP);
- if (!area)
- return NULL;
-
- vaddr = (unsigned long) area->addr;
- if (ioremap_page_range(vaddr, vaddr + size, addr, prot)) {
- free_vm_area(area);
- return NULL;
- }
- return (void __iomem *) ((unsigned long) area->addr + offset);
-}
-
-void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
-{
- return __ioremap(addr, size, __pgprot(prot));
+ return generic_ioremap_prot(phys_addr, size, __pgprot(prot));
}
EXPORT_SYMBOL(ioremap_prot);

-void __iomem *ioremap(phys_addr_t addr, size_t size)
-{
- return __ioremap(addr, size, PAGE_KERNEL);
-}
-EXPORT_SYMBOL(ioremap);
-
-void __iomem *ioremap_wc(phys_addr_t addr, size_t size)
-{
- return __ioremap(addr, size, pgprot_writecombine(PAGE_KERNEL));
-}
-EXPORT_SYMBOL(ioremap_wc);
-
-void __iomem *ioremap_wt(phys_addr_t addr, size_t size)
-{
- return __ioremap(addr, size, pgprot_writethrough(PAGE_KERNEL));
-}
-EXPORT_SYMBOL(ioremap_wt);
-
void iounmap(volatile void __iomem *addr)
{
if (static_branch_likely(&have_mio))
- vunmap((__force void *) ((unsigned long) addr & PAGE_MASK));
+ generic_iounmap(addr);
}
EXPORT_SYMBOL(iounmap);

--
2.34.1


2023-07-06 16:15:35

by Baoquan He

[permalink] [raw]
Subject: [PATCH v8 19/19] mm: ioremap: remove unneeded ioremap_allowed and iounmap_allowed

Now there are no users of ioremap_allowed and iounmap_allowed, clean
them up.

Signed-off-by: Baoquan He <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Kefeng Wang <[email protected]>
Reviewed-by: Mike Rapoport (IBM) <[email protected]>
---
include/asm-generic/io.h | 26 --------------------------
mm/ioremap.c | 6 ------
2 files changed, 32 deletions(-)

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 39244c3ee797..bac63e874c7b 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -1047,32 +1047,6 @@ static inline void iounmap(volatile void __iomem *addr)
#elif defined(CONFIG_GENERIC_IOREMAP)
#include <linux/pgtable.h>

-/*
- * Arch code can implement the following two hooks when using GENERIC_IOREMAP
- * ioremap_allowed() return a bool,
- * - true means continue to remap
- * - false means skip remap and return directly
- * iounmap_allowed() return a bool,
- * - true means continue to vunmap
- * - false means skip vunmap and return directly
- */
-#ifndef ioremap_allowed
-#define ioremap_allowed ioremap_allowed
-static inline bool ioremap_allowed(phys_addr_t phys_addr, size_t size,
- unsigned long prot)
-{
- return true;
-}
-#endif
-
-#ifndef iounmap_allowed
-#define iounmap_allowed iounmap_allowed
-static inline bool iounmap_allowed(void *addr)
-{
- return true;
-}
-#endif
-
void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size,
pgprot_t prot);

diff --git a/mm/ioremap.c b/mm/ioremap.c
index a21a6c9fa5ab..3e049dfb28bd 100644
--- a/mm/ioremap.c
+++ b/mm/ioremap.c
@@ -33,9 +33,6 @@ void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size,
phys_addr -= offset;
size = PAGE_ALIGN(size + offset);

- if (!ioremap_allowed(phys_addr, size, pgprot_val(prot)))
- return NULL;
-
area = __get_vm_area_caller(size, VM_IOREMAP, IOREMAP_START,
IOREMAP_END, __builtin_return_address(0));
if (!area)
@@ -64,9 +61,6 @@ void generic_iounmap(volatile void __iomem *addr)
{
void *vaddr = (void *)((unsigned long)addr & PAGE_MASK);

- if (!iounmap_allowed(vaddr))
- return;
-
if (is_ioremap_addr(vaddr))
vunmap(vaddr);
}
--
2.34.1


2023-07-06 16:16:20

by Baoquan He

[permalink] [raw]
Subject: [PATCH v8 11/19] sh: add <asm-generic/io.h> including

In <asm-generic/io.h>, it provides a generic implementation of all
I/O accessors.

For some port|mm io functions, SuperH has its own implementation
in arch/sh/kernel/iomap.c and arch/sh/include/asm/io_noioport.h.
These will conflict with those in <asm-generic/io.h> and cause compiling
error. Hence add macro definitions to ensure that the SuperH version
of them will override the generic version.

Signed-off-by: Baoquan He <[email protected]>
Cc: John Paul Adrian Glaubitz <[email protected]>
Cc: Yoshinori Sato <[email protected]>
Cc: Rich Felker <[email protected]>
Cc: [email protected]
---
arch/sh/include/asm/io.h | 25 +++++++++++++++++++++++++
arch/sh/include/asm/io_noioport.h | 7 +++++++
2 files changed, 32 insertions(+)

diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index fba90e670ed4..270e7952950c 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -119,6 +119,26 @@ void __raw_readsl(const void __iomem *addr, void *data, int longlen);

__BUILD_MEMORY_STRING(__raw_, q, u64)

+#define ioread8 ioread8
+#define ioread16 ioread16
+#define ioread16be ioread16be
+#define ioread32 ioread32
+#define ioread32be ioread32be
+
+#define iowrite8 iowrite8
+#define iowrite16 iowrite16
+#define iowrite16be iowrite16be
+#define iowrite32 iowrite32
+#define iowrite32be iowrite32be
+
+#define ioread8_rep ioread8_rep
+#define ioread16_rep ioread16_rep
+#define ioread32_rep ioread32_rep
+
+#define iowrite8_rep iowrite8_rep
+#define iowrite16_rep iowrite16_rep
+#define iowrite32_rep iowrite32_rep
+
#ifdef CONFIG_HAS_IOPORT_MAP

/*
@@ -225,6 +245,9 @@ __BUILD_IOPORT_STRING(q, u64)
#define IO_SPACE_LIMIT 0xffffffff

/* We really want to try and get these to memcpy etc */
+#define memset_io memset_io
+#define memcpy_fromio memcpy_fromio
+#define memcpy_toio memcpy_toio
void memcpy_fromio(void *, const volatile void __iomem *, unsigned long);
void memcpy_toio(volatile void __iomem *, const void *, unsigned long);
void memset_io(volatile void __iomem *, int, unsigned long);
@@ -287,6 +310,8 @@ static inline void iounmap(volatile void __iomem *addr) { }
*/
#define xlate_dev_mem_ptr(p) __va(p)

+#include <asm-generic/io.h>
+
#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
int valid_phys_addr_range(phys_addr_t addr, size_t size);
int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
diff --git a/arch/sh/include/asm/io_noioport.h b/arch/sh/include/asm/io_noioport.h
index f7938fe0f911..5ba4116b4265 100644
--- a/arch/sh/include/asm/io_noioport.h
+++ b/arch/sh/include/asm/io_noioport.h
@@ -53,6 +53,13 @@ static inline void ioport_unmap(void __iomem *addr)
#define outw_p(x, addr) outw((x), (addr))
#define outl_p(x, addr) outl((x), (addr))

+#define insb insb
+#define insw insw
+#define insl insl
+#define outsb outsb
+#define outsw outsw
+#define outsl outsl
+
static inline void insb(unsigned long port, void *dst, unsigned long count)
{
BUG();
--
2.34.1


2023-07-06 16:17:27

by Baoquan He

[permalink] [raw]
Subject: [PATCH v8 03/19] openrisc: mm: remove unneeded early ioremap code

Under arch/openrisc, there isn't any place where ioremap() is called.
It means that there isn't early ioremap handling needed in openrisc,
So the early ioremap handling code in ioremap() of
arch/openrisc/mm/ioremap.c is unnecessary and can be removed.

And also remove the special handling in iounmap() since no page
is got from fixmap pool along with early ioremap code removing
in ioremap().

Link: https://lore.kernel.org/linux-mm/YwxfxKrTUtAuejKQ@oscomms1/
Signed-off-by: Baoquan He <[email protected]>
Acked-by: Stafford Horne <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Mike Rapoport (IBM) <[email protected]>
Cc: Jonas Bonn <[email protected]>
Cc: Stefan Kristiansson <[email protected]>
Cc: Stafford Horne <[email protected]>
Cc: [email protected]
---
arch/openrisc/mm/ioremap.c | 43 +++++---------------------------------
1 file changed, 5 insertions(+), 38 deletions(-)

diff --git a/arch/openrisc/mm/ioremap.c b/arch/openrisc/mm/ioremap.c
index 8ec0dafecf25..cdbcc7e73684 100644
--- a/arch/openrisc/mm/ioremap.c
+++ b/arch/openrisc/mm/ioremap.c
@@ -22,8 +22,6 @@

extern int mem_init_done;

-static unsigned int fixmaps_used __initdata;
-
/*
* Remap an arbitrary physical address space into the kernel virtual
* address space. Needed when the kernel wants to access high addresses
@@ -52,24 +50,14 @@ void __iomem *__ref ioremap(phys_addr_t addr, unsigned long size)
p = addr & PAGE_MASK;
size = PAGE_ALIGN(last_addr + 1) - p;

- if (likely(mem_init_done)) {
- area = get_vm_area(size, VM_IOREMAP);
- if (!area)
- return NULL;
- v = (unsigned long)area->addr;
- } else {
- if ((fixmaps_used + (size >> PAGE_SHIFT)) > FIX_N_IOREMAPS)
- return NULL;
- v = fix_to_virt(FIX_IOREMAP_BEGIN + fixmaps_used);
- fixmaps_used += (size >> PAGE_SHIFT);
- }
+ area = get_vm_area(size, VM_IOREMAP);
+ if (!area)
+ return NULL;
+ v = (unsigned long)area->addr;

if (ioremap_page_range(v, v + size, p,
__pgprot(pgprot_val(PAGE_KERNEL) | _PAGE_CI))) {
- if (likely(mem_init_done))
- vfree(area->addr);
- else
- fixmaps_used -= (size >> PAGE_SHIFT);
+ vfree(area->addr);
return NULL;
}

@@ -79,27 +67,6 @@ EXPORT_SYMBOL(ioremap);

void iounmap(volatile void __iomem *addr)
{
- /* If the page is from the fixmap pool then we just clear out
- * the fixmap mapping.
- */
- if (unlikely((unsigned long)addr > FIXADDR_START)) {
- /* This is a bit broken... we don't really know
- * how big the area is so it's difficult to know
- * how many fixed pages to invalidate...
- * just flush tlb and hope for the best...
- * consider this a FIXME
- *
- * Really we should be clearing out one or more page
- * table entries for these virtual addresses so that
- * future references cause a page fault... for now, we
- * rely on two things:
- * i) this code never gets called on known boards
- * ii) invalid accesses to the freed areas aren't made
- */
- flush_tlb_all();
- return;
- }
-
return vfree((void *)(PAGE_MASK & (unsigned long)addr));
}
EXPORT_SYMBOL(iounmap);
--
2.34.1


2023-07-06 16:24:00

by Baoquan He

[permalink] [raw]
Subject: [PATCH v8 05/19] mm: ioremap: allow ARCH to have its own ioremap method definition

Architectures can be converted to GENERIC_IOREMAP, to take standard
ioremap_xxx() and iounmap() way. But some ARCH-es could have specific
handling for ioremap_prot(), ioremap() and iounmap(), than standard
methods.

In oder to convert these ARCH-es to take GENERIC_IOREMAP method, allow
these architecutres to have their own ioremap_prot(), ioremap() and
iounmap() definitions.

Signed-off-by: Baoquan He <[email protected]>
Acked-by: Arnd Bergmann <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Kefeng Wang <[email protected]>
Reviewed-by: Mike Rapoport (IBM) <[email protected]>
Cc: [email protected]
---
include/asm-generic/io.h | 3 +++
mm/ioremap.c | 4 ++++
2 files changed, 7 insertions(+)

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index a7ca2099ba19..39244c3ee797 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -1081,11 +1081,14 @@ void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
void iounmap(volatile void __iomem *addr);
void generic_iounmap(volatile void __iomem *addr);

+#ifndef ioremap
+#define ioremap ioremap
static inline void __iomem *ioremap(phys_addr_t addr, size_t size)
{
/* _PAGE_IOREMAP needs to be supplied by the architecture */
return ioremap_prot(addr, size, _PAGE_IOREMAP);
}
+#endif
#endif /* !CONFIG_MMU || CONFIG_GENERIC_IOREMAP */

#ifndef ioremap_wc
diff --git a/mm/ioremap.c b/mm/ioremap.c
index db6234b9db59..9f34a8f90b58 100644
--- a/mm/ioremap.c
+++ b/mm/ioremap.c
@@ -46,12 +46,14 @@ void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size,
return (void __iomem *)(vaddr + offset);
}

+#ifndef ioremap_prot
void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
unsigned long prot)
{
return generic_ioremap_prot(phys_addr, size, __pgprot(prot));
}
EXPORT_SYMBOL(ioremap_prot);
+#endif

void generic_iounmap(volatile void __iomem *addr)
{
@@ -64,8 +66,10 @@ void generic_iounmap(volatile void __iomem *addr)
vunmap(vaddr);
}

+#ifndef iounmap
void iounmap(volatile void __iomem *addr)
{
generic_iounmap(addr);
}
EXPORT_SYMBOL(iounmap);
+#endif
--
2.34.1


2023-07-10 08:36:38

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH v8 11/19] sh: add <asm-generic/io.h> including

Hi Baoquan,

On Thu, Jul 6, 2023 at 5:49 PM Baoquan He <[email protected]> wrote:
> In <asm-generic/io.h>, it provides a generic implementation of all
> I/O accessors.
>
> For some port|mm io functions, SuperH has its own implementation
> in arch/sh/kernel/iomap.c and arch/sh/include/asm/io_noioport.h.
> These will conflict with those in <asm-generic/io.h> and cause compiling
> error. Hence add macro definitions to ensure that the SuperH version
> of them will override the generic version.
>
> Signed-off-by: Baoquan He <[email protected]>

Thanks for your patch, which is now commit edad4470b45298ba ("sh:
add <asm-generic/io.h> including") in next-20230710.

This break dreamcast_defconfig:

CC arch/sh/kernel/asm-offsets.s
In file included from ./arch/sh/include/asm/io.h:290,
from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:636:15: error: redefinition of ‘inb_p’
636 | #define inb_p inb_p
| ^~~~~
./include/asm-generic/io.h:637:18: note: in expansion of macro ‘inb_p’
637 | static inline u8 inb_p(unsigned long addr)
| ^~~~~
In file included from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:185:25: note: previous definition of
‘inb_p’ with type ‘u8(long unsigned int)’ {aka ‘unsigned char(long
unsigned int)’}
185 | static inline type pfx##in##bwlq##p(unsigned long port)
\
| ^~
./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
‘__BUILD_IOPORT_SINGLE’
199 | __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
| ^~~~~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
‘__BUILD_IOPORT_PFX’
202 | __BUILD_IOPORT_PFX(, bwlq, type)
| ^~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:204:1: note: in expansion of macro ‘BUILDIO_IOPORT’
204 | BUILDIO_IOPORT(b, u8)
| ^~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:644:15: error: redefinition of ‘inw_p’
644 | #define inw_p inw_p
| ^~~~~
./include/asm-generic/io.h:645:19: note: in expansion of macro ‘inw_p’
645 | static inline u16 inw_p(unsigned long addr)
| ^~~~~
In file included from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:185:25: note: previous definition of
‘inw_p’ with type ‘u16(long unsigned int)’ {aka ‘short unsigned
int(long unsigned int)’}
185 | static inline type pfx##in##bwlq##p(unsigned long port)
\
| ^~
./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
‘__BUILD_IOPORT_SINGLE’
199 | __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
| ^~~~~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
‘__BUILD_IOPORT_PFX’
202 | __BUILD_IOPORT_PFX(, bwlq, type)
| ^~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:205:1: note: in expansion of macro ‘BUILDIO_IOPORT’
205 | BUILDIO_IOPORT(w, u16)
| ^~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:652:15: error: redefinition of ‘inl_p’
652 | #define inl_p inl_p
| ^~~~~
./include/asm-generic/io.h:653:19: note: in expansion of macro ‘inl_p’
653 | static inline u32 inl_p(unsigned long addr)
| ^~~~~
In file included from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:185:25: note: previous definition of
‘inl_p’ with type ‘u32(long unsigned int)’ {aka ‘unsigned int(long
unsigned int)’}
185 | static inline type pfx##in##bwlq##p(unsigned long port)
\
| ^~
./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
‘__BUILD_IOPORT_SINGLE’
199 | __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
| ^~~~~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
‘__BUILD_IOPORT_PFX’
202 | __BUILD_IOPORT_PFX(, bwlq, type)
| ^~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:206:1: note: in expansion of macro ‘BUILDIO_IOPORT’
206 | BUILDIO_IOPORT(l, u32)
| ^~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:660:16: error: redefinition of ‘outb_p’
660 | #define outb_p outb_p
| ^~~~~~
./include/asm-generic/io.h:661:20: note: in expansion of macro ‘outb_p’
661 | static inline void outb_p(u8 value, unsigned long addr)
| ^~~~~~
In file included from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:176:25: note: previous definition of
‘outb_p’ with type ‘void(u8, long unsigned int)’ {aka ‘void(unsigned
char, long unsigned int)’}
176 | static inline void pfx##out##bwlq##p(type val, unsigned long
port) \
| ^~~
./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
‘__BUILD_IOPORT_SINGLE’
199 | __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
| ^~~~~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
‘__BUILD_IOPORT_PFX’
202 | __BUILD_IOPORT_PFX(, bwlq, type)
| ^~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:204:1: note: in expansion of macro ‘BUILDIO_IOPORT’
204 | BUILDIO_IOPORT(b, u8)
| ^~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:668:16: error: redefinition of ‘outw_p’
668 | #define outw_p outw_p
| ^~~~~~
./include/asm-generic/io.h:669:20: note: in expansion of macro ‘outw_p’
669 | static inline void outw_p(u16 value, unsigned long addr)
| ^~~~~~
In file included from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:176:25: note: previous definition of
‘outw_p’ with type ‘void(u16, long unsigned int)’ {aka ‘void(short
unsigned int, long unsigned int)’}
176 | static inline void pfx##out##bwlq##p(type val, unsigned long
port) \
| ^~~
./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
‘__BUILD_IOPORT_SINGLE’
199 | __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
| ^~~~~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
‘__BUILD_IOPORT_PFX’
202 | __BUILD_IOPORT_PFX(, bwlq, type)
| ^~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:205:1: note: in expansion of macro ‘BUILDIO_IOPORT’
205 | BUILDIO_IOPORT(w, u16)
| ^~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:676:16: error: redefinition of ‘outl_p’
676 | #define outl_p outl_p
| ^~~~~~
./include/asm-generic/io.h:677:20: note: in expansion of macro ‘outl_p’
677 | static inline void outl_p(u32 value, unsigned long addr)
| ^~~~~~
In file included from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:176:25: note: previous definition of
‘outl_p’ with type ‘void(u32, long unsigned int)’ {aka ‘void(unsigned
int, long unsigned int)’}
176 | static inline void pfx##out##bwlq##p(type val, unsigned long
port) \
| ^~~
./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
‘__BUILD_IOPORT_SINGLE’
199 | __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
| ^~~~~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
‘__BUILD_IOPORT_PFX’
202 | __BUILD_IOPORT_PFX(, bwlq, type)
| ^~~~~~~~~~~~~~~~~~
./arch/sh/include/asm/io.h:206:1: note: in expansion of macro ‘BUILDIO_IOPORT’
206 | BUILDIO_IOPORT(l, u32)
| ^~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:689:14: error: redefinition of ‘insb’
689 | #define insb insb
| ^~~~
./include/asm-generic/io.h:690:20: note: in expansion of macro ‘insb’
690 | static inline void insb(unsigned long addr, void *buffer,
unsigned int count)
| ^~~~
In file included from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:222:20: note: previous definition of ‘insb’
with type ‘void(long unsigned int, void *, unsigned int)’
222 | static inline void ins##bwlq(unsigned long port, void *addr,
\
| ^~~
./arch/sh/include/asm/io.h:233:1: note: in expansion of macro
‘__BUILD_IOPORT_STRING’
233 | __BUILD_IOPORT_STRING(b, u8)
| ^~~~~~~~~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:697:14: error: redefinition of ‘insw’
697 | #define insw insw
| ^~~~
./include/asm-generic/io.h:698:20: note: in expansion of macro ‘insw’
698 | static inline void insw(unsigned long addr, void *buffer,
unsigned int count)
| ^~~~
In file included from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:222:20: note: previous definition of ‘insw’
with type ‘void(long unsigned int, void *, unsigned int)’
222 | static inline void ins##bwlq(unsigned long port, void *addr,
\
| ^~~
./arch/sh/include/asm/io.h:234:1: note: in expansion of macro
‘__BUILD_IOPORT_STRING’
234 | __BUILD_IOPORT_STRING(w, u16)
| ^~~~~~~~~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:705:14: error: redefinition of ‘insl’
705 | #define insl insl
| ^~~~
./include/asm-generic/io.h:706:20: note: in expansion of macro ‘insl’
706 | static inline void insl(unsigned long addr, void *buffer,
unsigned int count)
| ^~~~
In file included from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:222:20: note: previous definition of ‘insl’
with type ‘void(long unsigned int, void *, unsigned int)’
222 | static inline void ins##bwlq(unsigned long port, void *addr,
\
| ^~~
./arch/sh/include/asm/io.h:235:1: note: in expansion of macro
‘__BUILD_IOPORT_STRING’
235 | __BUILD_IOPORT_STRING(l, u32)
| ^~~~~~~~~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:713:15: error: redefinition of ‘outsb’
713 | #define outsb outsb
| ^~~~~
./include/asm-generic/io.h:714:20: note: in expansion of macro ‘outsb’
714 | static inline void outsb(unsigned long addr, const void *buffer,
| ^~~~~
In file included from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:211:20: note: previous definition of
‘outsb’ with type ‘void(long unsigned int, const void *, unsigned
int)’
211 | static inline void outs##bwlq(unsigned long port, const void
*addr, \
| ^~~~
./arch/sh/include/asm/io.h:233:1: note: in expansion of macro
‘__BUILD_IOPORT_STRING’
233 | __BUILD_IOPORT_STRING(b, u8)
| ^~~~~~~~~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:722:15: error: redefinition of ‘outsw’
722 | #define outsw outsw
| ^~~~~
./include/asm-generic/io.h:723:20: note: in expansion of macro ‘outsw’
723 | static inline void outsw(unsigned long addr, const void *buffer,
| ^~~~~
In file included from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:211:20: note: previous definition of
‘outsw’ with type ‘void(long unsigned int, const void *, unsigned
int)’
211 | static inline void outs##bwlq(unsigned long port, const void
*addr, \
| ^~~~
./arch/sh/include/asm/io.h:234:1: note: in expansion of macro
‘__BUILD_IOPORT_STRING’
234 | __BUILD_IOPORT_STRING(w, u16)
| ^~~~~~~~~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:731:15: error: redefinition of ‘outsl’
731 | #define outsl outsl
| ^~~~~
./include/asm-generic/io.h:732:20: note: in expansion of macro ‘outsl’
732 | static inline void outsl(unsigned long addr, const void *buffer,
| ^~~~~
In file included from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./arch/sh/include/asm/io.h:211:20: note: previous definition of
‘outsl’ with type ‘void(long unsigned int, const void *, unsigned
int)’
211 | static inline void outs##bwlq(unsigned long port, const void
*addr, \
| ^~~~
./arch/sh/include/asm/io.h:235:1: note: in expansion of macro
‘__BUILD_IOPORT_STRING’
235 | __BUILD_IOPORT_STRING(l, u32)
| ^~~~~~~~~~~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:1111:20: error: static declaration of
‘ioport_map’ follows non-static declaration
1111 | #define ioport_map ioport_map
| ^~~~~~~~~~
./include/asm-generic/io.h:1112:29: note: in expansion of macro ‘ioport_map’
1112 | static inline void __iomem *ioport_map(unsigned long port,
unsigned int nr)
| ^~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:22,
from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/iomap.h:92:22: note: previous declaration of
‘ioport_map’ with type ‘void *(long unsigned int, unsigned int)’
92 | extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
| ^~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:290,
from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:1121:22: error: static declaration of
‘ioport_unmap’ follows non-static declaration
1121 | #define ioport_unmap ioport_unmap
| ^~~~~~~~~~~~
./include/asm-generic/io.h:1122:20: note: in expansion of macro ‘ioport_unmap’
1122 | static inline void ioport_unmap(void __iomem *p)
| ^~~~~~~~~~~~
In file included from ./arch/sh/include/asm/io.h:22,
from ./include/linux/io.h:13,
from ./include/linux/irq.h:20,
from ./include/asm-generic/hardirq.h:17,
from ./arch/sh/include/asm/hardirq.h:9,
from ./include/linux/hardirq.h:11,
from ./include/linux/interrupt.h:11,
from ./include/linux/kernel_stat.h:9,
from ./include/linux/cgroup.h:26,
from ./include/linux/memcontrol.h:13,
from ./include/linux/swap.h:9,
from ./include/linux/suspend.h:5,
from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/iomap.h:93:13: note: previous declaration of
‘ioport_unmap’ with type ‘void(void *)’
93 | extern void ioport_unmap(void __iomem *);
| ^~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:116: arch/sh/kernel/asm-offsets.s] Error 1
make[1]: *** [Makefile:1275: prepare0] Error 2
make: *** [Makefile:234: __sub-make] Error 2

> --- a/arch/sh/include/asm/io.h
> +++ b/arch/sh/include/asm/io.h
> @@ -119,6 +119,26 @@ void __raw_readsl(const void __iomem *addr, void *data, int longlen);
>
> __BUILD_MEMORY_STRING(__raw_, q, u64)
>
> +#define ioread8 ioread8
> +#define ioread16 ioread16
> +#define ioread16be ioread16be
> +#define ioread32 ioread32
> +#define ioread32be ioread32be
> +
> +#define iowrite8 iowrite8
> +#define iowrite16 iowrite16
> +#define iowrite16be iowrite16be
> +#define iowrite32 iowrite32
> +#define iowrite32be iowrite32be
> +
> +#define ioread8_rep ioread8_rep
> +#define ioread16_rep ioread16_rep
> +#define ioread32_rep ioread32_rep
> +
> +#define iowrite8_rep iowrite8_rep
> +#define iowrite16_rep iowrite16_rep
> +#define iowrite32_rep iowrite32_rep
> +
> #ifdef CONFIG_HAS_IOPORT_MAP
>
> /*
> @@ -225,6 +245,9 @@ __BUILD_IOPORT_STRING(q, u64)
> #define IO_SPACE_LIMIT 0xffffffff
>
> /* We really want to try and get these to memcpy etc */
> +#define memset_io memset_io
> +#define memcpy_fromio memcpy_fromio
> +#define memcpy_toio memcpy_toio
> void memcpy_fromio(void *, const volatile void __iomem *, unsigned long);
> void memcpy_toio(volatile void __iomem *, const void *, unsigned long);
> void memset_io(volatile void __iomem *, int, unsigned long);
> @@ -287,6 +310,8 @@ static inline void iounmap(volatile void __iomem *addr) { }
> */
> #define xlate_dev_mem_ptr(p) __va(p)
>
> +#include <asm-generic/io.h>
> +
> #define ARCH_HAS_VALID_PHYS_ADDR_RANGE
> int valid_phys_addr_range(phys_addr_t addr, size_t size);
> int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
> diff --git a/arch/sh/include/asm/io_noioport.h b/arch/sh/include/asm/io_noioport.h
> index f7938fe0f911..5ba4116b4265 100644
> --- a/arch/sh/include/asm/io_noioport.h
> +++ b/arch/sh/include/asm/io_noioport.h
> @@ -53,6 +53,13 @@ static inline void ioport_unmap(void __iomem *addr)
> #define outw_p(x, addr) outw((x), (addr))
> #define outl_p(x, addr) outl((x), (addr))
>
> +#define insb insb
> +#define insw insw
> +#define insl insl
> +#define outsb outsb
> +#define outsw outsw
> +#define outsl outsl
> +
> static inline void insb(unsigned long port, void *dst, unsigned long count)
> {
> BUG();
> --
> 2.34.1
>


--
Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

Subject: Re: [PATCH v8 11/19] sh: add <asm-generic/io.h> including

Hi!

On Mon, 2023-07-10 at 10:17 +0200, Geert Uytterhoeven wrote:
> Hi Baoquan,
>
> On Thu, Jul 6, 2023 at 5:49 PM Baoquan He <[email protected]> wrote:
> > In <asm-generic/io.h>, it provides a generic implementation of all
> > I/O accessors.
> >
> > For some port|mm io functions, SuperH has its own implementation
> > in arch/sh/kernel/iomap.c and arch/sh/include/asm/io_noioport.h.
> > These will conflict with those in <asm-generic/io.h> and cause compiling
> > error. Hence add macro definitions to ensure that the SuperH version
> > of them will override the generic version.
> >
> > Signed-off-by: Baoquan He <[email protected]>
>
> Thanks for your patch, which is now commit edad4470b45298ba ("sh:
> add <asm-generic/io.h> including") in next-20230710.
>
> This break dreamcast_defconfig:
>
> CC arch/sh/kernel/asm-offsets.s
> In file included from ./arch/sh/include/asm/io.h:290,
> from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:636:15: error: redefinition of ‘inb_p’
> 636 | #define inb_p inb_p
> | ^~~~~
> ./include/asm-generic/io.h:637:18: note: in expansion of macro ‘inb_p’
> 637 | static inline u8 inb_p(unsigned long addr)
> | ^~~~~
> In file included from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:185:25: note: previous definition of
> ‘inb_p’ with type ‘u8(long unsigned int)’ {aka ‘unsigned char(long
> unsigned int)’}
> 185 | static inline type pfx##in##bwlq##p(unsigned long port)
> \
> | ^~
> ./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
> ‘__BUILD_IOPORT_SINGLE’
> 199 | __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
> | ^~~~~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
> ‘__BUILD_IOPORT_PFX’
> 202 | __BUILD_IOPORT_PFX(, bwlq, type)
> | ^~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:204:1: note: in expansion of macro ‘BUILDIO_IOPORT’
> 204 | BUILDIO_IOPORT(b, u8)
> | ^~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
> from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:644:15: error: redefinition of ‘inw_p’
> 644 | #define inw_p inw_p
> | ^~~~~
> ./include/asm-generic/io.h:645:19: note: in expansion of macro ‘inw_p’
> 645 | static inline u16 inw_p(unsigned long addr)
> | ^~~~~
> In file included from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:185:25: note: previous definition of
> ‘inw_p’ with type ‘u16(long unsigned int)’ {aka ‘short unsigned
> int(long unsigned int)’}
> 185 | static inline type pfx##in##bwlq##p(unsigned long port)
> \
> | ^~
> ./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
> ‘__BUILD_IOPORT_SINGLE’
> 199 | __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
> | ^~~~~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
> ‘__BUILD_IOPORT_PFX’
> 202 | __BUILD_IOPORT_PFX(, bwlq, type)
> | ^~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:205:1: note: in expansion of macro ‘BUILDIO_IOPORT’
> 205 | BUILDIO_IOPORT(w, u16)
> | ^~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
> from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:652:15: error: redefinition of ‘inl_p’
> 652 | #define inl_p inl_p
> | ^~~~~
> ./include/asm-generic/io.h:653:19: note: in expansion of macro ‘inl_p’
> 653 | static inline u32 inl_p(unsigned long addr)
> | ^~~~~
> In file included from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:185:25: note: previous definition of
> ‘inl_p’ with type ‘u32(long unsigned int)’ {aka ‘unsigned int(long
> unsigned int)’}
> 185 | static inline type pfx##in##bwlq##p(unsigned long port)
> \
> | ^~
> ./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
> ‘__BUILD_IOPORT_SINGLE’
> 199 | __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
> | ^~~~~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
> ‘__BUILD_IOPORT_PFX’
> 202 | __BUILD_IOPORT_PFX(, bwlq, type)
> | ^~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:206:1: note: in expansion of macro ‘BUILDIO_IOPORT’
> 206 | BUILDIO_IOPORT(l, u32)
> | ^~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
> from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:660:16: error: redefinition of ‘outb_p’
> 660 | #define outb_p outb_p
> | ^~~~~~
> ./include/asm-generic/io.h:661:20: note: in expansion of macro ‘outb_p’
> 661 | static inline void outb_p(u8 value, unsigned long addr)
> | ^~~~~~
> In file included from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:176:25: note: previous definition of
> ‘outb_p’ with type ‘void(u8, long unsigned int)’ {aka ‘void(unsigned
> char, long unsigned int)’}
> 176 | static inline void pfx##out##bwlq##p(type val, unsigned long
> port) \
> | ^~~
> ./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
> ‘__BUILD_IOPORT_SINGLE’
> 199 | __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
> | ^~~~~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
> ‘__BUILD_IOPORT_PFX’
> 202 | __BUILD_IOPORT_PFX(, bwlq, type)
> | ^~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:204:1: note: in expansion of macro ‘BUILDIO_IOPORT’
> 204 | BUILDIO_IOPORT(b, u8)
> | ^~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
> from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:668:16: error: redefinition of ‘outw_p’
> 668 | #define outw_p outw_p
> | ^~~~~~
> ./include/asm-generic/io.h:669:20: note: in expansion of macro ‘outw_p’
> 669 | static inline void outw_p(u16 value, unsigned long addr)
> | ^~~~~~
> In file included from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:176:25: note: previous definition of
> ‘outw_p’ with type ‘void(u16, long unsigned int)’ {aka ‘void(short
> unsigned int, long unsigned int)’}
> 176 | static inline void pfx##out##bwlq##p(type val, unsigned long
> port) \
> | ^~~
> ./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
> ‘__BUILD_IOPORT_SINGLE’
> 199 | __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
> | ^~~~~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
> ‘__BUILD_IOPORT_PFX’
> 202 | __BUILD_IOPORT_PFX(, bwlq, type)
> | ^~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:205:1: note: in expansion of macro ‘BUILDIO_IOPORT’
> 205 | BUILDIO_IOPORT(w, u16)
> | ^~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
> from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:676:16: error: redefinition of ‘outl_p’
> 676 | #define outl_p outl_p
> | ^~~~~~
> ./include/asm-generic/io.h:677:20: note: in expansion of macro ‘outl_p’
> 677 | static inline void outl_p(u32 value, unsigned long addr)
> | ^~~~~~
> In file included from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:176:25: note: previous definition of
> ‘outl_p’ with type ‘void(u32, long unsigned int)’ {aka ‘void(unsigned
> int, long unsigned int)’}
> 176 | static inline void pfx##out##bwlq##p(type val, unsigned long
> port) \
> | ^~~
> ./arch/sh/include/asm/io.h:199:9: note: in expansion of macro
> ‘__BUILD_IOPORT_SINGLE’
> 199 | __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
> | ^~~~~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:202:9: note: in expansion of macro
> ‘__BUILD_IOPORT_PFX’
> 202 | __BUILD_IOPORT_PFX(, bwlq, type)
> | ^~~~~~~~~~~~~~~~~~
> ./arch/sh/include/asm/io.h:206:1: note: in expansion of macro ‘BUILDIO_IOPORT’
> 206 | BUILDIO_IOPORT(l, u32)
> | ^~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
> from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:689:14: error: redefinition of ‘insb’
> 689 | #define insb insb
> | ^~~~
> ./include/asm-generic/io.h:690:20: note: in expansion of macro ‘insb’
> 690 | static inline void insb(unsigned long addr, void *buffer,
> unsigned int count)
> | ^~~~
> In file included from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:222:20: note: previous definition of ‘insb’
> with type ‘void(long unsigned int, void *, unsigned int)’
> 222 | static inline void ins##bwlq(unsigned long port, void *addr,
> \
> | ^~~
> ./arch/sh/include/asm/io.h:233:1: note: in expansion of macro
> ‘__BUILD_IOPORT_STRING’
> 233 | __BUILD_IOPORT_STRING(b, u8)
> | ^~~~~~~~~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
> from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:697:14: error: redefinition of ‘insw’
> 697 | #define insw insw
> | ^~~~
> ./include/asm-generic/io.h:698:20: note: in expansion of macro ‘insw’
> 698 | static inline void insw(unsigned long addr, void *buffer,
> unsigned int count)
> | ^~~~
> In file included from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:222:20: note: previous definition of ‘insw’
> with type ‘void(long unsigned int, void *, unsigned int)’
> 222 | static inline void ins##bwlq(unsigned long port, void *addr,
> \
> | ^~~
> ./arch/sh/include/asm/io.h:234:1: note: in expansion of macro
> ‘__BUILD_IOPORT_STRING’
> 234 | __BUILD_IOPORT_STRING(w, u16)
> | ^~~~~~~~~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
> from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:705:14: error: redefinition of ‘insl’
> 705 | #define insl insl
> | ^~~~
> ./include/asm-generic/io.h:706:20: note: in expansion of macro ‘insl’
> 706 | static inline void insl(unsigned long addr, void *buffer,
> unsigned int count)
> | ^~~~
> In file included from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:222:20: note: previous definition of ‘insl’
> with type ‘void(long unsigned int, void *, unsigned int)’
> 222 | static inline void ins##bwlq(unsigned long port, void *addr,
> \
> | ^~~
> ./arch/sh/include/asm/io.h:235:1: note: in expansion of macro
> ‘__BUILD_IOPORT_STRING’
> 235 | __BUILD_IOPORT_STRING(l, u32)
> | ^~~~~~~~~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
> from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:713:15: error: redefinition of ‘outsb’
> 713 | #define outsb outsb
> | ^~~~~
> ./include/asm-generic/io.h:714:20: note: in expansion of macro ‘outsb’
> 714 | static inline void outsb(unsigned long addr, const void *buffer,
> | ^~~~~
> In file included from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:211:20: note: previous definition of
> ‘outsb’ with type ‘void(long unsigned int, const void *, unsigned
> int)’
> 211 | static inline void outs##bwlq(unsigned long port, const void
> *addr, \
> | ^~~~
> ./arch/sh/include/asm/io.h:233:1: note: in expansion of macro
> ‘__BUILD_IOPORT_STRING’
> 233 | __BUILD_IOPORT_STRING(b, u8)
> | ^~~~~~~~~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
> from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:722:15: error: redefinition of ‘outsw’
> 722 | #define outsw outsw
> | ^~~~~
> ./include/asm-generic/io.h:723:20: note: in expansion of macro ‘outsw’
> 723 | static inline void outsw(unsigned long addr, const void *buffer,
> | ^~~~~
> In file included from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:211:20: note: previous definition of
> ‘outsw’ with type ‘void(long unsigned int, const void *, unsigned
> int)’
> 211 | static inline void outs##bwlq(unsigned long port, const void
> *addr, \
> | ^~~~
> ./arch/sh/include/asm/io.h:234:1: note: in expansion of macro
> ‘__BUILD_IOPORT_STRING’
> 234 | __BUILD_IOPORT_STRING(w, u16)
> | ^~~~~~~~~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
> from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:731:15: error: redefinition of ‘outsl’
> 731 | #define outsl outsl
> | ^~~~~
> ./include/asm-generic/io.h:732:20: note: in expansion of macro ‘outsl’
> 732 | static inline void outsl(unsigned long addr, const void *buffer,
> | ^~~~~
> In file included from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./arch/sh/include/asm/io.h:211:20: note: previous definition of
> ‘outsl’ with type ‘void(long unsigned int, const void *, unsigned
> int)’
> 211 | static inline void outs##bwlq(unsigned long port, const void
> *addr, \
> | ^~~~
> ./arch/sh/include/asm/io.h:235:1: note: in expansion of macro
> ‘__BUILD_IOPORT_STRING’
> 235 | __BUILD_IOPORT_STRING(l, u32)
> | ^~~~~~~~~~~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
> from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:1111:20: error: static declaration of
> ‘ioport_map’ follows non-static declaration
> 1111 | #define ioport_map ioport_map
> | ^~~~~~~~~~
> ./include/asm-generic/io.h:1112:29: note: in expansion of macro ‘ioport_map’
> 1112 | static inline void __iomem *ioport_map(unsigned long port,
> unsigned int nr)
> | ^~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:22,
> from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/iomap.h:92:22: note: previous declaration of
> ‘ioport_map’ with type ‘void *(long unsigned int, unsigned int)’
> 92 | extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
> | ^~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:290,
> from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/io.h:1121:22: error: static declaration of
> ‘ioport_unmap’ follows non-static declaration
> 1121 | #define ioport_unmap ioport_unmap
> | ^~~~~~~~~~~~
> ./include/asm-generic/io.h:1122:20: note: in expansion of macro ‘ioport_unmap’
> 1122 | static inline void ioport_unmap(void __iomem *p)
> | ^~~~~~~~~~~~
> In file included from ./arch/sh/include/asm/io.h:22,
> from ./include/linux/io.h:13,
> from ./include/linux/irq.h:20,
> from ./include/asm-generic/hardirq.h:17,
> from ./arch/sh/include/asm/hardirq.h:9,
> from ./include/linux/hardirq.h:11,
> from ./include/linux/interrupt.h:11,
> from ./include/linux/kernel_stat.h:9,
> from ./include/linux/cgroup.h:26,
> from ./include/linux/memcontrol.h:13,
> from ./include/linux/swap.h:9,
> from ./include/linux/suspend.h:5,
> from arch/sh/kernel/asm-offsets.c:16:
> ./include/asm-generic/iomap.h:93:13: note: previous declaration of
> ‘ioport_unmap’ with type ‘void(void *)’
> 93 | extern void ioport_unmap(void __iomem *);
> | ^~~~~~~~~~~~
> make[2]: *** [scripts/Makefile.build:116: arch/sh/kernel/asm-offsets.s] Error 1
> make[1]: *** [Makefile:1275: prepare0] Error 2
> make: *** [Makefile:234: __sub-make] Error 2
>
> > --- a/arch/sh/include/asm/io.h
> > +++ b/arch/sh/include/asm/io.h
> > @@ -119,6 +119,26 @@ void __raw_readsl(const void __iomem *addr, void *data, int longlen);
> >
> > __BUILD_MEMORY_STRING(__raw_, q, u64)
> >
> > +#define ioread8 ioread8
> > +#define ioread16 ioread16
> > +#define ioread16be ioread16be
> > +#define ioread32 ioread32
> > +#define ioread32be ioread32be
> > +
> > +#define iowrite8 iowrite8
> > +#define iowrite16 iowrite16
> > +#define iowrite16be iowrite16be
> > +#define iowrite32 iowrite32
> > +#define iowrite32be iowrite32be
> > +
> > +#define ioread8_rep ioread8_rep
> > +#define ioread16_rep ioread16_rep
> > +#define ioread32_rep ioread32_rep
> > +
> > +#define iowrite8_rep iowrite8_rep
> > +#define iowrite16_rep iowrite16_rep
> > +#define iowrite32_rep iowrite32_rep
> > +
> > #ifdef CONFIG_HAS_IOPORT_MAP
> >
> > /*
> > @@ -225,6 +245,9 @@ __BUILD_IOPORT_STRING(q, u64)
> > #define IO_SPACE_LIMIT 0xffffffff
> >
> > /* We really want to try and get these to memcpy etc */
> > +#define memset_io memset_io
> > +#define memcpy_fromio memcpy_fromio
> > +#define memcpy_toio memcpy_toio
> > void memcpy_fromio(void *, const volatile void __iomem *, unsigned long);
> > void memcpy_toio(volatile void __iomem *, const void *, unsigned long);
> > void memset_io(volatile void __iomem *, int, unsigned long);
> > @@ -287,6 +310,8 @@ static inline void iounmap(volatile void __iomem *addr) { }
> > */
> > #define xlate_dev_mem_ptr(p) __va(p)
> >
> > +#include <asm-generic/io.h>
> > +
> > #define ARCH_HAS_VALID_PHYS_ADDR_RANGE
> > int valid_phys_addr_range(phys_addr_t addr, size_t size);
> > int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
> > diff --git a/arch/sh/include/asm/io_noioport.h b/arch/sh/include/asm/io_noioport.h
> > index f7938fe0f911..5ba4116b4265 100644
> > --- a/arch/sh/include/asm/io_noioport.h
> > +++ b/arch/sh/include/asm/io_noioport.h
> > @@ -53,6 +53,13 @@ static inline void ioport_unmap(void __iomem *addr)
> > #define outw_p(x, addr) outw((x), (addr))
> > #define outl_p(x, addr) outl((x), (addr))
> >
> > +#define insb insb
> > +#define insw insw
> > +#define insl insl
> > +#define outsb outsb
> > +#define outsw outsw
> > +#define outsl outsl
> > +
> > static inline void insb(unsigned long port, void *dst, unsigned long count)
> > {
> > BUG();
> > --
> > 2.34.1

I'm not happy though that this patch is in linux-next without being Acked by me
or being reviewed by anyone. We should always make sure first that the code
actually builds and has been tested on real hardware.

Adrian

--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913

2023-07-10 11:30:04

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH v8 11/19] sh: add <asm-generic/io.h> including

On Mon, Jul 10, 2023, at 10:45, John Paul Adrian Glaubitz wrote:
> On Mon, 2023-07-10 at 10:17 +0200, Geert Uytterhoeven wrote:
>> Thanks for your patch, which is now commit edad4470b45298ba ("sh:
>> add <asm-generic/io.h> including") in next-20230710.
>>
>> This break dreamcast_defconfig:
>>
>> CC arch/sh/kernel/asm-offsets.s
>> In file included from ./arch/sh/include/asm/io.h:290,
>> ./include/asm-generic/io.h:636:15: error: redefinition of ‘inb_p’
>> 636 | #define inb_p inb_p
>> | ^~~~~

>> > index f7938fe0f911..5ba4116b4265 100644
>> > --- a/arch/sh/include/asm/io_noioport.h
>> > +++ b/arch/sh/include/asm/io_noioport.h
>> > @@ -53,6 +53,13 @@ static inline void ioport_unmap(void __iomem *addr)
>> > #define outw_p(x, addr) outw((x), (addr))
>> > #define outl_p(x, addr) outl((x), (addr))
>> >
>> > +#define insb insb
>> > +#define insw insw
>> > +#define insl insl
>> > +#define outsb outsb
>> > +#define outsw outsw
>> > +#define outsl outsl

It looks like only the "noioport" variant got some of the
extra macro definitions, but the version for PCI still needs the
same six macros, plus the ones of inb/outb etc, something like
this:

diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 24c560c065ec7..2135e32145c54 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -241,6 +241,26 @@ __BUILD_IOPORT_STRING(q, u64)

#endif

+#define inb(addr) inb(addr)
+#define inw(addr) inw(addr)
+#define inl(addr) inl(addr)
+#define outb(x, addr) outb((x), (addr))
+#define outw(x, addr) outw((x), (addr))
+#define outl(x, addr) outl((x), (addr))
+
+#define inb_p(addr) inb(addr)
+#define inw_p(addr) inw(addr)
+#define inl_p(addr) inl(addr)
+#define outb_p(x, addr) outb((x), (addr))
+#define outw_p(x, addr) outw((x), (addr))
+#define outl_p(x, addr) outl((x), (addr))
+
+#define insb insb
+#define insw insw
+#define insl insl
+#define outsb outsb
+#define outsw outsw
+#define outsl outsl

#define IO_SPACE_LIMIT 0xffffffff

diff --git a/arch/sh/include/asm/io_noioport.h b/arch/sh/include/asm/io_noioport.h
index 5ba4116b4265c..12dad91f41c1e 100644
--- a/arch/sh/include/asm/io_noioport.h
+++ b/arch/sh/include/asm/io_noioport.h
@@ -46,20 +46,6 @@ static inline void ioport_unmap(void __iomem *addr)
BUG();
}

-#define inb_p(addr) inb(addr)
-#define inw_p(addr) inw(addr)
-#define inl_p(addr) inl(addr)
-#define outb_p(x, addr) outb((x), (addr))
-#define outw_p(x, addr) outw((x), (addr))
-#define outl_p(x, addr) outl((x), (addr))
-
-#define insb insb
-#define insw insw
-#define insl insl
-#define outsb outsb
-#define outsw outsw
-#define outsl outsl
-
static inline void insb(unsigned long port, void *dst, unsigned long count)
{
BUG();

I think ideally all the I/O port stuff in arch/sh/ could just be
removed after the conversion to asm-generic/io.h, but the
microdev_ioport_map() function oddity gets in the way of that,
unless someone wants to clean up that platform. As far as I
can tell, the ethernet, display, USB and PCI devices on it already
broke at some point (afbb9d8d5266b, 46bc85872040a), so it might
be easier to remove it entirely.

> I'm not happy though that this patch is in linux-next without being Acked by me
> or being reviewed by anyone. We should always make sure first that the code
> actually builds and has been tested on real hardware.

I think that if the series has been posted eight times, you had
your chance to do a review, especially since I pointed out that
merging this one would have avoid the unxlate_dev_mem_ptr() bug
as well.

Having the series go into linux-next sounds appropriate like this,
the entire purpose of that is to find such bugs and Andrew can jus
fold the fixup into the broken patch.

Let me know if you prefer the simple version with the extra
#defines or if we should just use the generic inb/outb implementation
immediately and drop microdev in a separate patch.

Arnd

Subject: Re: [PATCH v8 11/19] sh: add <asm-generic/io.h> including

Hi Arnd!

On Mon, 2023-07-10 at 12:47 +0200, Arnd Bergmann wrote:
> It looks like only the "noioport" variant got some of the
> extra macro definitions, but the version for PCI still needs the
> same six macros, plus the ones of inb/outb etc, something like
> this:
>
> diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
> index 24c560c065ec7..2135e32145c54 100644
> --- a/arch/sh/include/asm/io.h
> +++ b/arch/sh/include/asm/io.h
> @@ -241,6 +241,26 @@ __BUILD_IOPORT_STRING(q, u64)
>
> #endif
>
> +#define inb(addr) inb(addr)
> +#define inw(addr) inw(addr)
> +#define inl(addr) inl(addr)
> +#define outb(x, addr) outb((x), (addr))
> +#define outw(x, addr) outw((x), (addr))
> +#define outl(x, addr) outl((x), (addr))
> +
> +#define inb_p(addr) inb(addr)
> +#define inw_p(addr) inw(addr)
> +#define inl_p(addr) inl(addr)
> +#define outb_p(x, addr) outb((x), (addr))
> +#define outw_p(x, addr) outw((x), (addr))
> +#define outl_p(x, addr) outl((x), (addr))
> +
> +#define insb insb
> +#define insw insw
> +#define insl insl
> +#define outsb outsb
> +#define outsw outsw
> +#define outsl outsl
>
> #define IO_SPACE_LIMIT 0xffffffff
>
> diff --git a/arch/sh/include/asm/io_noioport.h b/arch/sh/include/asm/io_noioport.h
> index 5ba4116b4265c..12dad91f41c1e 100644
> --- a/arch/sh/include/asm/io_noioport.h
> +++ b/arch/sh/include/asm/io_noioport.h
> @@ -46,20 +46,6 @@ static inline void ioport_unmap(void __iomem *addr)
> BUG();
> }
>
> -#define inb_p(addr) inb(addr)
> -#define inw_p(addr) inw(addr)
> -#define inl_p(addr) inl(addr)
> -#define outb_p(x, addr) outb((x), (addr))
> -#define outw_p(x, addr) outw((x), (addr))
> -#define outl_p(x, addr) outl((x), (addr))
> -
> -#define insb insb
> -#define insw insw
> -#define insl insl
> -#define outsb outsb
> -#define outsw outsw
> -#define outsl outsl
> -
> static inline void insb(unsigned long port, void *dst, unsigned long count)
> {
> BUG();

I am fine with this fix.

Acked-by: John Paul Adrian Glaubitz <[email protected]>

> I think ideally all the I/O port stuff in arch/sh/ could just be
> removed after the conversion to asm-generic/io.h, but the
> microdev_ioport_map() function oddity gets in the way of that,
> unless someone wants to clean up that platform. As far as I
> can tell, the ethernet, display, USB and PCI devices on it already
> broke at some point (afbb9d8d5266b, 46bc85872040a), so it might
> be easier to remove it entirely.

I don't have this particular hardware, so I cannot comment on this.

> > I'm not happy though that this patch is in linux-next without being Acked by me
> > or being reviewed by anyone. We should always make sure first that the code
> > actually builds and has been tested on real hardware.
>
> I think that if the series has been posted eight times, you had
> your chance to do a review, especially since I pointed out that
> merging this one would have avoid the unxlate_dev_mem_ptr() bug
> as well.

I have only been the maintainer of arch/sh for a few weeks, so it's natural
that I am not doing a perfect job and might miss something. Also, I am not
getting paid for this work, I am doing this in my free time.

> Having the series go into linux-next sounds appropriate like this,
> the entire purpose of that is to find such bugs and Andrew can jus
> fold the fixup into the broken patch.
>
> Let me know if you prefer the simple version with the extra
> #defines or if we should just use the generic inb/outb implementation
> immediately and drop microdev in a separate patch.

Please go ahead with the simple version.

Thanks,
Adrian

--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913

2023-08-02 15:01:34

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH v8 11/19] sh: add <asm-generic/io.h> including

On Tue, Aug 1, 2023, at 21:21, John Paul Adrian Glaubitz wrote:

>> I think ideally all the I/O port stuff in arch/sh/ could just be
>> removed after the conversion to asm-generic/io.h, but the
>> microdev_ioport_map() function oddity gets in the way of that,
>> unless someone wants to clean up that platform. As far as I
>> can tell, the ethernet, display, USB and PCI devices on it already
>> broke at some point (afbb9d8d5266b, 46bc85872040a), so it might
>> be easier to remove it entirely.
>
> I don't have this particular hardware, so I cannot comment on this.

Sure, as I explained, I'm pretty sure that nobody has
tried to boot this hardware in a long time, so I did not
expect you to have one.

I'll try to follow up with a patch to remove the platform
later on, based on the explations above.

>> Having the series go into linux-next sounds appropriate like this,
>> the entire purpose of that is to find such bugs and Andrew can jus
>> fold the fixup into the broken patch.
>>
>> Let me know if you prefer the simple version with the extra
>> #defines or if we should just use the generic inb/outb implementation
>> immediately and drop microdev in a separate patch.
>
> Please go ahead with the simple version.

Done,

Arnd

Subject: Re: [PATCH v8 11/19] sh: add <asm-generic/io.h> including

Hello Arnd!

On Wed, 2023-08-02 at 16:19 +0200, Arnd Bergmann wrote:
> On Tue, Aug 1, 2023, at 21:21, John Paul Adrian Glaubitz wrote:
>
> > > I think ideally all the I/O port stuff in arch/sh/ could just be
> > > removed after the conversion to asm-generic/io.h, but the
> > > microdev_ioport_map() function oddity gets in the way of that,
> > > unless someone wants to clean up that platform. As far as I
> > > can tell, the ethernet, display, USB and PCI devices on it already
> > > broke at some point (afbb9d8d5266b, 46bc85872040a), so it might
> > > be easier to remove it entirely.
> >
> > I don't have this particular hardware, so I cannot comment on this.
>
> Sure, as I explained, I'm pretty sure that nobody has
> tried to boot this hardware in a long time, so I did not
> expect you to have one.
>
> I'll try to follow up with a patch to remove the platform
> later on, based on the explations above.

There is no need to remove any platforms now as we're working on converting
arch/sh to device trees anyway and will eventually get rid of all the board-
specific code during that step.

> > > Having the series go into linux-next sounds appropriate like this,
> > > the entire purpose of that is to find such bugs and Andrew can jus
> > > fold the fixup into the broken patch.
> > >
> > > Let me know if you prefer the simple version with the extra
> > > #defines or if we should just use the generic inb/outb implementation
> > > immediately and drop microdev in a separate patch.
> >
> > Please go ahead with the simple version.
>
> Done,

Thanks,
Adrian

--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913