* [PATCH v6 01/19] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros
2023-06-09 7:55 [PATCH v6 00/19] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
@ 2023-06-09 7:55 ` Baoquan He
2023-06-09 7:55 ` [PATCH v6 02/19] hexagon: mm: Convert to GENERIC_IOREMAP Baoquan He
` (17 subsequent siblings)
18 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Baoquan He, Geert Uytterhoeven
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 <bhe@redhat.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
v5->v6:
Remove stale sentence in log - Mike.
arch/loongarch/include/asm/io.h | 2 --
arch/m68k/include/asm/io_mm.h | 2 --
arch/m68k/include/asm/kmap.h | 2 --
arch/mips/include/asm/io.h | 5 ++---
arch/powerpc/include/asm/io.h | 9 +--------
arch/x86/include/asm/io.h | 5 -----
drivers/net/ethernet/sfc/io.h | 2 +-
drivers/net/ethernet/sfc/siena/io.h | 2 +-
include/asm-generic/iomap.h | 6 +++---
9 files changed, 8 insertions(+), 27 deletions(-)
diff --git a/arch/loongarch/include/asm/io.h b/arch/loongarch/include/asm/io.h
index 545e2708fbf7..5fef1246c6fb 100644
--- a/arch/loongarch/include/asm/io.h
+++ b/arch/loongarch/include/asm/io.h
@@ -5,8 +5,6 @@
#ifndef _ASM_IO_H
#define _ASM_IO_H
-#define ARCH_HAS_IOREMAP_WC
-
#include <linux/kernel.h>
#include <linux/types.h>
diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h
index d41fa488453b..6a0abd4846c6 100644
--- a/arch/m68k/include/asm/io_mm.h
+++ b/arch/m68k/include/asm/io_mm.h
@@ -26,8 +26,6 @@
#include <asm/virtconvert.h>
#include <asm/kmap.h>
-#include <asm-generic/iomap.h>
-
#ifdef CONFIG_ATARI
#define atari_readb raw_inb
#define atari_writeb raw_outb
diff --git a/arch/m68k/include/asm/kmap.h b/arch/m68k/include/asm/kmap.h
index dec05743d426..4efb3efa593a 100644
--- a/arch/m68k/include/asm/kmap.h
+++ b/arch/m68k/include/asm/kmap.h
@@ -4,8 +4,6 @@
#ifdef CONFIG_MMU
-#define ARCH_HAS_IOREMAP_WT
-
/* Values for nocacheflag and cmode */
#define IOMAP_FULL_CACHING 0
#define IOMAP_NOCACHE_SER 1
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index cc28d207a061..477773328a06 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -12,8 +12,6 @@
#ifndef _ASM_IO_H
#define _ASM_IO_H
-#define ARCH_HAS_IOREMAP_WC
-
#include <linux/compiler.h>
#include <linux/kernel.h>
#include <linux/types.h>
@@ -25,7 +23,6 @@
#include <asm/byteorder.h>
#include <asm/cpu.h>
#include <asm/cpu-features.h>
-#include <asm-generic/iomap.h>
#include <asm/page.h>
#include <asm/pgtable-bits.h>
#include <asm/processor.h>
@@ -210,6 +207,8 @@ void iounmap(const volatile void __iomem *addr);
#define ioremap_wc(offset, size) \
ioremap_prot((offset), (size), boot_cpu_data.writecombine)
+#include <asm-generic/iomap.h>
+
#if defined(CONFIG_CPU_CAVIUM_OCTEON)
#define war_io_reorder_wmb() wmb()
#else
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index f1e657c9bbe8..67a3fb6de498 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -3,11 +3,6 @@
#define _ASM_POWERPC_IO_H
#ifdef __KERNEL__
-#define ARCH_HAS_IOREMAP_WC
-#ifdef CONFIG_PPC32
-#define ARCH_HAS_IOREMAP_WT
-#endif
-
/*
*/
@@ -732,9 +727,7 @@ static inline void name at \
#define writel_relaxed(v, addr) writel(v, addr)
#define writeq_relaxed(v, addr) writeq(v, addr)
-#ifdef CONFIG_GENERIC_IOMAP
-#include <asm-generic/iomap.h>
-#else
+#ifndef CONFIG_GENERIC_IOMAP
/*
* Here comes the implementation of the IOMAP interfaces.
*/
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index e9025640f634..76238842406a 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -35,9 +35,6 @@
* - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
*/
-#define ARCH_HAS_IOREMAP_WC
-#define ARCH_HAS_IOREMAP_WT
-
#include <linux/string.h>
#include <linux/compiler.h>
#include <linux/cc_platform.h>
@@ -212,8 +209,6 @@ void memset_io(volatile void __iomem *, int, size_t);
#define memcpy_toio memcpy_toio
#define memset_io memset_io
-#include <asm-generic/iomap.h>
-
/*
* ISA space is 'always mapped' on a typical x86 system, no need to
* explicitly ioremap() it. The fact that the ISA IO space is mapped
diff --git a/drivers/net/ethernet/sfc/io.h b/drivers/net/ethernet/sfc/io.h
index 30439cc83a89..07f99ad14bf3 100644
--- a/drivers/net/ethernet/sfc/io.h
+++ b/drivers/net/ethernet/sfc/io.h
@@ -70,7 +70,7 @@
*/
#ifdef CONFIG_X86_64
/* PIO is a win only if write-combining is possible */
-#ifdef ARCH_HAS_IOREMAP_WC
+#ifdef ioremap_wc
#define EFX_USE_PIO 1
#endif
#endif
diff --git a/drivers/net/ethernet/sfc/siena/io.h b/drivers/net/ethernet/sfc/siena/io.h
index 30439cc83a89..07f99ad14bf3 100644
--- a/drivers/net/ethernet/sfc/siena/io.h
+++ b/drivers/net/ethernet/sfc/siena/io.h
@@ -70,7 +70,7 @@
*/
#ifdef CONFIG_X86_64
/* PIO is a win only if write-combining is possible */
-#ifdef ARCH_HAS_IOREMAP_WC
+#ifdef ioremap_wc
#define EFX_USE_PIO 1
#endif
#endif
diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h
index 08237ae8b840..196087a8126e 100644
--- a/include/asm-generic/iomap.h
+++ b/include/asm-generic/iomap.h
@@ -93,15 +93,15 @@ extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
extern void ioport_unmap(void __iomem *);
#endif
-#ifndef ARCH_HAS_IOREMAP_WC
+#ifndef ioremap_wc
#define ioremap_wc ioremap
#endif
-#ifndef ARCH_HAS_IOREMAP_WT
+#ifndef ioremap_wt
#define ioremap_wt ioremap
#endif
-#ifndef ARCH_HAS_IOREMAP_NP
+#ifndef ioremap_np
/* See the comment in asm-generic/io.h about ioremap_np(). */
#define ioremap_np ioremap_np
static inline void __iomem *ioremap_np(phys_addr_t offset, size_t size)
--
2.34.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH v6 02/19] hexagon: mm: Convert to GENERIC_IOREMAP
2023-06-09 7:55 [PATCH v6 00/19] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
2023-06-09 7:55 ` [PATCH v6 01/19] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros Baoquan He
@ 2023-06-09 7:55 ` Baoquan He
2023-06-09 11:09 ` kernel test robot
2023-06-09 7:55 ` [PATCH v6 03/19] openrisc: mm: remove unneeded early ioremap code Baoquan He
` (16 subsequent siblings)
18 siblings, 1 reply; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Baoquan He, Brian Cain, linux-hexagon
By taking GENERIC_IOREMAP method, the generic ioremap_prot() and
iounmap() are visible and available to arch. This change will
simplify implementation by removing duplicated codes with generic
ioremap_prot() and iounmap(), and has the equivalent functioality.
For hexagon, 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 <bhe@redhat.com>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Brian Cain <bcain@quicinc.com>
Cc: linux-hexagon@vger.kernel.org
---
arch/hexagon/Kconfig | 1 +
arch/hexagon/include/asm/io.h | 9 +++++--
arch/hexagon/mm/ioremap.c | 44 -----------------------------------
3 files changed, 8 insertions(+), 46 deletions(-)
delete mode 100644 arch/hexagon/mm/ioremap.c
diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
index 54eadf265178..17afffde1a7f 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -25,6 +25,7 @@ config HEXAGON
select NEED_SG_DMA_LENGTH
select NO_IOPORT_MAP
select GENERIC_IOMAP
+ select GENERIC_IOREMAP
select GENERIC_SMP_IDLE_THREAD
select STACKTRACE_SUPPORT
select GENERIC_CLOCKEVENTS_BROADCAST
diff --git a/arch/hexagon/include/asm/io.h b/arch/hexagon/include/asm/io.h
index 46a099de85b7..dcd9cbbf5934 100644
--- a/arch/hexagon/include/asm/io.h
+++ b/arch/hexagon/include/asm/io.h
@@ -170,8 +170,13 @@ static inline void writel(u32 data, volatile void __iomem *addr)
#define writew_relaxed __raw_writew
#define writel_relaxed __raw_writel
-void __iomem *ioremap(unsigned long phys_addr, unsigned long size);
-#define ioremap_uc(X, Y) ioremap((X), (Y))
+/*
+ * I/O memory mapping functions.
+ */
+#define _PAGE_IOREMAP (_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \
+ (__HEXAGON_C_DEV << 6))
+
+#define ioremap_uc(addr, size) ioremap((addr), (size))
#define __raw_writel writel
diff --git a/arch/hexagon/mm/ioremap.c b/arch/hexagon/mm/ioremap.c
deleted file mode 100644
index 255c5b1ee1a7..000000000000
--- a/arch/hexagon/mm/ioremap.c
+++ /dev/null
@@ -1,44 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * I/O remap functions for Hexagon
- *
- * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
- */
-
-#include <linux/io.h>
-#include <linux/vmalloc.h>
-#include <linux/mm.h>
-
-void __iomem *ioremap(unsigned long phys_addr, unsigned long size)
-{
- unsigned long last_addr, addr;
- unsigned long offset = phys_addr & ~PAGE_MASK;
- struct vm_struct *area;
-
- pgprot_t prot = __pgprot(_PAGE_PRESENT|_PAGE_READ|_PAGE_WRITE
- |(__HEXAGON_C_DEV << 6));
-
- last_addr = phys_addr + size - 1;
-
- /* Wrapping not allowed */
- if (!size || (last_addr < phys_addr))
- return NULL;
-
- /* Rounds up to next page size, including whole-page offset */
- size = PAGE_ALIGN(offset + size);
-
- area = get_vm_area(size, VM_IOREMAP);
- addr = (unsigned long)area->addr;
-
- if (ioremap_page_range(addr, addr+size, phys_addr, prot)) {
- vunmap((void *)addr);
- return NULL;
- }
-
- return (void __iomem *) (offset + addr);
-}
-
-void iounmap(const volatile void __iomem *addr)
-{
- vunmap((void *) ((unsigned long) addr & PAGE_MASK));
-}
--
2.34.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* Re: [PATCH v6 02/19] hexagon: mm: Convert to GENERIC_IOREMAP
2023-06-09 7:55 ` [PATCH v6 02/19] hexagon: mm: Convert to GENERIC_IOREMAP Baoquan He
@ 2023-06-09 11:09 ` kernel test robot
2023-06-10 8:26 ` Baoquan He
0 siblings, 1 reply; 45+ messages in thread
From: kernel test robot @ 2023-06-09 11:09 UTC (permalink / raw)
To: Baoquan He, linux-kernel
Cc: llvm, oe-kbuild-all, linux-arch, linux-mm, arnd,
christophe.leroy, hch, rppt, willy, agordeev, wangkefeng.wang,
schnelle, David.Laight, shorne, deller, Baoquan He, Brian Cain,
linux-hexagon
Hi Baoquan,
kernel test robot noticed the following build errors:
[auto build test ERROR on akpm-mm/mm-everything]
url: https://github.com/intel-lab-lkp/linux/commits/Baoquan-He/asm-generic-iomap-h-remove-ARCH_HAS_IOREMAP_xx-macros/20230609-160014
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20230609075528.9390-3-bhe%40redhat.com
patch subject: [PATCH v6 02/19] hexagon: mm: Convert to GENERIC_IOREMAP
config: hexagon-randconfig-r041-20230608 (https://download.01.org/0day-ci/archive/20230609/202306091859.NhlW2nny-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce (this is a W=1 build):
mkdir -p ~/bin
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git remote add akpm-mm https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git
git fetch akpm-mm mm-everything
git checkout akpm-mm/mm-everything
b4 shazam https://lore.kernel.org/r/20230609075528.9390-3-bhe@redhat.com
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=hexagon olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=hexagon prepare
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306091859.NhlW2nny-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from arch/hexagon/kernel/asm-offsets.c:15:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:339:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
547 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
560 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
| ^
In file included from arch/hexagon/kernel/asm-offsets.c:15:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:339:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
573 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
| ^
In file included from arch/hexagon/kernel/asm-offsets.c:15:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:339:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
584 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
594 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
604 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
>> include/asm-generic/io.h:1078:6: error: conflicting types for 'iounmap'
1078 | void iounmap(volatile void __iomem *addr);
| ^
arch/hexagon/include/asm/io.h:30:13: note: previous declaration is here
30 | extern void iounmap(const volatile void __iomem *addr);
| ^
6 warnings and 1 error generated.
make[2]: *** [scripts/Makefile.build:114: arch/hexagon/kernel/asm-offsets.s] Error 1 shuffle=2830738586
make[2]: Target 'prepare' not remade because of errors.
make[1]: *** [Makefile:1287: prepare0] Error 2 shuffle=2830738586
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:226: __sub-make] Error 2 shuffle=2830738586
make: Target 'prepare' not remade because of errors.
vim +/iounmap +1078 include/asm-generic/io.h
18e780b4e6ab89 Kefeng Wang 2022-06-07 1075
abc5992b9dd0ba Kefeng Wang 2022-06-07 1076 void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
abc5992b9dd0ba Kefeng Wang 2022-06-07 1077 unsigned long prot);
80b0ca98f91ddb Christoph Hellwig 2019-08-13 @1078 void iounmap(volatile void __iomem *addr);
80b0ca98f91ddb Christoph Hellwig 2019-08-13 1079
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v6 02/19] hexagon: mm: Convert to GENERIC_IOREMAP
2023-06-09 11:09 ` kernel test robot
@ 2023-06-10 8:26 ` Baoquan He
2023-06-11 5:40 ` Mike Rapoport
0 siblings, 1 reply; 45+ messages in thread
From: Baoquan He @ 2023-06-10 8:26 UTC (permalink / raw)
To: kernel test robot
Cc: linux-kernel, llvm, oe-kbuild-all, linux-arch, linux-mm, arnd,
christophe.leroy, hch, rppt, willy, agordeev, wangkefeng.wang,
schnelle, David.Laight, shorne, deller, Brian Cain,
linux-hexagon
On 06/09/23 at 07:09pm, kernel test robot wrote:
> Hi Baoquan,
>
> kernel test robot noticed the following build errors:
>
> [auto build test ERROR on akpm-mm/mm-everything]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Baoquan-He/asm-generic-iomap-h-remove-ARCH_HAS_IOREMAP_xx-macros/20230609-160014
> base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
> patch link: https://lore.kernel.org/r/20230609075528.9390-3-bhe%40redhat.com
> patch subject: [PATCH v6 02/19] hexagon: mm: Convert to GENERIC_IOREMAP
> config: hexagon-randconfig-r041-20230608 (https://download.01.org/0day-ci/archive/20230609/202306091859.NhlW2nny-lkp@intel.com/config)
> compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
> reproduce (this is a W=1 build):
> mkdir -p ~/bin
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> git remote add akpm-mm https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git
> git fetch akpm-mm mm-everything
> git checkout akpm-mm/mm-everything
> b4 shazam https://lore.kernel.org/r/20230609075528.9390-3-bhe@redhat.com
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=hexagon olddefconfig
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=hexagon prepare
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202306091859.NhlW2nny-lkp@intel.com/
Thanks for reporting. I reproduced them on my local machine. Below patch
can fix them. And by the way, I also saw the clone3 warning, and have to
made change in scripts/checksyscalls.sh to mute it, wondering how you
handle it in your testing.
------
stdin>:1520:2: warning: syscall clone3 not implemented [-W#warnings]
1520 | #warning syscall clone3 not implemented
| ^
1 warning generated.
------
diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
index 1e5d2eeb726d..3a369b78edb7 100755
--- a/scripts/checksyscalls.sh
+++ b/scripts/checksyscalls.sh
@@ -148,6 +148,7 @@ cat << EOF
#define __IGNORE_nanosleep
#define __IGNORE_io_getevents
#define __IGNORE_recvmmsg
+#define __IGNORE_clone3
#endif
From 6a86f4360a61a2b7b4d71172e5c03be554367553 Mon Sep 17 00:00:00 2001
From: root <root@dell-pem620-01.dell2.lab.eng.bos.redhat.com>
Date: Fri, 9 Jun 2023 21:21:36 -0400
Subject: [PATCH] hexagon: mm: fix warning in asm/io.h
Content-type: text/plain
Remove the old iounmap() declaration which is not consistent with the
standard one in asm-generic/io.h, let's use the standard one.
And also add macro definition of inb/w/l and outb/w/l to override
the definition of them in asm-generic/io.h.
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Baoquan He <bhe@redhat.com>
---
arch/hexagon/include/asm/io.h | 8 ++++++--
scripts/checksyscalls.sh | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/hexagon/include/asm/io.h b/arch/hexagon/include/asm/io.h
index dcd9cbbf5934..efe9cb00ebf8 100644
--- a/arch/hexagon/include/asm/io.h
+++ b/arch/hexagon/include/asm/io.h
@@ -27,8 +27,6 @@
extern int remap_area_pages(unsigned long start, unsigned long phys_addr,
unsigned long end, unsigned long flags);
-extern void iounmap(const volatile void __iomem *addr);
-
/* Defined in lib/io.c, needed for smc91x driver. */
extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen);
extern void __raw_writesw(void __iomem *addr, const void *data, int wordlen);
@@ -207,16 +205,19 @@ static inline void memset_io(volatile void __iomem *addr, int value,
*
* Operates on "I/O bus I/O space"
*/
+#define inb inb
static inline u8 inb(unsigned long port)
{
return readb(_IO_BASE + (port & IO_SPACE_LIMIT));
}
+#define inw inw
static inline u16 inw(unsigned long port)
{
return readw(_IO_BASE + (port & IO_SPACE_LIMIT));
}
+#define inl inl
static inline u32 inl(unsigned long port)
{
return readl(_IO_BASE + (port & IO_SPACE_LIMIT));
@@ -227,16 +228,19 @@ static inline u32 inl(unsigned long port)
* @data: data to write to
* @addr: address in I/O space
*/
+#define outb outb
static inline void outb(u8 data, unsigned long port)
{
writeb(data, _IO_BASE + (port & IO_SPACE_LIMIT));
}
+#define outw outw
static inline void outw(u16 data, unsigned long port)
{
writew(data, _IO_BASE + (port & IO_SPACE_LIMIT));
}
+#define outl outl
static inline void outl(u32 data, unsigned long port)
{
writel(data, _IO_BASE + (port & IO_SPACE_LIMIT));
^ permalink raw reply related [flat|nested] 45+ messages in thread
* Re: [PATCH v6 02/19] hexagon: mm: Convert to GENERIC_IOREMAP
2023-06-10 8:26 ` Baoquan He
@ 2023-06-11 5:40 ` Mike Rapoport
2023-06-11 7:57 ` Baoquan He
0 siblings, 1 reply; 45+ messages in thread
From: Mike Rapoport @ 2023-06-11 5:40 UTC (permalink / raw)
To: Baoquan He
Cc: kernel test robot, linux-kernel, llvm, oe-kbuild-all, linux-arch,
linux-mm, arnd, christophe.leroy, hch, willy, agordeev,
wangkefeng.wang, schnelle, David.Laight, shorne, deller,
Brian Cain, linux-hexagon
Hi Baoquan,
On Sat, Jun 10, 2023 at 04:26:21PM +0800, Baoquan He wrote:
> On 06/09/23 at 07:09pm, kernel test robot wrote:
> > Hi Baoquan,
> >
> > kernel test robot noticed the following build errors:
> >
> > [auto build test ERROR on akpm-mm/mm-everything]
> >
> > url: https://github.com/intel-lab-lkp/linux/commits/Baoquan-He/asm-generic-iomap-h-remove-ARCH_HAS_IOREMAP_xx-macros/20230609-160014
> > base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
> > patch link: https://lore.kernel.org/r/20230609075528.9390-3-bhe%40redhat.com
> > patch subject: [PATCH v6 02/19] hexagon: mm: Convert to GENERIC_IOREMAP
> > config: hexagon-randconfig-r041-20230608 (https://download.01.org/0day-ci/archive/20230609/202306091859.NhlW2nny-lkp@intel.com/config)
> > compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
> > reproduce (this is a W=1 build):
> > mkdir -p ~/bin
> > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > chmod +x ~/bin/make.cross
> > git remote add akpm-mm https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git
> > git fetch akpm-mm mm-everything
> > git checkout akpm-mm/mm-everything
> > b4 shazam https://lore.kernel.org/r/20230609075528.9390-3-bhe@redhat.com
> > # save the config file
> > mkdir build_dir && cp config build_dir/.config
> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=hexagon olddefconfig
> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=hexagon prepare
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/202306091859.NhlW2nny-lkp@intel.com/
>
> Thanks for reporting. I reproduced them on my local machine. Below patch
> can fix them. And by the way, I also saw the clone3 warning, and have to
> made change in scripts/checksyscalls.sh to mute it, wondering how you
> handle it in your testing.
I think the warning kbuild reported is rather this one:
>> include/asm-generic/io.h:1078:6: error: conflicting types for 'iounmap'
1078 | void iounmap(volatile void __iomem *addr);
| ^
> ------
> stdin>:1520:2: warning: syscall clone3 not implemented [-W#warnings]
> 1520 | #warning syscall clone3 not implemented
> | ^
> 1 warning generated.
>
> ------
> diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
> index 1e5d2eeb726d..3a369b78edb7 100755
> --- a/scripts/checksyscalls.sh
> +++ b/scripts/checksyscalls.sh
> @@ -148,6 +148,7 @@ cat << EOF
> #define __IGNORE_nanosleep
> #define __IGNORE_io_getevents
> #define __IGNORE_recvmmsg
> +#define __IGNORE_clone3
> #endif
>
>
> From 6a86f4360a61a2b7b4d71172e5c03be554367553 Mon Sep 17 00:00:00 2001
> From: root <root@dell-pem620-01.dell2.lab.eng.bos.redhat.com>
> Date: Fri, 9 Jun 2023 21:21:36 -0400
> Subject: [PATCH] hexagon: mm: fix warning in asm/io.h
> Content-type: text/plain
>
> Remove the old iounmap() declaration which is not consistent with the
> standard one in asm-generic/io.h, let's use the standard one.
>
> And also add macro definition of inb/w/l and outb/w/l to override
> the definition of them in asm-generic/io.h.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
> arch/hexagon/include/asm/io.h | 8 ++++++--
> scripts/checksyscalls.sh | 1 +
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/arch/hexagon/include/asm/io.h b/arch/hexagon/include/asm/io.h
> index dcd9cbbf5934..efe9cb00ebf8 100644
> --- a/arch/hexagon/include/asm/io.h
> +++ b/arch/hexagon/include/asm/io.h
> @@ -27,8 +27,6 @@
> extern int remap_area_pages(unsigned long start, unsigned long phys_addr,
> unsigned long end, unsigned long flags);
>
> -extern void iounmap(const volatile void __iomem *addr);
> -
> /* Defined in lib/io.c, needed for smc91x driver. */
> extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen);
> extern void __raw_writesw(void __iomem *addr, const void *data, int wordlen);
> @@ -207,16 +205,19 @@ static inline void memset_io(volatile void __iomem *addr, int value,
> *
> * Operates on "I/O bus I/O space"
> */
> +#define inb inb
> static inline u8 inb(unsigned long port)
> {
> return readb(_IO_BASE + (port & IO_SPACE_LIMIT));
> }
>
> +#define inw inw
> static inline u16 inw(unsigned long port)
> {
> return readw(_IO_BASE + (port & IO_SPACE_LIMIT));
> }
>
> +#define inl inl
> static inline u32 inl(unsigned long port)
> {
> return readl(_IO_BASE + (port & IO_SPACE_LIMIT));
> @@ -227,16 +228,19 @@ static inline u32 inl(unsigned long port)
> * @data: data to write to
> * @addr: address in I/O space
> */
> +#define outb outb
> static inline void outb(u8 data, unsigned long port)
> {
> writeb(data, _IO_BASE + (port & IO_SPACE_LIMIT));
> }
>
> +#define outw outw
> static inline void outw(u16 data, unsigned long port)
> {
> writew(data, _IO_BASE + (port & IO_SPACE_LIMIT));
> }
>
> +#define outl outl
> static inline void outl(u32 data, unsigned long port)
> {
> writel(data, _IO_BASE + (port & IO_SPACE_LIMIT));
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v6 02/19] hexagon: mm: Convert to GENERIC_IOREMAP
2023-06-11 5:40 ` Mike Rapoport
@ 2023-06-11 7:57 ` Baoquan He
2023-06-12 16:02 ` Nathan Chancellor
0 siblings, 1 reply; 45+ messages in thread
From: Baoquan He @ 2023-06-11 7:57 UTC (permalink / raw)
To: Mike Rapoport
Cc: kernel test robot, linux-kernel, llvm, oe-kbuild-all, linux-arch,
linux-mm, arnd, christophe.leroy, hch, willy, agordeev,
wangkefeng.wang, schnelle, David.Laight, shorne, deller,
Brian Cain, linux-hexagon
On 06/11/23 at 08:40am, Mike Rapoport wrote:
> Hi Baoquan,
>
> On Sat, Jun 10, 2023 at 04:26:21PM +0800, Baoquan He wrote:
> > On 06/09/23 at 07:09pm, kernel test robot wrote:
> > > Hi Baoquan,
> > >
> > > kernel test robot noticed the following build errors:
> > >
> > > [auto build test ERROR on akpm-mm/mm-everything]
> > >
> > > url: https://github.com/intel-lab-lkp/linux/commits/Baoquan-He/asm-generic-iomap-h-remove-ARCH_HAS_IOREMAP_xx-macros/20230609-160014
> > > base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
> > > patch link: https://lore.kernel.org/r/20230609075528.9390-3-bhe%40redhat.com
> > > patch subject: [PATCH v6 02/19] hexagon: mm: Convert to GENERIC_IOREMAP
> > > config: hexagon-randconfig-r041-20230608 (https://download.01.org/0day-ci/archive/20230609/202306091859.NhlW2nny-lkp@intel.com/config)
> > > compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
> > > reproduce (this is a W=1 build):
> > > mkdir -p ~/bin
> > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > > chmod +x ~/bin/make.cross
> > > git remote add akpm-mm https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git
> > > git fetch akpm-mm mm-everything
> > > git checkout akpm-mm/mm-everything
> > > b4 shazam https://lore.kernel.org/r/20230609075528.9390-3-bhe@redhat.com
> > > # save the config file
> > > mkdir build_dir && cp config build_dir/.config
> > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=hexagon olddefconfig
> > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=hexagon prepare
> > >
> > > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > > the same patch/commit), kindly add following tags
> > > | Reported-by: kernel test robot <lkp@intel.com>
> > > | Closes: https://lore.kernel.org/oe-kbuild-all/202306091859.NhlW2nny-lkp@intel.com/
> >
> > Thanks for reporting. I reproduced them on my local machine. Below patch
> > can fix them. And by the way, I also saw the clone3 warning, and have to
> > made change in scripts/checksyscalls.sh to mute it, wondering how you
> > handle it in your testing.
>
> I think the warning kbuild reported is rather this one:
>
> >> include/asm-generic/io.h:1078:6: error: conflicting types for 'iounmap'
> 1078 | void iounmap(volatile void __iomem *addr);
> | ^
This one is reported as error. The old iounmap() declaration has a const,
while the standard one doesn't have. So I just remove the old one to use
the standard one.
Another one is warning about PCI_IOBASE. Because inb/w/l and outb/w/l is
redefined in asm-generic/io.h, and it uses PCI_IOBASE which is defniend
as NULL in asm-generic/io.h if ARCH doesn't have its own PCI_IOBASE
definition. Then the warning is triggered. So I define macro to override
the standard inb/w/l and outb/w/l.
#ifndef PCI_IOBASE
#define PCI_IOBASE ((void __iomem *)0)
#endif
> > ------
> > stdin>:1520:2: warning: syscall clone3 not implemented [-W#warnings]
> > 1520 | #warning syscall clone3 not implemented
> > | ^
> > 1 warning generated.
> >
> > ------
> > diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
> > index 1e5d2eeb726d..3a369b78edb7 100755
> > --- a/scripts/checksyscalls.sh
> > +++ b/scripts/checksyscalls.sh
> > @@ -148,6 +148,7 @@ cat << EOF
> > #define __IGNORE_nanosleep
> > #define __IGNORE_io_getevents
> > #define __IGNORE_recvmmsg
> > +#define __IGNORE_clone3
> > #endif
> >
> >
> > From 6a86f4360a61a2b7b4d71172e5c03be554367553 Mon Sep 17 00:00:00 2001
> > From: root <root@dell-pem620-01.dell2.lab.eng.bos.redhat.com>
> > Date: Fri, 9 Jun 2023 21:21:36 -0400
> > Subject: [PATCH] hexagon: mm: fix warning in asm/io.h
> > Content-type: text/plain
> >
> > Remove the old iounmap() declaration which is not consistent with the
> > standard one in asm-generic/io.h, let's use the standard one.
> >
> > And also add macro definition of inb/w/l and outb/w/l to override
> > the definition of them in asm-generic/io.h.
> >
> > Reported-by: kernel test robot <lkp@intel.com>
> > Signed-off-by: Baoquan He <bhe@redhat.com>
> > ---
> > arch/hexagon/include/asm/io.h | 8 ++++++--
> > scripts/checksyscalls.sh | 1 +
> > 2 files changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/hexagon/include/asm/io.h b/arch/hexagon/include/asm/io.h
> > index dcd9cbbf5934..efe9cb00ebf8 100644
> > --- a/arch/hexagon/include/asm/io.h
> > +++ b/arch/hexagon/include/asm/io.h
> > @@ -27,8 +27,6 @@
> > extern int remap_area_pages(unsigned long start, unsigned long phys_addr,
> > unsigned long end, unsigned long flags);
> >
> > -extern void iounmap(const volatile void __iomem *addr);
> > -
> > /* Defined in lib/io.c, needed for smc91x driver. */
> > extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen);
> > extern void __raw_writesw(void __iomem *addr, const void *data, int wordlen);
> > @@ -207,16 +205,19 @@ static inline void memset_io(volatile void __iomem *addr, int value,
> > *
> > * Operates on "I/O bus I/O space"
> > */
> > +#define inb inb
> > static inline u8 inb(unsigned long port)
> > {
> > return readb(_IO_BASE + (port & IO_SPACE_LIMIT));
> > }
> >
> > +#define inw inw
> > static inline u16 inw(unsigned long port)
> > {
> > return readw(_IO_BASE + (port & IO_SPACE_LIMIT));
> > }
> >
> > +#define inl inl
> > static inline u32 inl(unsigned long port)
> > {
> > return readl(_IO_BASE + (port & IO_SPACE_LIMIT));
> > @@ -227,16 +228,19 @@ static inline u32 inl(unsigned long port)
> > * @data: data to write to
> > * @addr: address in I/O space
> > */
> > +#define outb outb
> > static inline void outb(u8 data, unsigned long port)
> > {
> > writeb(data, _IO_BASE + (port & IO_SPACE_LIMIT));
> > }
> >
> > +#define outw outw
> > static inline void outw(u16 data, unsigned long port)
> > {
> > writew(data, _IO_BASE + (port & IO_SPACE_LIMIT));
> > }
> >
> > +#define outl outl
> > static inline void outl(u32 data, unsigned long port)
> > {
> > writel(data, _IO_BASE + (port & IO_SPACE_LIMIT));
> >
>
> --
> Sincerely yours,
> Mike.
>
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v6 02/19] hexagon: mm: Convert to GENERIC_IOREMAP
2023-06-11 7:57 ` Baoquan He
@ 2023-06-12 16:02 ` Nathan Chancellor
2023-06-16 12:46 ` Baoquan He
0 siblings, 1 reply; 45+ messages in thread
From: Nathan Chancellor @ 2023-06-12 16:02 UTC (permalink / raw)
To: Baoquan He
Cc: Mike Rapoport, kernel test robot, linux-kernel, llvm,
oe-kbuild-all, linux-arch, linux-mm, arnd, christophe.leroy, hch,
willy, agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Brian Cain, linux-hexagon
On Sun, Jun 11, 2023 at 03:57:32PM +0800, Baoquan He wrote:
> On 06/11/23 at 08:40am, Mike Rapoport wrote:
> > Hi Baoquan,
> >
> > On Sat, Jun 10, 2023 at 04:26:21PM +0800, Baoquan He wrote:
> > > On 06/09/23 at 07:09pm, kernel test robot wrote:
> > > > Hi Baoquan,
> > > >
> > > > kernel test robot noticed the following build errors:
> > > >
> > > > [auto build test ERROR on akpm-mm/mm-everything]
> > > >
> > > > url: https://github.com/intel-lab-lkp/linux/commits/Baoquan-He/asm-generic-iomap-h-remove-ARCH_HAS_IOREMAP_xx-macros/20230609-160014
> > > > base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
> > > > patch link: https://lore.kernel.org/r/20230609075528.9390-3-bhe%40redhat.com
> > > > patch subject: [PATCH v6 02/19] hexagon: mm: Convert to GENERIC_IOREMAP
> > > > config: hexagon-randconfig-r041-20230608 (https://download.01.org/0day-ci/archive/20230609/202306091859.NhlW2nny-lkp@intel.com/config)
> > > > compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
> > > > reproduce (this is a W=1 build):
> > > > mkdir -p ~/bin
> > > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > > > chmod +x ~/bin/make.cross
> > > > git remote add akpm-mm https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git
> > > > git fetch akpm-mm mm-everything
> > > > git checkout akpm-mm/mm-everything
> > > > b4 shazam https://lore.kernel.org/r/20230609075528.9390-3-bhe@redhat.com
> > > > # save the config file
> > > > mkdir build_dir && cp config build_dir/.config
> > > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=hexagon olddefconfig
> > > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=hexagon prepare
> > > >
> > > > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > > > the same patch/commit), kindly add following tags
> > > > | Reported-by: kernel test robot <lkp@intel.com>
> > > > | Closes: https://lore.kernel.org/oe-kbuild-all/202306091859.NhlW2nny-lkp@intel.com/
> > >
> > > Thanks for reporting. I reproduced them on my local machine. Below patch
> > > can fix them. And by the way, I also saw the clone3 warning, and have to
> > > made change in scripts/checksyscalls.sh to mute it, wondering how you
> > > handle it in your testing.
> >
> > I think the warning kbuild reported is rather this one:
> >
> > >> include/asm-generic/io.h:1078:6: error: conflicting types for 'iounmap'
> > 1078 | void iounmap(volatile void __iomem *addr);
> > | ^
>
> This one is reported as error. The old iounmap() declaration has a const,
> while the standard one doesn't have. So I just remove the old one to use
> the standard one.
>
> Another one is warning about PCI_IOBASE. Because inb/w/l and outb/w/l is
> redefined in asm-generic/io.h, and it uses PCI_IOBASE which is defniend
> as NULL in asm-generic/io.h if ARCH doesn't have its own PCI_IOBASE
> definition. Then the warning is triggered. So I define macro to override
> the standard inb/w/l and outb/w/l.
>
> #ifndef PCI_IOBASE
> #define PCI_IOBASE ((void __iomem *)0)
> #endif
I believe that this series [1] by Niklas Schnelle should take care of
the PCI_IOBASE warnings (which are not Hexagon specific), so there is no
need to worry about them when they show up in build reports.
[1]: https://lore.kernel.org/20230522105049.1467313-1-schnelle@linux.ibm.com/
Cheers,
Nathan
> > > stdin>:1520:2: warning: syscall clone3 not implemented [-W#warnings]
> > > 1520 | #warning syscall clone3 not implemented
> > > | ^
> > > 1 warning generated.
> > >
> > > ------
> > > diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
> > > index 1e5d2eeb726d..3a369b78edb7 100755
> > > --- a/scripts/checksyscalls.sh
> > > +++ b/scripts/checksyscalls.sh
> > > @@ -148,6 +148,7 @@ cat << EOF
> > > #define __IGNORE_nanosleep
> > > #define __IGNORE_io_getevents
> > > #define __IGNORE_recvmmsg
> > > +#define __IGNORE_clone3
> > > #endif
> > >
> > >
> > > From 6a86f4360a61a2b7b4d71172e5c03be554367553 Mon Sep 17 00:00:00 2001
> > > From: root <root@dell-pem620-01.dell2.lab.eng.bos.redhat.com>
> > > Date: Fri, 9 Jun 2023 21:21:36 -0400
> > > Subject: [PATCH] hexagon: mm: fix warning in asm/io.h
> > > Content-type: text/plain
> > >
> > > Remove the old iounmap() declaration which is not consistent with the
> > > standard one in asm-generic/io.h, let's use the standard one.
> > >
> > > And also add macro definition of inb/w/l and outb/w/l to override
> > > the definition of them in asm-generic/io.h.
> > >
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Signed-off-by: Baoquan He <bhe@redhat.com>
> > > ---
> > > arch/hexagon/include/asm/io.h | 8 ++++++--
> > > scripts/checksyscalls.sh | 1 +
> > > 2 files changed, 7 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/arch/hexagon/include/asm/io.h b/arch/hexagon/include/asm/io.h
> > > index dcd9cbbf5934..efe9cb00ebf8 100644
> > > --- a/arch/hexagon/include/asm/io.h
> > > +++ b/arch/hexagon/include/asm/io.h
> > > @@ -27,8 +27,6 @@
> > > extern int remap_area_pages(unsigned long start, unsigned long phys_addr,
> > > unsigned long end, unsigned long flags);
> > >
> > > -extern void iounmap(const volatile void __iomem *addr);
> > > -
> > > /* Defined in lib/io.c, needed for smc91x driver. */
> > > extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen);
> > > extern void __raw_writesw(void __iomem *addr, const void *data, int wordlen);
> > > @@ -207,16 +205,19 @@ static inline void memset_io(volatile void __iomem *addr, int value,
> > > *
> > > * Operates on "I/O bus I/O space"
> > > */
> > > +#define inb inb
> > > static inline u8 inb(unsigned long port)
> > > {
> > > return readb(_IO_BASE + (port & IO_SPACE_LIMIT));
> > > }
> > >
> > > +#define inw inw
> > > static inline u16 inw(unsigned long port)
> > > {
> > > return readw(_IO_BASE + (port & IO_SPACE_LIMIT));
> > > }
> > >
> > > +#define inl inl
> > > static inline u32 inl(unsigned long port)
> > > {
> > > return readl(_IO_BASE + (port & IO_SPACE_LIMIT));
> > > @@ -227,16 +228,19 @@ static inline u32 inl(unsigned long port)
> > > * @data: data to write to
> > > * @addr: address in I/O space
> > > */
> > > +#define outb outb
> > > static inline void outb(u8 data, unsigned long port)
> > > {
> > > writeb(data, _IO_BASE + (port & IO_SPACE_LIMIT));
> > > }
> > >
> > > +#define outw outw
> > > static inline void outw(u16 data, unsigned long port)
> > > {
> > > writew(data, _IO_BASE + (port & IO_SPACE_LIMIT));
> > > }
> > >
> > > +#define outl outl
> > > static inline void outl(u32 data, unsigned long port)
> > > {
> > > writel(data, _IO_BASE + (port & IO_SPACE_LIMIT));
> > >
> >
> > --
> > Sincerely yours,
> > Mike.
> >
>
>
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v6 02/19] hexagon: mm: Convert to GENERIC_IOREMAP
2023-06-12 16:02 ` Nathan Chancellor
@ 2023-06-16 12:46 ` Baoquan He
0 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2023-06-16 12:46 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Mike Rapoport, kernel test robot, linux-kernel, llvm,
oe-kbuild-all, linux-arch, linux-mm, arnd, christophe.leroy, hch,
willy, agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Brian Cain, linux-hexagon
On 06/12/23 at 09:02am, Nathan Chancellor wrote:
> On Sun, Jun 11, 2023 at 03:57:32PM +0800, Baoquan He wrote:
> > On 06/11/23 at 08:40am, Mike Rapoport wrote:
> > > Hi Baoquan,
> > >
> > > On Sat, Jun 10, 2023 at 04:26:21PM +0800, Baoquan He wrote:
> > > > On 06/09/23 at 07:09pm, kernel test robot wrote:
> > > > > Hi Baoquan,
> > > > >
> > > > > kernel test robot noticed the following build errors:
> > > > >
> > > > > [auto build test ERROR on akpm-mm/mm-everything]
> > > > >
> > > > > url: https://github.com/intel-lab-lkp/linux/commits/Baoquan-He/asm-generic-iomap-h-remove-ARCH_HAS_IOREMAP_xx-macros/20230609-160014
> > > > > base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
> > > > > patch link: https://lore.kernel.org/r/20230609075528.9390-3-bhe%40redhat.com
> > > > > patch subject: [PATCH v6 02/19] hexagon: mm: Convert to GENERIC_IOREMAP
> > > > > config: hexagon-randconfig-r041-20230608 (https://download.01.org/0day-ci/archive/20230609/202306091859.NhlW2nny-lkp@intel.com/config)
> > > > > compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
> > > > > reproduce (this is a W=1 build):
> > > > > mkdir -p ~/bin
> > > > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > > > > chmod +x ~/bin/make.cross
> > > > > git remote add akpm-mm https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git
> > > > > git fetch akpm-mm mm-everything
> > > > > git checkout akpm-mm/mm-everything
> > > > > b4 shazam https://lore.kernel.org/r/20230609075528.9390-3-bhe@redhat.com
> > > > > # save the config file
> > > > > mkdir build_dir && cp config build_dir/.config
> > > > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=hexagon olddefconfig
> > > > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=hexagon prepare
> > > > >
> > > > > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > > > > the same patch/commit), kindly add following tags
> > > > > | Reported-by: kernel test robot <lkp@intel.com>
> > > > > | Closes: https://lore.kernel.org/oe-kbuild-all/202306091859.NhlW2nny-lkp@intel.com/
> > > >
> > > > Thanks for reporting. I reproduced them on my local machine. Below patch
> > > > can fix them. And by the way, I also saw the clone3 warning, and have to
> > > > made change in scripts/checksyscalls.sh to mute it, wondering how you
> > > > handle it in your testing.
> > >
> > > I think the warning kbuild reported is rather this one:
> > >
> > > >> include/asm-generic/io.h:1078:6: error: conflicting types for 'iounmap'
> > > 1078 | void iounmap(volatile void __iomem *addr);
> > > | ^
> >
> > This one is reported as error. The old iounmap() declaration has a const,
> > while the standard one doesn't have. So I just remove the old one to use
> > the standard one.
> >
> > Another one is warning about PCI_IOBASE. Because inb/w/l and outb/w/l is
> > redefined in asm-generic/io.h, and it uses PCI_IOBASE which is defniend
> > as NULL in asm-generic/io.h if ARCH doesn't have its own PCI_IOBASE
> > definition. Then the warning is triggered. So I define macro to override
> > the standard inb/w/l and outb/w/l.
> >
> > #ifndef PCI_IOBASE
> > #define PCI_IOBASE ((void __iomem *)0)
> > #endif
>
> I believe that this series [1] by Niklas Schnelle should take care of
> the PCI_IOBASE warnings (which are not Hexagon specific), so there is no
> need to worry about them when they show up in build reports.
>
> [1]: https://lore.kernel.org/20230522105049.1467313-1-schnelle@linux.ibm.com/
That's great, then I can skip the fixing of PCI_IOBASE warnings, only
wrap the fixing of iounmap() declaration issue into the new post. Thanks
a lot for the information, Nathan.
Thanks
Baoquan
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v6 03/19] openrisc: mm: remove unneeded early ioremap code
2023-06-09 7:55 [PATCH v6 00/19] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
2023-06-09 7:55 ` [PATCH v6 01/19] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros Baoquan He
2023-06-09 7:55 ` [PATCH v6 02/19] hexagon: mm: Convert to GENERIC_IOREMAP Baoquan He
@ 2023-06-09 7:55 ` Baoquan He
2023-06-10 6:24 ` Christoph Hellwig
2023-06-11 5:44 ` Mike Rapoport
2023-06-09 7:55 ` [PATCH v6 04/19] mm/ioremap: Define generic_ioremap_prot() and generic_iounmap() Baoquan He
` (15 subsequent siblings)
18 siblings, 2 replies; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Baoquan He, Jonas Bonn, Stefan Kristiansson, openrisc
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 <bhe@redhat.com>
Acked-by: Stafford Horne <shorne@gmail.com>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: Stafford Horne <shorne@gmail.com>
Cc: openrisc@lists.librecores.org
---
v5->v6:
Remove the special handling in iounmap() because no page is got from
fixmap pool along with early ioremap code removing in ioremap() - Mike.
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
^ permalink raw reply related [flat|nested] 45+ messages in thread
* Re: [PATCH v6 03/19] openrisc: mm: remove unneeded early ioremap code
2023-06-09 7:55 ` [PATCH v6 03/19] openrisc: mm: remove unneeded early ioremap code Baoquan He
@ 2023-06-10 6:24 ` Christoph Hellwig
2023-06-11 5:44 ` Mike Rapoport
1 sibling, 0 replies; 45+ messages in thread
From: Christoph Hellwig @ 2023-06-10 6:24 UTC (permalink / raw)
To: Baoquan He
Cc: linux-kernel, linux-arch, linux-mm, arnd, christophe.leroy, hch,
rppt, willy, agordeev, wangkefeng.wang, schnelle, David.Laight,
shorne, deller, Jonas Bonn, Stefan Kristiansson, openrisc
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v6 03/19] openrisc: mm: remove unneeded early ioremap code
2023-06-09 7:55 ` [PATCH v6 03/19] openrisc: mm: remove unneeded early ioremap code Baoquan He
2023-06-10 6:24 ` Christoph Hellwig
@ 2023-06-11 5:44 ` Mike Rapoport
1 sibling, 0 replies; 45+ messages in thread
From: Mike Rapoport @ 2023-06-11 5:44 UTC (permalink / raw)
To: Baoquan He
Cc: linux-kernel, linux-arch, linux-mm, arnd, christophe.leroy, hch,
willy, agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Jonas Bonn, Stefan Kristiansson, openrisc
On Fri, Jun 09, 2023 at 03:55:12PM +0800, Baoquan He wrote:
> 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 <bhe@redhat.com>
> Acked-by: Stafford Horne <shorne@gmail.com>
> Cc: Jonas Bonn <jonas@southpole.se>
> Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
> Cc: Stafford Horne <shorne@gmail.com>
> Cc: openrisc@lists.librecores.org
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
> ---
> v5->v6:
> Remove the special handling in iounmap() because no page is got from
> fixmap pool along with early ioremap code removing in ioremap() - Mike.
>
> 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
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v6 04/19] mm/ioremap: Define generic_ioremap_prot() and generic_iounmap()
2023-06-09 7:55 [PATCH v6 00/19] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
` (2 preceding siblings ...)
2023-06-09 7:55 ` [PATCH v6 03/19] openrisc: mm: remove unneeded early ioremap code Baoquan He
@ 2023-06-09 7:55 ` Baoquan He
2023-06-10 6:24 ` Christoph Hellwig
2023-06-09 7:55 ` [PATCH v6 05/19] mm: ioremap: allow ARCH to have its own ioremap method definition Baoquan He
` (14 subsequent siblings)
18 siblings, 1 reply; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Baoquan He
From: Christophe Leroy <christophe.leroy@csgroup.eu>
Define a generic version of ioremap_prot() and iounmap() that
architectures can call after they have performed the necessary
alteration to parameters and/or necessary verifications.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
---
include/asm-generic/io.h | 4 ++++
mm/ioremap.c | 22 ++++++++++++++++------
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 587e7e9b9a37..a7ca2099ba19 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -1073,9 +1073,13 @@ static inline bool iounmap_allowed(void *addr)
}
#endif
+void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size,
+ pgprot_t prot);
+
void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
unsigned long prot);
void iounmap(volatile void __iomem *addr);
+void generic_iounmap(volatile void __iomem *addr);
static inline void __iomem *ioremap(phys_addr_t addr, size_t size)
{
diff --git a/mm/ioremap.c b/mm/ioremap.c
index 8652426282cc..db6234b9db59 100644
--- a/mm/ioremap.c
+++ b/mm/ioremap.c
@@ -11,8 +11,8 @@
#include <linux/io.h>
#include <linux/export.h>
-void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
- unsigned long prot)
+void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size,
+ pgprot_t prot)
{
unsigned long offset, vaddr;
phys_addr_t last_addr;
@@ -28,7 +28,7 @@ void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
phys_addr -= offset;
size = PAGE_ALIGN(size + offset);
- if (!ioremap_allowed(phys_addr, size, prot))
+ if (!ioremap_allowed(phys_addr, size, pgprot_val(prot)))
return NULL;
area = get_vm_area_caller(size, VM_IOREMAP,
@@ -38,17 +38,22 @@ void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
vaddr = (unsigned long)area->addr;
area->phys_addr = phys_addr;
- if (ioremap_page_range(vaddr, vaddr + size, phys_addr,
- __pgprot(prot))) {
+ if (ioremap_page_range(vaddr, vaddr + size, phys_addr, prot)) {
free_vm_area(area);
return NULL;
}
return (void __iomem *)(vaddr + offset);
}
+
+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);
-void iounmap(volatile void __iomem *addr)
+void generic_iounmap(volatile void __iomem *addr)
{
void *vaddr = (void *)((unsigned long)addr & PAGE_MASK);
@@ -58,4 +63,9 @@ void iounmap(volatile void __iomem *addr)
if (is_vmalloc_addr(vaddr))
vunmap(vaddr);
}
+
+void iounmap(volatile void __iomem *addr)
+{
+ generic_iounmap(addr);
+}
EXPORT_SYMBOL(iounmap);
--
2.34.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* Re: [PATCH v6 04/19] mm/ioremap: Define generic_ioremap_prot() and generic_iounmap()
2023-06-09 7:55 ` [PATCH v6 04/19] mm/ioremap: Define generic_ioremap_prot() and generic_iounmap() Baoquan He
@ 2023-06-10 6:24 ` Christoph Hellwig
0 siblings, 0 replies; 45+ messages in thread
From: Christoph Hellwig @ 2023-06-10 6:24 UTC (permalink / raw)
To: Baoquan He
Cc: linux-kernel, linux-arch, linux-mm, arnd, christophe.leroy, hch,
rppt, willy, agordeev, wangkefeng.wang, schnelle, David.Laight,
shorne, deller
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v6 05/19] mm: ioremap: allow ARCH to have its own ioremap method definition
2023-06-09 7:55 [PATCH v6 00/19] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
` (3 preceding siblings ...)
2023-06-09 7:55 ` [PATCH v6 04/19] mm/ioremap: Define generic_ioremap_prot() and generic_iounmap() Baoquan He
@ 2023-06-09 7:55 ` Baoquan He
2023-06-09 7:55 ` [PATCH v6 06/19] mm/ioremap: add slab availability checking in ioremap_prot Baoquan He
` (13 subsequent siblings)
18 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Baoquan He
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 <bhe@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: linux-arch@vger.kernel.org
---
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
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH v6 06/19] mm/ioremap: add slab availability checking in ioremap_prot
2023-06-09 7:55 [PATCH v6 00/19] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
` (4 preceding siblings ...)
2023-06-09 7:55 ` [PATCH v6 05/19] mm: ioremap: allow ARCH to have its own ioremap method definition Baoquan He
@ 2023-06-09 7:55 ` Baoquan He
2023-06-09 7:55 ` Baoquan He
` (12 subsequent siblings)
18 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Baoquan He
Several architectures has done checking if slab if available in
ioremap_prot(). In fact it should be done in generic ioremap_prot()
since on any architecutre, slab allocator must be available before
get_vm_area_caller() and vunmap() are used.
Add the checking into generic_ioremap_prot().
Suggested-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
---
v5-v6:
Add WARN_ON_ONCE to aid debugging - Christoph.
mm/ioremap.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mm/ioremap.c b/mm/ioremap.c
index 9f34a8f90b58..86b82ec27d2b 100644
--- a/mm/ioremap.c
+++ b/mm/ioremap.c
@@ -18,6 +18,10 @@ void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size,
phys_addr_t last_addr;
struct vm_struct *area;
+ /* An early platform driver might end up here */
+ if (WARN_ON_ONCE(!slab_is_available()))
+ return NULL;
+
/* Disallow wrap-around or zero size */
last_addr = phys_addr + size - 1;
if (!size || last_addr < phys_addr)
--
2.34.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH v6 07/19] arc: mm: Convert to GENERIC_IOREMAP
2023-06-09 7:55 [PATCH v6 00/19] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
@ 2023-06-09 7:55 ` Baoquan He
2023-06-09 7:55 ` [PATCH v6 02/19] hexagon: mm: Convert to GENERIC_IOREMAP Baoquan He
` (17 subsequent siblings)
18 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Baoquan He, Vineet Gupta, linux-snps-arc
By taking GENERIC_IOREMAP method, the generic generic_ioremap_prot(),
generic_iounmap(), and their generic wrapper ioremap_prot(), ioremap()
and iounmap() are all visible and available to arch. Arch needs to
provide wrapper functions to override the generic versions if there's
arch specific handling in its ioremap_prot(), ioremap() or iounmap().
This change will simplify implementation by removing duplicated codes
with generic_ioremap_prot() and generic_iounmap(), and has the equivalent
functioality as before.
Here, add wrapper functions ioremap_prot() and iounmap() for arc's
special operation when ioremap_prot() and iounmap().
Signed-off-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: linux-snps-arc@lists.infradead.org
---
arch/arc/Kconfig | 1 +
arch/arc/include/asm/io.h | 7 +++---
arch/arc/mm/ioremap.c | 49 ++++-----------------------------------
3 files changed, 8 insertions(+), 49 deletions(-)
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index ab6d701365bb..3a666ee0c0bc 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -26,6 +26,7 @@ config ARC
select GENERIC_PENDING_IRQ if SMP
select GENERIC_SCHED_CLOCK
select GENERIC_SMP_IDLE_THREAD
+ select GENERIC_IOREMAP
select HAVE_ARCH_KGDB
select HAVE_ARCH_TRACEHOOK
select HAVE_ARCH_TRANSPARENT_HUGEPAGE if ARC_MMU_V4
diff --git a/arch/arc/include/asm/io.h b/arch/arc/include/asm/io.h
index 80347382a380..4fdb7350636c 100644
--- a/arch/arc/include/asm/io.h
+++ b/arch/arc/include/asm/io.h
@@ -21,8 +21,9 @@
#endif
extern void __iomem *ioremap(phys_addr_t paddr, unsigned long size);
-extern void __iomem *ioremap_prot(phys_addr_t paddr, unsigned long size,
- unsigned long flags);
+#define ioremap ioremap
+#define ioremap_prot ioremap_prot
+#define iounmap iounmap
static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
{
return (void __iomem *)port;
@@ -32,8 +33,6 @@ static inline void ioport_unmap(void __iomem *addr)
{
}
-extern void iounmap(const volatile void __iomem *addr);
-
/*
* io{read,write}{16,32}be() macros
*/
diff --git a/arch/arc/mm/ioremap.c b/arch/arc/mm/ioremap.c
index 712c2311daef..b07004d53267 100644
--- a/arch/arc/mm/ioremap.c
+++ b/arch/arc/mm/ioremap.c
@@ -8,7 +8,6 @@
#include <linux/module.h>
#include <linux/io.h>
#include <linux/mm.h>
-#include <linux/slab.h>
#include <linux/cache.h>
static inline bool arc_uncached_addr_space(phys_addr_t paddr)
@@ -25,13 +24,6 @@ static inline bool arc_uncached_addr_space(phys_addr_t paddr)
void __iomem *ioremap(phys_addr_t paddr, unsigned long size)
{
- phys_addr_t end;
-
- /* Don't allow wraparound or zero size */
- end = paddr + size - 1;
- if (!size || (end < paddr))
- return NULL;
-
/*
* If the region is h/w uncached, MMU mapping can be elided as optim
* The cast to u32 is fine as this region can only be inside 4GB
@@ -51,55 +43,22 @@ EXPORT_SYMBOL(ioremap);
* ARC hardware uncached region, this one still goes thru the MMU as caller
* might need finer access control (R/W/X)
*/
-void __iomem *ioremap_prot(phys_addr_t paddr, unsigned long size,
+void __iomem *ioremap_prot(phys_addr_t paddr, size_t size,
unsigned long flags)
{
- unsigned int off;
- unsigned long vaddr;
- struct vm_struct *area;
- phys_addr_t end;
pgprot_t prot = __pgprot(flags);
- /* Don't allow wraparound, zero size */
- end = paddr + size - 1;
- if ((!size) || (end < paddr))
- return NULL;
-
- /* An early platform driver might end up here */
- if (!slab_is_available())
- return NULL;
-
/* force uncached */
- prot = pgprot_noncached(prot);
-
- /* Mappings have to be page-aligned */
- off = paddr & ~PAGE_MASK;
- paddr &= PAGE_MASK_PHYS;
- size = PAGE_ALIGN(end + 1) - paddr;
-
- /*
- * Ok, go for it..
- */
- area = get_vm_area(size, VM_IOREMAP);
- if (!area)
- return NULL;
- area->phys_addr = paddr;
- vaddr = (unsigned long)area->addr;
- if (ioremap_page_range(vaddr, vaddr + size, paddr, prot)) {
- vunmap((void __force *)vaddr);
- return NULL;
- }
- return (void __iomem *)(off + (char __iomem *)vaddr);
+ return generic_ioremap_prot(paddr, size, pgprot_noncached(prot));
}
EXPORT_SYMBOL(ioremap_prot);
-
-void iounmap(const volatile void __iomem *addr)
+void iounmap(volatile void __iomem *addr)
{
/* weird double cast to handle phys_addr_t > 32 bits */
if (arc_uncached_addr_space((phys_addr_t)(u32)addr))
return;
- vfree((void *)(PAGE_MASK & (unsigned long __force)addr));
+ generic_iounmap(addr);
}
EXPORT_SYMBOL(iounmap);
--
2.34.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH v6 07/19] arc: mm: Convert to GENERIC_IOREMAP
@ 2023-06-09 7:55 ` Baoquan He
0 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Baoquan He, Vineet Gupta, linux-snps-arc
By taking GENERIC_IOREMAP method, the generic generic_ioremap_prot(),
generic_iounmap(), and their generic wrapper ioremap_prot(), ioremap()
and iounmap() are all visible and available to arch. Arch needs to
provide wrapper functions to override the generic versions if there's
arch specific handling in its ioremap_prot(), ioremap() or iounmap().
This change will simplify implementation by removing duplicated codes
with generic_ioremap_prot() and generic_iounmap(), and has the equivalent
functioality as before.
Here, add wrapper functions ioremap_prot() and iounmap() for arc's
special operation when ioremap_prot() and iounmap().
Signed-off-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: linux-snps-arc@lists.infradead.org
---
arch/arc/Kconfig | 1 +
arch/arc/include/asm/io.h | 7 +++---
arch/arc/mm/ioremap.c | 49 ++++-----------------------------------
3 files changed, 8 insertions(+), 49 deletions(-)
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index ab6d701365bb..3a666ee0c0bc 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -26,6 +26,7 @@ config ARC
select GENERIC_PENDING_IRQ if SMP
select GENERIC_SCHED_CLOCK
select GENERIC_SMP_IDLE_THREAD
+ select GENERIC_IOREMAP
select HAVE_ARCH_KGDB
select HAVE_ARCH_TRACEHOOK
select HAVE_ARCH_TRANSPARENT_HUGEPAGE if ARC_MMU_V4
diff --git a/arch/arc/include/asm/io.h b/arch/arc/include/asm/io.h
index 80347382a380..4fdb7350636c 100644
--- a/arch/arc/include/asm/io.h
+++ b/arch/arc/include/asm/io.h
@@ -21,8 +21,9 @@
#endif
extern void __iomem *ioremap(phys_addr_t paddr, unsigned long size);
-extern void __iomem *ioremap_prot(phys_addr_t paddr, unsigned long size,
- unsigned long flags);
+#define ioremap ioremap
+#define ioremap_prot ioremap_prot
+#define iounmap iounmap
static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
{
return (void __iomem *)port;
@@ -32,8 +33,6 @@ static inline void ioport_unmap(void __iomem *addr)
{
}
-extern void iounmap(const volatile void __iomem *addr);
-
/*
* io{read,write}{16,32}be() macros
*/
diff --git a/arch/arc/mm/ioremap.c b/arch/arc/mm/ioremap.c
index 712c2311daef..b07004d53267 100644
--- a/arch/arc/mm/ioremap.c
+++ b/arch/arc/mm/ioremap.c
@@ -8,7 +8,6 @@
#include <linux/module.h>
#include <linux/io.h>
#include <linux/mm.h>
-#include <linux/slab.h>
#include <linux/cache.h>
static inline bool arc_uncached_addr_space(phys_addr_t paddr)
@@ -25,13 +24,6 @@ static inline bool arc_uncached_addr_space(phys_addr_t paddr)
void __iomem *ioremap(phys_addr_t paddr, unsigned long size)
{
- phys_addr_t end;
-
- /* Don't allow wraparound or zero size */
- end = paddr + size - 1;
- if (!size || (end < paddr))
- return NULL;
-
/*
* If the region is h/w uncached, MMU mapping can be elided as optim
* The cast to u32 is fine as this region can only be inside 4GB
@@ -51,55 +43,22 @@ EXPORT_SYMBOL(ioremap);
* ARC hardware uncached region, this one still goes thru the MMU as caller
* might need finer access control (R/W/X)
*/
-void __iomem *ioremap_prot(phys_addr_t paddr, unsigned long size,
+void __iomem *ioremap_prot(phys_addr_t paddr, size_t size,
unsigned long flags)
{
- unsigned int off;
- unsigned long vaddr;
- struct vm_struct *area;
- phys_addr_t end;
pgprot_t prot = __pgprot(flags);
- /* Don't allow wraparound, zero size */
- end = paddr + size - 1;
- if ((!size) || (end < paddr))
- return NULL;
-
- /* An early platform driver might end up here */
- if (!slab_is_available())
- return NULL;
-
/* force uncached */
- prot = pgprot_noncached(prot);
-
- /* Mappings have to be page-aligned */
- off = paddr & ~PAGE_MASK;
- paddr &= PAGE_MASK_PHYS;
- size = PAGE_ALIGN(end + 1) - paddr;
-
- /*
- * Ok, go for it..
- */
- area = get_vm_area(size, VM_IOREMAP);
- if (!area)
- return NULL;
- area->phys_addr = paddr;
- vaddr = (unsigned long)area->addr;
- if (ioremap_page_range(vaddr, vaddr + size, paddr, prot)) {
- vunmap((void __force *)vaddr);
- return NULL;
- }
- return (void __iomem *)(off + (char __iomem *)vaddr);
+ return generic_ioremap_prot(paddr, size, pgprot_noncached(prot));
}
EXPORT_SYMBOL(ioremap_prot);
-
-void iounmap(const volatile void __iomem *addr)
+void iounmap(volatile void __iomem *addr)
{
/* weird double cast to handle phys_addr_t > 32 bits */
if (arc_uncached_addr_space((phys_addr_t)(u32)addr))
return;
- vfree((void *)(PAGE_MASK & (unsigned long __force)addr));
+ generic_iounmap(addr);
}
EXPORT_SYMBOL(iounmap);
--
2.34.1
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH v6 08/19] ia64: mm: Convert to GENERIC_IOREMAP
2023-06-09 7:55 [PATCH v6 00/19] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
` (6 preceding siblings ...)
2023-06-09 7:55 ` Baoquan He
@ 2023-06-09 7:55 ` Baoquan He
2023-06-09 7:55 ` [PATCH v6 09/19] openrisc: " Baoquan He
` (10 subsequent siblings)
18 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Baoquan He, linux-ia64
By taking GENERIC_IOREMAP method, the generic generic_ioremap_prot(),
generic_iounmap(), and their generic wrapper ioremap_prot(), ioremap()
and iounmap() are all visible and available to arch. Arch needs to
provide wrapper functions to override the generic versions if there's
arch specific handling in its ioremap_prot(), ioremap() or iounmap().
This change will simplify implementation by removing duplicated codes
with generic_ioremap_prot() and generic_iounmap(), and has the equivalent
functioality as before.
Here, add wrapper functions ioremap_prot() and iounmap() for ia64's
special operation when ioremap() and iounmap().
Signed-off-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: linux-ia64@vger.kernel.org
---
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 21fa63ce5ffc..4f970b6d8032 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -46,6 +46,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
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH v6 09/19] openrisc: mm: Convert to GENERIC_IOREMAP
2023-06-09 7:55 [PATCH v6 00/19] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
` (7 preceding siblings ...)
2023-06-09 7:55 ` [PATCH v6 08/19] ia64: " Baoquan He
@ 2023-06-09 7:55 ` Baoquan He
2023-06-10 6:25 ` Christoph Hellwig
2023-06-11 5:46 ` Mike Rapoport
2023-06-09 7:55 ` [PATCH v6 10/19] s390: " Baoquan He
` (9 subsequent siblings)
18 siblings, 2 replies; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Baoquan He, Jonas Bonn, Stefan Kristiansson, openrisc
By taking GENERIC_IOREMAP method, the generic generic_ioremap_prot(),
generic_iounmap(), and their generic wrapper ioremap_prot(), ioremap()
and iounmap() are all visible and available to arch. Arch needs to
provide wrapper functions to override the generic versions if there's
arch specific handling in its ioremap_prot(), ioremap() or iounmap().
This change will simplify implementation by removing duplicated codes
with generic_ioremap_prot() and generic_iounmap(), and has the equivalent
functioality as before.
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 <bhe@redhat.com>
Cc: Stafford Horne <shorne@gmail.com>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: openrisc@lists.librecores.org
---
v5->v6:
Remove iounmap() because it's the same as the generic version since we
have removed the code handling ealry mapping from fixmap pool in
patch 3 - Mike
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
^ permalink raw reply related [flat|nested] 45+ messages in thread
* Re: [PATCH v6 09/19] openrisc: mm: Convert to GENERIC_IOREMAP
2023-06-09 7:55 ` [PATCH v6 09/19] openrisc: " Baoquan He
@ 2023-06-10 6:25 ` Christoph Hellwig
2023-06-11 5:46 ` Mike Rapoport
1 sibling, 0 replies; 45+ messages in thread
From: Christoph Hellwig @ 2023-06-10 6:25 UTC (permalink / raw)
To: Baoquan He
Cc: linux-kernel, linux-arch, linux-mm, arnd, christophe.leroy, hch,
rppt, willy, agordeev, wangkefeng.wang, schnelle, David.Laight,
shorne, deller, Jonas Bonn, Stefan Kristiansson, openrisc
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v6 09/19] openrisc: mm: Convert to GENERIC_IOREMAP
2023-06-09 7:55 ` [PATCH v6 09/19] openrisc: " Baoquan He
2023-06-10 6:25 ` Christoph Hellwig
@ 2023-06-11 5:46 ` Mike Rapoport
1 sibling, 0 replies; 45+ messages in thread
From: Mike Rapoport @ 2023-06-11 5:46 UTC (permalink / raw)
To: Baoquan He
Cc: linux-kernel, linux-arch, linux-mm, arnd, christophe.leroy, hch,
willy, agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Jonas Bonn, Stefan Kristiansson, openrisc
On Fri, Jun 09, 2023 at 03:55:18PM +0800, Baoquan He wrote:
> By taking GENERIC_IOREMAP method, the generic generic_ioremap_prot(),
> generic_iounmap(), and their generic wrapper ioremap_prot(), ioremap()
> and iounmap() are all visible and available to arch. Arch needs to
> provide wrapper functions to override the generic versions if there's
> arch specific handling in its ioremap_prot(), ioremap() or iounmap().
> This change will simplify implementation by removing duplicated codes
> with generic_ioremap_prot() and generic_iounmap(), and has the equivalent
> functioality as before.
>
> 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 <bhe@redhat.com>
> Cc: Stafford Horne <shorne@gmail.com>
> Cc: Jonas Bonn <jonas@southpole.se>
> Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
> Cc: openrisc@lists.librecores.org
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
> ---
> v5->v6:
> Remove iounmap() because it's the same as the generic version since we
> have removed the code handling ealry mapping from fixmap pool in
> patch 3 - Mike
>
> 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
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v6 10/19] s390: mm: Convert to GENERIC_IOREMAP
2023-06-09 7:55 [PATCH v6 00/19] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
` (8 preceding siblings ...)
2023-06-09 7:55 ` [PATCH v6 09/19] openrisc: " Baoquan He
@ 2023-06-09 7:55 ` Baoquan He
2023-06-09 15:41 ` kernel test robot
` (2 more replies)
2023-06-09 7:55 ` [PATCH v6 11/19] sh: add <asm-generic/io.h> including Baoquan He
` (8 subsequent siblings)
18 siblings, 3 replies; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Baoquan He, Gerald Schaefer, Heiko Carstens,
Vasily Gorbik, Christian Borntraeger, Sven Schnelle, linux-s390
By taking GENERIC_IOREMAP method, the generic generic_ioremap_prot(),
generic_iounmap(), and their generic wrapper ioremap_prot(), ioremap()
and iounmap() are all visible and available to arch. Arch needs to
provide wrapper functions to override the generic versions if there's
arch specific handling in its ioremap_prot(), ioremap() or iounmap().
This change will simplify implementation by removing duplicated codes
with generic_ioremap_prot() and generic_iounmap(), and has the equivalent
functioality as before.
Here, add wrapper functions ioremap_prot() and iounmap() for s390's
special operation when ioremap() and iounmap().
Signed-off-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: linux-s390@vger.kernel.org
---
arch/s390/Kconfig | 1 +
arch/s390/include/asm/io.h | 21 ++++++++------
arch/s390/pci/pci.c | 57 +++++++-------------------------------
3 files changed, 23 insertions(+), 56 deletions(-)
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 6dab9c1be508..e625bb0cc6c7 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -142,6 +142,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/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
^ permalink raw reply related [flat|nested] 45+ messages in thread
* Re: [PATCH v6 10/19] s390: mm: Convert to GENERIC_IOREMAP
2023-06-09 7:55 ` [PATCH v6 10/19] s390: " Baoquan He
@ 2023-06-09 15:41 ` kernel test robot
2023-06-09 17:42 ` kernel test robot
2023-06-09 17:42 ` kernel test robot
2 siblings, 0 replies; 45+ messages in thread
From: kernel test robot @ 2023-06-09 15:41 UTC (permalink / raw)
To: Baoquan He, linux-kernel
Cc: llvm, oe-kbuild-all, linux-arch, linux-mm, arnd,
christophe.leroy, hch, rppt, willy, agordeev, wangkefeng.wang,
schnelle, David.Laight, shorne, deller, Baoquan He,
Gerald Schaefer, Heiko Carstens, Vasily Gorbik,
Christian Borntraeger, Sven Schnelle, linux-s390
Hi Baoquan,
kernel test robot noticed the following build errors:
[auto build test ERROR on akpm-mm/mm-everything]
url: https://github.com/intel-lab-lkp/linux/commits/Baoquan-He/asm-generic-iomap-h-remove-ARCH_HAS_IOREMAP_xx-macros/20230609-160014
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20230609075528.9390-11-bhe%40redhat.com
patch subject: [PATCH v6 10/19] s390: mm: Convert to GENERIC_IOREMAP
config: s390-randconfig-r014-20230608 (https://download.01.org/0day-ci/archive/20230609/202306092349.88mhfjhr-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce (this is a W=1 build):
mkdir -p ~/bin
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install s390 cross compiling tool for clang build
# apt-get install binutils-s390x-linux-gnu
git remote add akpm-mm https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git
git fetch akpm-mm mm-everything
git checkout akpm-mm/mm-everything
b4 shazam https://lore.kernel.org/r/20230609075528.9390-11-bhe@redhat.com
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=s390 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash drivers/pcmcia/
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306092349.88mhfjhr-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from drivers/pcmcia/cistpl.c:21:
In file included from include/linux/pci.h:39:
In file included from include/linux/io.h:13:
In file included from arch/s390/include/asm/io.h:78:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
547 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
560 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:37:59: note: expanded from macro '__le16_to_cpu'
37 | #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
| ^
include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
102 | #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
| ^
In file included from drivers/pcmcia/cistpl.c:21:
In file included from include/linux/pci.h:39:
In file included from include/linux/io.h:13:
In file included from arch/s390/include/asm/io.h:78:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
573 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
| ^
include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
| ^
In file included from drivers/pcmcia/cistpl.c:21:
In file included from include/linux/pci.h:39:
In file included from include/linux/io.h:13:
In file included from arch/s390/include/asm/io.h:78:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
584 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
594 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
604 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:692:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
692 | readsb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:700:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
700 | readsw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:708:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
708 | readsl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:717:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
717 | writesb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:726:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
726 | writesw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
735 | writesl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
>> drivers/pcmcia/cistpl.c:72:3: error: call to undeclared function 'iounmap'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
72 | iounmap(s->cis_virt);
| ^
arch/s390/include/asm/io.h:29:17: note: expanded from macro 'iounmap'
29 | #define iounmap iounmap
| ^
drivers/pcmcia/cistpl.c:72:3: note: did you mean 'vunmap'?
arch/s390/include/asm/io.h:29:17: note: expanded from macro 'iounmap'
29 | #define iounmap iounmap
| ^
include/linux/vmalloc.h:167:13: note: 'vunmap' declared here
167 | extern void vunmap(const void *addr);
| ^
>> drivers/pcmcia/cistpl.c:103:17: error: call to undeclared function 'ioremap'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
103 | s->cis_virt = ioremap(mem->res->start, s->map_size);
| ^
>> drivers/pcmcia/cistpl.c:103:15: error: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
103 | s->cis_virt = ioremap(mem->res->start, s->map_size);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/pcmcia/cistpl.c:110:3: error: call to undeclared function 'iounmap'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
110 | iounmap(s->cis_virt);
| ^
arch/s390/include/asm/io.h:29:17: note: expanded from macro 'iounmap'
29 | #define iounmap iounmap
| ^
drivers/pcmcia/cistpl.c:117:4: error: call to undeclared function 'iounmap'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
117 | iounmap(s->cis_virt);
| ^
arch/s390/include/asm/io.h:29:17: note: expanded from macro 'iounmap'
29 | #define iounmap iounmap
| ^
drivers/pcmcia/cistpl.c:118:15: error: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
118 | s->cis_virt = ioremap(mem->static_start, s->map_size);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12 warnings and 6 errors generated.
vim +/iounmap +72 drivers/pcmcia/cistpl.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 60
^1da177e4c3f41 Linus Torvalds 2005-04-16 61 void release_cis_mem(struct pcmcia_socket *s)
^1da177e4c3f41 Linus Torvalds 2005-04-16 62 {
6b8e087b86c59c Dominik Brodowski 2010-01-12 63 mutex_lock(&s->ops_mutex);
^1da177e4c3f41 Linus Torvalds 2005-04-16 64 if (s->cis_mem.flags & MAP_ACTIVE) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 65 s->cis_mem.flags &= ~MAP_ACTIVE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 66 s->ops->set_mem_map(s, &s->cis_mem);
^1da177e4c3f41 Linus Torvalds 2005-04-16 67 if (s->cis_mem.res) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 68 release_resource(s->cis_mem.res);
^1da177e4c3f41 Linus Torvalds 2005-04-16 69 kfree(s->cis_mem.res);
^1da177e4c3f41 Linus Torvalds 2005-04-16 70 s->cis_mem.res = NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 71 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 @72 iounmap(s->cis_virt);
^1da177e4c3f41 Linus Torvalds 2005-04-16 73 s->cis_virt = NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 74 }
6b8e087b86c59c Dominik Brodowski 2010-01-12 75 mutex_unlock(&s->ops_mutex);
^1da177e4c3f41 Linus Torvalds 2005-04-16 76 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 77
cc448baf85c8f2 Lee Jones 2021-03-12 78 /*
6e83ee075ed749 Dominik Brodowski 2010-03-02 79 * set_cis_map() - map the card memory at "card_offset" into virtual space.
6e83ee075ed749 Dominik Brodowski 2010-03-02 80 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 81 * If flags & MAP_ATTRIB, map the attribute space, otherwise
^1da177e4c3f41 Linus Torvalds 2005-04-16 82 * map the memory space.
7ab24855482fbc Dominik Brodowski 2010-02-17 83 *
7ab24855482fbc Dominik Brodowski 2010-02-17 84 * Must be called with ops_mutex held.
^1da177e4c3f41 Linus Torvalds 2005-04-16 85 */
6e83ee075ed749 Dominik Brodowski 2010-03-02 86 static void __iomem *set_cis_map(struct pcmcia_socket *s,
6e83ee075ed749 Dominik Brodowski 2010-03-02 87 unsigned int card_offset, unsigned int flags)
^1da177e4c3f41 Linus Torvalds 2005-04-16 88 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 89 pccard_mem_map *mem = &s->cis_mem;
2ad0a0a793cbd8 Dominik Brodowski 2005-06-27 90 int ret;
2ad0a0a793cbd8 Dominik Brodowski 2005-06-27 91
2e5a3e79091615 Dominik Brodowski 2005-07-28 92 if (!(s->features & SS_CAP_STATIC_MAP) && (mem->res == NULL)) {
6e83ee075ed749 Dominik Brodowski 2010-03-02 93 mem->res = pcmcia_find_mem_region(0, s->map_size,
6e83ee075ed749 Dominik Brodowski 2010-03-02 94 s->map_size, 0, s);
^1da177e4c3f41 Linus Torvalds 2005-04-16 95 if (mem->res == NULL) {
f2e6cf76751d47 Joe Perches 2014-10-10 96 dev_notice(&s->dev, "cs: unable to map card memory!\n");
^1da177e4c3f41 Linus Torvalds 2005-04-16 97 return NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 98 }
2e5a3e79091615 Dominik Brodowski 2005-07-28 99 s->cis_virt = NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 100 }
2e5a3e79091615 Dominik Brodowski 2005-07-28 101
2e5a3e79091615 Dominik Brodowski 2005-07-28 102 if (!(s->features & SS_CAP_STATIC_MAP) && (!s->cis_virt))
2e5a3e79091615 Dominik Brodowski 2005-07-28 @103 s->cis_virt = ioremap(mem->res->start, s->map_size);
2e5a3e79091615 Dominik Brodowski 2005-07-28 104
^1da177e4c3f41 Linus Torvalds 2005-04-16 105 mem->card_start = card_offset;
^1da177e4c3f41 Linus Torvalds 2005-04-16 106 mem->flags = flags;
2e5a3e79091615 Dominik Brodowski 2005-07-28 107
2ad0a0a793cbd8 Dominik Brodowski 2005-06-27 108 ret = s->ops->set_mem_map(s, mem);
2ad0a0a793cbd8 Dominik Brodowski 2005-06-27 109 if (ret) {
2ad0a0a793cbd8 Dominik Brodowski 2005-06-27 110 iounmap(s->cis_virt);
2e5a3e79091615 Dominik Brodowski 2005-07-28 111 s->cis_virt = NULL;
2ad0a0a793cbd8 Dominik Brodowski 2005-06-27 112 return NULL;
2ad0a0a793cbd8 Dominik Brodowski 2005-06-27 113 }
2ad0a0a793cbd8 Dominik Brodowski 2005-06-27 114
^1da177e4c3f41 Linus Torvalds 2005-04-16 115 if (s->features & SS_CAP_STATIC_MAP) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 116 if (s->cis_virt)
^1da177e4c3f41 Linus Torvalds 2005-04-16 117 iounmap(s->cis_virt);
^1da177e4c3f41 Linus Torvalds 2005-04-16 118 s->cis_virt = ioremap(mem->static_start, s->map_size);
^1da177e4c3f41 Linus Torvalds 2005-04-16 119 }
2e5a3e79091615 Dominik Brodowski 2005-07-28 120
^1da177e4c3f41 Linus Torvalds 2005-04-16 121 return s->cis_virt;
^1da177e4c3f41 Linus Torvalds 2005-04-16 122 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 123
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v6 10/19] s390: mm: Convert to GENERIC_IOREMAP
2023-06-09 7:55 ` [PATCH v6 10/19] s390: " Baoquan He
2023-06-09 15:41 ` kernel test robot
@ 2023-06-09 17:42 ` kernel test robot
2023-06-09 17:42 ` kernel test robot
2 siblings, 0 replies; 45+ messages in thread
From: kernel test robot @ 2023-06-09 17:42 UTC (permalink / raw)
To: Baoquan He, linux-kernel
Cc: oe-kbuild-all, linux-arch, linux-mm, arnd, christophe.leroy, hch,
rppt, willy, agordeev, wangkefeng.wang, schnelle, David.Laight,
shorne, deller, Baoquan He, Gerald Schaefer, Heiko Carstens,
Vasily Gorbik, Christian Borntraeger, Sven Schnelle, linux-s390
Hi Baoquan,
kernel test robot noticed the following build errors:
[auto build test ERROR on akpm-mm/mm-everything]
url: https://github.com/intel-lab-lkp/linux/commits/Baoquan-He/asm-generic-iomap-h-remove-ARCH_HAS_IOREMAP_xx-macros/20230609-160014
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20230609075528.9390-11-bhe%40redhat.com
patch subject: [PATCH v6 10/19] s390: mm: Convert to GENERIC_IOREMAP
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20230610/202306100146.Eag3T7hY-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 12.3.0
reproduce (this is a W=1 build):
mkdir -p ~/bin
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git remote add akpm-mm https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git
git fetch akpm-mm mm-everything
git checkout akpm-mm/mm-everything
b4 shazam https://lore.kernel.org/r/20230609075528.9390-11-bhe@redhat.com
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=s390 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash drivers/net/arcnet/ drivers/net/ethernet/8390/ drivers/net/ethernet/fujitsu/ drivers/net/ethernet/smsc/ drivers/net/ethernet/xircom/ drivers/pcmcia/ drivers/tty/ipwireless/
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306100146.Eag3T7hY-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
In file included from include/linux/io.h:13,
from include/linux/pci.h:39,
from drivers/pcmcia/cistpl.c:21:
drivers/pcmcia/cistpl.c: In function 'release_cis_mem':
>> arch/s390/include/asm/io.h:29:17: error: implicit declaration of function 'iounmap'; did you mean 'vunmap'? [-Werror=implicit-function-declaration]
29 | #define iounmap iounmap
| ^~~~~~~
drivers/pcmcia/cistpl.c:72:17: note: in expansion of macro 'iounmap'
72 | iounmap(s->cis_virt);
| ^~~~~~~
drivers/pcmcia/cistpl.c: In function 'set_cis_map':
>> drivers/pcmcia/cistpl.c:103:31: error: implicit declaration of function 'ioremap'; did you mean 'iounmap'? [-Werror=implicit-function-declaration]
103 | s->cis_virt = ioremap(mem->res->start, s->map_size);
| ^~~~~~~
| iounmap
>> drivers/pcmcia/cistpl.c:103:29: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
103 | s->cis_virt = ioremap(mem->res->start, s->map_size);
| ^
drivers/pcmcia/cistpl.c:118:29: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
118 | s->cis_virt = ioremap(mem->static_start, s->map_size);
| ^
cc1: some warnings being treated as errors
--
drivers/net/arcnet/com90xx.c: In function 'com90xx_probe':
>> drivers/net/arcnet/com90xx.c:225:24: error: implicit declaration of function 'ioremap'; did you mean 'ifr_map'? [-Werror=implicit-function-declaration]
225 | base = ioremap(*p, MIRROR_SIZE);
| ^~~~~~~
| ifr_map
>> drivers/net/arcnet/com90xx.c:225:22: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
225 | base = ioremap(*p, MIRROR_SIZE);
| ^
In file included from include/linux/scatterlist.h:9,
from include/linux/dma-mapping.h:10,
from include/linux/skbuff.h:28,
from include/net/net_namespace.h:43,
from include/linux/netdevice.h:38,
from drivers/net/arcnet/com90xx.c:36:
>> arch/s390/include/asm/io.h:29:17: error: implicit declaration of function 'iounmap'; did you mean 'vunmap'? [-Werror=implicit-function-declaration]
29 | #define iounmap iounmap
| ^~~~~~~
drivers/net/arcnet/com90xx.c:260:17: note: in expansion of macro 'iounmap'
260 | iounmap(base);
| ^~~~~~~
drivers/net/arcnet/com90xx.c: In function 'check_mirror':
drivers/net/arcnet/com90xx.c:444:11: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
444 | p = ioremap(addr, size);
| ^
drivers/net/arcnet/com90xx.c: In function 'com90xx_found':
drivers/net/arcnet/com90xx.c:526:23: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
526 | lp->mem_start = ioremap(dev->mem_start,
| ^
cc1: some warnings being treated as errors
--
drivers/net/arcnet/arc-rimi.c: In function 'check_mirror':
>> drivers/net/arcnet/arc-rimi.c:107:13: error: implicit declaration of function 'ioremap'; did you mean 'ifr_map'? [-Werror=implicit-function-declaration]
107 | p = ioremap(addr, size);
| ^~~~~~~
| ifr_map
>> drivers/net/arcnet/arc-rimi.c:107:11: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
107 | p = ioremap(addr, size);
| ^
In file included from include/linux/scatterlist.h:9,
from include/linux/dma-mapping.h:10,
from include/linux/skbuff.h:28,
from include/net/net_namespace.h:43,
from include/linux/netdevice.h:38,
from drivers/net/arcnet/arc-rimi.c:35:
>> arch/s390/include/asm/io.h:29:17: error: implicit declaration of function 'iounmap'; did you mean 'vunmap'? [-Werror=implicit-function-declaration]
29 | #define iounmap iounmap
| ^~~~~~~
drivers/net/arcnet/arc-rimi.c:113:17: note: in expansion of macro 'iounmap'
113 | iounmap(p);
| ^~~~~~~
drivers/net/arcnet/arc-rimi.c: In function 'arcrimi_found':
drivers/net/arcnet/arc-rimi.c:131:11: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
131 | p = ioremap(dev->mem_start, MIRROR_SIZE);
| ^
drivers/net/arcnet/arc-rimi.c:202:23: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
202 | lp->mem_start = ioremap(dev->mem_start,
| ^
cc1: some warnings being treated as errors
--
drivers/net/ethernet/8390/pcnet_cs.c: In function 'get_hwinfo':
>> drivers/net/ethernet/8390/pcnet_cs.c:291:12: error: implicit declaration of function 'ioremap'; did you mean 'ifr_map'? [-Werror=implicit-function-declaration]
291 | virt = ioremap(link->resource[2]->start,
| ^~~~~~~
| ifr_map
>> drivers/net/ethernet/8390/pcnet_cs.c:291:10: warning: assignment to 'u_char *' {aka 'unsigned char *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
291 | virt = ioremap(link->resource[2]->start,
| ^
In file included from include/linux/scatterlist.h:9,
from include/linux/dma-mapping.h:10,
from include/linux/skbuff.h:28,
from include/net/net_namespace.h:43,
from include/linux/netdevice.h:38,
from drivers/net/ethernet/8390/pcnet_cs.c:39:
>> arch/s390/include/asm/io.h:29:17: error: implicit declaration of function 'iounmap'; did you mean 'vunmap'? [-Werror=implicit-function-declaration]
29 | #define iounmap iounmap
| ^~~~~~~
drivers/net/ethernet/8390/pcnet_cs.c:312:5: note: in expansion of macro 'iounmap'
312 | iounmap(virt);
| ^~~~~~~
drivers/net/ethernet/8390/pcnet_cs.c: In function 'setup_shmem_window':
>> drivers/net/ethernet/8390/pcnet_cs.c:1441:16: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
1441 | info->base = ioremap(link->resource[3]->start,
| ^
cc1: some warnings being treated as errors
--
drivers/net/ethernet/fujitsu/fmvj18x_cs.c: In function 'fmvj18x_get_hwinfo':
>> drivers/net/ethernet/fujitsu/fmvj18x_cs.c:549:12: error: implicit declaration of function 'ioremap'; did you mean 'iounmap'? [-Werror=implicit-function-declaration]
549 | base = ioremap(link->resource[2]->start, resource_size(link->resource[2]));
| ^~~~~~~
| iounmap
>> drivers/net/ethernet/fujitsu/fmvj18x_cs.c:549:10: warning: assignment to 'u_char *' {aka 'unsigned char *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
549 | base = ioremap(link->resource[2]->start, resource_size(link->resource[2]));
| ^
In file included from include/linux/scatterlist.h:9,
from include/linux/dma-mapping.h:10,
from include/linux/skbuff.h:28,
from include/linux/if_ether.h:19,
from include/linux/ethtool.h:18,
from drivers/net/ethernet/fujitsu/fmvj18x_cs.c:45:
>> arch/s390/include/asm/io.h:29:17: error: implicit declaration of function 'iounmap'; did you mean 'vunmap'? [-Werror=implicit-function-declaration]
29 | #define iounmap iounmap
| ^~~~~~~
drivers/net/ethernet/fujitsu/fmvj18x_cs.c:579:5: note: in expansion of macro 'iounmap'
579 | iounmap(base);
| ^~~~~~~
drivers/net/ethernet/fujitsu/fmvj18x_cs.c: In function 'fmvj18x_setup_mfc':
drivers/net/ethernet/fujitsu/fmvj18x_cs.c:600:14: warning: assignment to 'u_char *' {aka 'unsigned char *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
600 | lp->base = ioremap(link->resource[3]->start,
| ^
cc1: some warnings being treated as errors
--
drivers/tty/ipwireless/main.c: In function 'ipwireless_probe':
>> drivers/tty/ipwireless/main.c:115:30: error: implicit declaration of function 'ioremap'; did you mean 'iounmap'? [-Werror=implicit-function-declaration]
115 | ipw->common_memory = ioremap(p_dev->resource[2]->start,
| ^~~~~~~
| iounmap
>> drivers/tty/ipwireless/main.c:115:28: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
115 | ipw->common_memory = ioremap(p_dev->resource[2]->start,
| ^
drivers/tty/ipwireless/main.c:139:26: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
139 | ipw->attr_memory = ioremap(p_dev->resource[3]->start,
| ^
In file included from include/linux/io.h:13,
from drivers/tty/ipwireless/main.c:26:
>> arch/s390/include/asm/io.h:29:17: error: implicit declaration of function 'iounmap'; did you mean 'vunmap'? [-Werror=implicit-function-declaration]
29 | #define iounmap iounmap
| ^~~~~~~
drivers/tty/ipwireless/main.c:155:9: note: in expansion of macro 'iounmap'
155 | iounmap(ipw->attr_memory);
| ^~~~~~~
cc1: some warnings being treated as errors
--
drivers/net/ethernet/smsc/smc91c92_cs.c: In function 'mhz_mfc_config':
>> drivers/net/ethernet/smsc/smc91c92_cs.c:447:17: error: implicit declaration of function 'ioremap'; did you mean 'ifr_map'? [-Werror=implicit-function-declaration]
447 | smc->base = ioremap(link->resource[2]->start,
| ^~~~~~~
| ifr_map
>> drivers/net/ethernet/smsc/smc91c92_cs.c:447:15: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
447 | smc->base = ioremap(link->resource[2]->start,
| ^
In file included from include/linux/scatterlist.h:9,
from include/linux/dma-mapping.h:10,
from include/linux/skbuff.h:28,
from include/net/net_namespace.h:43,
from include/linux/netdevice.h:38,
from drivers/net/ethernet/smsc/smc91c92_cs.c:38:
drivers/net/ethernet/smsc/smc91c92_cs.c: In function 'smc91c92_release':
>> arch/s390/include/asm/io.h:29:17: error: implicit declaration of function 'iounmap'; did you mean 'vunmap'? [-Werror=implicit-function-declaration]
29 | #define iounmap iounmap
| ^~~~~~~
drivers/net/ethernet/smsc/smc91c92_cs.c:962:17: note: in expansion of macro 'iounmap'
962 | iounmap(smc->base);
| ^~~~~~~
cc1: some warnings being treated as errors
--
drivers/net/ethernet/xircom/xirc2ps_cs.c: In function 'xirc2ps_config':
>> drivers/net/ethernet/xircom/xirc2ps_cs.c:843:28: error: implicit declaration of function 'ioremap'; did you mean 'iounmap'? [-Werror=implicit-function-declaration]
843 | local->dingo_ccr = ioremap(link->resource[2]->start, 0x1000) + 0x0800;
| ^~~~~~~
| iounmap
>> drivers/net/ethernet/xircom/xirc2ps_cs.c:843:26: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
843 | local->dingo_ccr = ioremap(link->resource[2]->start, 0x1000) + 0x0800;
| ^
In file included from include/linux/scatterlist.h:9,
from include/linux/dma-mapping.h:10,
from include/linux/skbuff.h:28,
from include/linux/if_ether.h:19,
from include/linux/ethtool.h:18,
from drivers/net/ethernet/xircom/xirc2ps_cs.c:77:
drivers/net/ethernet/xircom/xirc2ps_cs.c: In function 'xirc2ps_release':
>> arch/s390/include/asm/io.h:29:17: error: implicit declaration of function 'iounmap'; did you mean 'vunmap'? [-Werror=implicit-function-declaration]
29 | #define iounmap iounmap
| ^~~~~~~
drivers/net/ethernet/xircom/xirc2ps_cs.c:934:25: note: in expansion of macro 'iounmap'
934 | iounmap(local->dingo_ccr - 0x0800);
| ^~~~~~~
cc1: some warnings being treated as errors
vim +29 arch/s390/include/asm/io.h
24
25 /*
26 * I/O memory mapping functions.
27 */
28 #define ioremap_prot ioremap_prot
> 29 #define iounmap iounmap
30
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v6 10/19] s390: mm: Convert to GENERIC_IOREMAP
2023-06-09 7:55 ` [PATCH v6 10/19] s390: " Baoquan He
2023-06-09 15:41 ` kernel test robot
2023-06-09 17:42 ` kernel test robot
@ 2023-06-09 17:42 ` kernel test robot
2023-06-11 11:10 ` Baoquan He
2 siblings, 1 reply; 45+ messages in thread
From: kernel test robot @ 2023-06-09 17:42 UTC (permalink / raw)
To: Baoquan He, linux-kernel
Cc: oe-kbuild-all, linux-arch, linux-mm, arnd, christophe.leroy, hch,
rppt, willy, agordeev, wangkefeng.wang, schnelle, David.Laight,
shorne, deller, Baoquan He, Gerald Schaefer, Heiko Carstens,
Vasily Gorbik, Christian Borntraeger, Sven Schnelle, linux-s390
Hi Baoquan,
kernel test robot noticed the following build errors:
[auto build test ERROR on akpm-mm/mm-everything]
url: https://github.com/intel-lab-lkp/linux/commits/Baoquan-He/asm-generic-iomap-h-remove-ARCH_HAS_IOREMAP_xx-macros/20230609-160014
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20230609075528.9390-11-bhe%40redhat.com
patch subject: [PATCH v6 10/19] s390: mm: Convert to GENERIC_IOREMAP
config: s390-defconfig (https://download.01.org/0day-ci/archive/20230610/202306100105.8GHnoMCP-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 12.3.0
reproduce (this is a W=1 build):
mkdir -p ~/bin
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git remote add akpm-mm https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git
git fetch akpm-mm mm-everything
git checkout akpm-mm/mm-everything
b4 shazam https://lore.kernel.org/r/20230609075528.9390-11-bhe@redhat.com
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=s390 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash arch/s390/
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306100105.8GHnoMCP-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from arch/s390/kernel/perf_cpum_sf.c:25:
include/asm-generic/io.h: In function 'ioremap':
>> include/asm-generic/io.h:1089:41: error: '_PAGE_IOREMAP' undeclared (first use in this function); did you mean 'VM_IOREMAP'?
1089 | return ioremap_prot(addr, size, _PAGE_IOREMAP);
| ^~~~~~~~~~~~~
| VM_IOREMAP
include/asm-generic/io.h:1089:41: note: each undeclared identifier is reported only once for each function it appears in
vim +1089 include/asm-generic/io.h
80b0ca98f91ddb Christoph Hellwig 2019-08-13 1083
2fe481688890d6 Baoquan He 2023-06-09 1084 #ifndef ioremap
2fe481688890d6 Baoquan He 2023-06-09 1085 #define ioremap ioremap
80b0ca98f91ddb Christoph Hellwig 2019-08-13 1086 static inline void __iomem *ioremap(phys_addr_t addr, size_t size)
80b0ca98f91ddb Christoph Hellwig 2019-08-13 1087 {
80b0ca98f91ddb Christoph Hellwig 2019-08-13 1088 /* _PAGE_IOREMAP needs to be supplied by the architecture */
80b0ca98f91ddb Christoph Hellwig 2019-08-13 @1089 return ioremap_prot(addr, size, _PAGE_IOREMAP);
80b0ca98f91ddb Christoph Hellwig 2019-08-13 1090 }
2fe481688890d6 Baoquan He 2023-06-09 1091 #endif
80b0ca98f91ddb Christoph Hellwig 2019-08-13 1092 #endif /* !CONFIG_MMU || CONFIG_GENERIC_IOREMAP */
97c9801a15e5b0 Christoph Hellwig 2019-08-11 1093
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v6 10/19] s390: mm: Convert to GENERIC_IOREMAP
2023-06-09 17:42 ` kernel test robot
@ 2023-06-11 11:10 ` Baoquan He
2023-06-21 14:53 ` Alexander Gordeev
0 siblings, 1 reply; 45+ messages in thread
From: Baoquan He @ 2023-06-11 11:10 UTC (permalink / raw)
To: kernel test robot
Cc: linux-kernel, oe-kbuild-all, linux-arch, linux-mm, arnd,
christophe.leroy, hch, rppt, willy, agordeev, wangkefeng.wang,
schnelle, David.Laight, shorne, deller, Gerald Schaefer,
Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
Sven Schnelle, linux-s390
On 06/10/23 at 01:42am, kernel test robot wrote:
> Hi Baoquan,
>
> kernel test robot noticed the following build errors:
>
> [auto build test ERROR on akpm-mm/mm-everything]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Baoquan-He/asm-generic-iomap-h-remove-ARCH_HAS_IOREMAP_xx-macros/20230609-160014
> base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
> patch link: https://lore.kernel.org/r/20230609075528.9390-11-bhe%40redhat.com
> patch subject: [PATCH v6 10/19] s390: mm: Convert to GENERIC_IOREMAP
> config: s390-defconfig (https://download.01.org/0day-ci/archive/20230610/202306100105.8GHnoMCP-lkp@intel.com/config)
> compiler: s390-linux-gcc (GCC) 12.3.0
> reproduce (this is a W=1 build):
> mkdir -p ~/bin
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> git remote add akpm-mm https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git
> git fetch akpm-mm mm-everything
> git checkout akpm-mm/mm-everything
> b4 shazam https://lore.kernel.org/r/20230609075528.9390-11-bhe@redhat.com
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=s390 olddefconfig
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash arch/s390/
>
Thanks for reporting.
I tried to reproduce with above steps, while failed with below message.
Later I got a s390x machine to reproduce the failure, and made a fix in
below patch.
[root@dell-pem620-01 linux]# COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=s390 olddefconfig
Compiler will be installed in /root/0day
lftpget -c https://download.01.org/0day-ci/cross-package/./gcc-12.3.0-nolibc/x86_64-gcc-12.3.0-nolibc_s390-linux.tar.xz
/root/linux
tar Jxf /root/0day/gcc-12.3.0-nolibc/x86_64-gcc-12.3.0-nolibc_s390-linux.tar.xz -C /root/0day
Please update: libc6 or glibc
ldd /root/0day/gcc-12.3.0-nolibc/s390-linux/bin/s390-linux-gcc
/root/0day/gcc-12.3.0-nolibc/s390-linux/bin/s390-linux-gcc: /lib64/libc.so.6: version `GLIBC_2.36' not found (required by /root/0day/gcc-12.3.0-nolibc/s390-linux/bin/s390-linux-gcc)
setup_crosstool failed
From 26aedf424dac7e58dd1389e554cfe0693e2b371f Mon Sep 17 00:00:00 2001
From: Baoquan He <bhe@redhat.com>
Date: Sun, 11 Jun 2023 18:37:43 +0800
Subject: [PATCH] s390: mm: fix building error when converting to
GENERIC_IOREMAP
Content-type: text/plain
We should always include <asm/io.h> in ARCH, but not <asm-generic/io.h>
directly. Otherwise, macro defined by ARCH won't be seen and could cause
building error.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202306100105.8GHnoMCP-lkp@intel.com/
Signed-off-by: Baoquan He <bhe@redhat.com>
---
arch/s390/kernel/perf_cpum_sf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c
index 7ef72f5ff52e..b0269f3881aa 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.
--
2.34.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* Re: [PATCH v6 10/19] s390: mm: Convert to GENERIC_IOREMAP
2023-06-11 11:10 ` Baoquan He
@ 2023-06-21 14:53 ` Alexander Gordeev
0 siblings, 0 replies; 45+ messages in thread
From: Alexander Gordeev @ 2023-06-21 14:53 UTC (permalink / raw)
To: Baoquan He
Cc: kernel test robot, linux-kernel, oe-kbuild-all, linux-arch,
linux-mm, arnd, christophe.leroy, hch, rppt, willy,
wangkefeng.wang, schnelle, David.Laight, shorne, deller,
Gerald Schaefer, Heiko Carstens, Vasily Gorbik,
Christian Borntraeger, Sven Schnelle, linux-s390
On Sun, Jun 11, 2023 at 07:10:44PM +0800, Baoquan He wrote:
Hi Baoquan,
> From 26aedf424dac7e58dd1389e554cfe0693e2b371f Mon Sep 17 00:00:00 2001
> From: Baoquan He <bhe@redhat.com>
> Date: Sun, 11 Jun 2023 18:37:43 +0800
> Subject: [PATCH] s390: mm: fix building error when converting to
> GENERIC_IOREMAP
> Content-type: text/plain
>
> We should always include <asm/io.h> in ARCH, but not <asm-generic/io.h>
> directly. Otherwise, macro defined by ARCH won't be seen and could cause
> building error.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202306100105.8GHnoMCP-lkp@intel.com/
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
> arch/s390/kernel/perf_cpum_sf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c
> index 7ef72f5ff52e..b0269f3881aa 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.
Applied, thanks!
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v6 11/19] sh: add <asm-generic/io.h> including
2023-06-09 7:55 [PATCH v6 00/19] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
` (9 preceding siblings ...)
2023-06-09 7:55 ` [PATCH v6 10/19] s390: " Baoquan He
@ 2023-06-09 7:55 ` Baoquan He
2023-06-09 8:10 ` John Paul Adrian Glaubitz
2023-06-09 7:55 ` [PATCH v6 12/19] sh: mm: Convert to GENERIC_IOREMAP Baoquan He
` (7 subsequent siblings)
18 siblings, 1 reply; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Baoquan He, Yoshinori Sato, Rich Felker, linux-sh
Also add macro definitions for port|mm io functions since SuperH
has its own implementation in arch/sh/kernel/iomap.c and
arch/sh/include/asm/io_noioport.h. These will conflict with the port|mm io
function definitions in include/asm-generic/io.h to cause compiling
errors like below:
====
CC arch/sh/kernel/asm-offsets.s
In file included from ./arch/sh/include/asm/io.h:294,
from ./include/linux/io.h:13,
......
from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/io.h:792:17: error: conflicting types for ‘ioread8’
792 | #define ioread8 ioread8
| ^~~~~~~
./include/asm-generic/io.h:793:18: note: in expansion of macro ‘ioread8’
793 | static inline u8 ioread8(const volatile void __iomem *addr)
| ^~~~~~~
In file included from ./arch/sh/include/asm/io.h:22,
from ./include/linux/io.h:13,
......
from arch/sh/kernel/asm-offsets.c:16:
./include/asm-generic/iomap.h:29:21: note: previous declaration of ‘ioread8’ was here
29 | extern unsigned int ioread8(const void __iomem *);
====
Signed-off-by: Baoquan He <bhe@redhat.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: linux-sh@vger.kernel.org
---
v5->v6:
split that inclusion of include/asm-generic/io.h and redefining of the
helpers from the old patch 11 into this prep patch - Christoph
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
^ permalink raw reply related [flat|nested] 45+ messages in thread
* Re: [PATCH v6 11/19] sh: add <asm-generic/io.h> including
2023-06-09 7:55 ` [PATCH v6 11/19] sh: add <asm-generic/io.h> including Baoquan He
@ 2023-06-09 8:10 ` John Paul Adrian Glaubitz
2023-06-09 8:34 ` Baoquan He
0 siblings, 1 reply; 45+ messages in thread
From: John Paul Adrian Glaubitz @ 2023-06-09 8:10 UTC (permalink / raw)
To: Baoquan He, linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Yoshinori Sato, Rich Felker, linux-sh
Hello Baoquan!
On Fri, 2023-06-09 at 15:55 +0800, Baoquan He wrote:
> Also add macro definitions for port|mm io functions since SuperH
> has its own implementation in arch/sh/kernel/iomap.c and
> arch/sh/include/asm/io_noioport.h. These will conflict with the port|mm io
> function definitions in include/asm-generic/io.h to cause compiling
> errors like below:
What change does the "Also" refer to?
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v6 11/19] sh: add <asm-generic/io.h> including
2023-06-09 8:10 ` John Paul Adrian Glaubitz
@ 2023-06-09 8:34 ` Baoquan He
0 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2023-06-09 8:34 UTC (permalink / raw)
To: John Paul Adrian Glaubitz
Cc: linux-kernel, linux-arch, linux-mm, arnd, christophe.leroy, hch,
rppt, willy, agordeev, wangkefeng.wang, schnelle, David.Laight,
shorne, deller, Yoshinori Sato, Rich Felker, linux-sh
On 06/09/23 at 10:10am, John Paul Adrian Glaubitz wrote:
> Hello Baoquan!
>
> On Fri, 2023-06-09 at 15:55 +0800, Baoquan He wrote:
> > Also add macro definitions for port|mm io functions since SuperH
> > has its own implementation in arch/sh/kernel/iomap.c and
> > arch/sh/include/asm/io_noioport.h. These will conflict with the port|mm io
> > function definitions in include/asm-generic/io.h to cause compiling
> > errors like below:
>
> What change does the "Also" refer to?
It refers to these kind of macro definitions, this place and those in
other several places. Please correct me if I misused the expression to
cause confusion.
+#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
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v6 12/19] sh: mm: Convert to GENERIC_IOREMAP
2023-06-09 7:55 [PATCH v6 00/19] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
` (10 preceding siblings ...)
2023-06-09 7:55 ` [PATCH v6 11/19] sh: add <asm-generic/io.h> including Baoquan He
@ 2023-06-09 7:55 ` Baoquan He
2023-06-09 7:55 ` [PATCH v6 13/19] xtensa: " Baoquan He
` (6 subsequent siblings)
18 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Baoquan He, Yoshinori Sato, Rich Felker, linux-sh
By taking GENERIC_IOREMAP method, the generic generic_ioremap_prot(),
generic_iounmap(), and their generic wrapper ioremap_prot(), ioremap()
and iounmap() are all visible and available to arch. Arch needs to
provide wrapper functions to override the generic versions if there's
arch specific handling in its ioremap_prot(), ioremap() or iounmap().
This change will simplify implementation by removing duplicated codes
with generic_ioremap_prot() and generic_iounmap(), and has the equivalent
functioality as before.
Here, add wrapper functions ioremap_prot() and iounmap() for SuperH's
special operation when ioremap() and iounmap().
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: linux-sh@vger.kernel.org
Signed-off-by: Baoquan He <bhe@redhat.com>
---
v5->v6:
Based on the previous prep patch, this only focuses on converting to
GENERIC_IOREMAP for SuperH - Christoph
arch/sh/Kconfig | 1 +
arch/sh/include/asm/io.h | 40 +++++--------------------
arch/sh/mm/ioremap.c | 65 +++++++---------------------------------
3 files changed, 20 insertions(+), 86 deletions(-)
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 9652d367fc37..f326985e46e0 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -28,6 +28,7 @@ config SUPERH
select GENERIC_SMP_IDLE_THREAD
select GUP_GET_PXX_LOW_HIGH if X2TLB
select HAS_IOPORT if HAS_IOPORT_MAP
+ select GENERIC_IOREMAP if MMU
select HAVE_ARCH_AUDITSYSCALL
select HAVE_ARCH_KGDB
select HAVE_ARCH_SECCOMP_FILTER
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 270e7952950c..b3a26b405c8d 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -266,40 +266,16 @@ unsigned long long poke_real_address_q(unsigned long long addr,
#endif
#ifdef CONFIG_MMU
-void iounmap(void __iomem *addr);
-void __iomem *__ioremap_caller(phys_addr_t offset, unsigned long size,
- pgprot_t prot, void *caller);
-
-static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
-{
- return __ioremap_caller(offset, size, PAGE_KERNEL_NOCACHE,
- __builtin_return_address(0));
-}
-
-static inline void __iomem *
-ioremap_cache(phys_addr_t offset, unsigned long size)
-{
- return __ioremap_caller(offset, size, PAGE_KERNEL,
- __builtin_return_address(0));
-}
-#define ioremap_cache ioremap_cache
-
-#ifdef CONFIG_HAVE_IOREMAP_PROT
-static inline void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
- unsigned long flags)
-{
- return __ioremap_caller(offset, size, __pgprot(flags),
- __builtin_return_address(0));
-}
-#endif /* CONFIG_HAVE_IOREMAP_PROT */
+/*
+ * I/O memory mapping functions.
+ */
+#define ioremap_prot ioremap_prot
+#define iounmap iounmap
-#else /* CONFIG_MMU */
-static inline void __iomem *ioremap(phys_addr_t offset, size_t size)
-{
- return (void __iomem *)(unsigned long)offset;
-}
+#define _PAGE_IOREMAP pgprot_val(PAGE_KERNEL_NOCACHE)
-static inline void iounmap(volatile void __iomem *addr) { }
+#define ioremap_cache(addr, size) \
+ ioremap_prot((addr), (size), pgprot_val(PAGE_KERNEL))
#endif /* CONFIG_MMU */
#define ioremap_uc ioremap
diff --git a/arch/sh/mm/ioremap.c b/arch/sh/mm/ioremap.c
index 21342581144d..c33b3daa4ad1 100644
--- a/arch/sh/mm/ioremap.c
+++ b/arch/sh/mm/ioremap.c
@@ -72,22 +72,11 @@ __ioremap_29bit(phys_addr_t offset, unsigned long size, pgprot_t prot)
#define __ioremap_29bit(offset, size, prot) NULL
#endif /* CONFIG_29BIT */
-/*
- * 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_caller(phys_addr_t phys_addr, unsigned long size,
- pgprot_t pgprot, void *caller)
+void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
+ unsigned long prot)
{
- struct vm_struct *area;
- unsigned long offset, last_addr, addr, orig_addr;
void __iomem *mapped;
+ pgprot_t pgprot = __pgprot(prot);
mapped = __ioremap_trapped(phys_addr, size);
if (mapped)
@@ -97,11 +86,6 @@ __ioremap_caller(phys_addr_t phys_addr, unsigned long size,
if (mapped)
return mapped;
- /* Don't allow wraparound or zero size */
- last_addr = phys_addr + size - 1;
- if (!size || last_addr < phys_addr)
- return NULL;
-
/*
* If we can't yet use the regular approach, go the fixmap route.
*/
@@ -112,34 +96,14 @@ __ioremap_caller(phys_addr_t phys_addr, unsigned long size,
* First try to remap through the PMB.
* PMB entries are all pre-faulted.
*/
- mapped = pmb_remap_caller(phys_addr, size, pgprot, caller);
+ mapped = pmb_remap_caller(phys_addr, size, pgprot,
+ __builtin_return_address(0));
if (mapped && !IS_ERR(mapped))
return mapped;
- /*
- * Mappings have to be page-aligned
- */
- offset = phys_addr & ~PAGE_MASK;
- phys_addr &= PAGE_MASK;
- size = PAGE_ALIGN(last_addr+1) - phys_addr;
-
- /*
- * Ok, go for it..
- */
- area = get_vm_area_caller(size, VM_IOREMAP, caller);
- if (!area)
- return NULL;
- area->phys_addr = phys_addr;
- orig_addr = addr = (unsigned long)area->addr;
-
- if (ioremap_page_range(addr, addr + size, phys_addr, pgprot)) {
- vunmap((void *)orig_addr);
- return NULL;
- }
-
- return (void __iomem *)(offset + (char *)orig_addr);
+ return generic_ioremap_prot(phys_addr, size, pgprot);
}
-EXPORT_SYMBOL(__ioremap_caller);
+EXPORT_SYMBOL(ioremap_prot);
/*
* Simple checks for non-translatable mappings.
@@ -158,10 +122,9 @@ static inline int iomapping_nontranslatable(unsigned long offset)
return 0;
}
-void iounmap(void __iomem *addr)
+void iounmap(volatile void __iomem *addr)
{
unsigned long vaddr = (unsigned long __force)addr;
- struct vm_struct *p;
/*
* Nothing to do if there is no translatable mapping.
@@ -172,21 +135,15 @@ void iounmap(void __iomem *addr)
/*
* There's no VMA if it's from an early fixed mapping.
*/
- if (iounmap_fixed(addr) == 0)
+ if (iounmap_fixed((void __iomem *)addr) == 0)
return;
/*
* If the PMB handled it, there's nothing else to do.
*/
- if (pmb_unmap(addr) == 0)
+ if (pmb_unmap((void __iomem *)addr) == 0)
return;
- p = remove_vm_area((void *)(vaddr & PAGE_MASK));
- if (!p) {
- printk(KERN_ERR "%s: bad address %p\n", __func__, addr);
- return;
- }
-
- kfree(p);
+ generic_iounmap(addr);
}
EXPORT_SYMBOL(iounmap);
--
2.34.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH v6 13/19] xtensa: mm: Convert to GENERIC_IOREMAP
2023-06-09 7:55 [PATCH v6 00/19] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
` (11 preceding siblings ...)
2023-06-09 7:55 ` [PATCH v6 12/19] sh: mm: Convert to GENERIC_IOREMAP Baoquan He
@ 2023-06-09 7:55 ` Baoquan He
2023-06-09 7:55 ` [PATCH v6 14/19] parisc: " Baoquan He
` (5 subsequent siblings)
18 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Baoquan He, Chris Zankel, Max Filippov
By taking GENERIC_IOREMAP method, the generic generic_ioremap_prot(),
generic_iounmap(), and their generic wrapper ioremap_prot(), ioremap()
and iounmap() are all visible and available to arch. Arch needs to
provide wrapper functions to override the generic versions if there's
arch specific handling in its ioremap_prot(), ioremap() or iounmap().
This change will simplify implementation by removing duplicated codes
with generic_ioremap_prot() and generic_iounmap(), and has the equivalent
functioality as before.
Here, add wrapper functions ioremap_prot(), ioremap() and iounmap() for
xtensa's special operation when ioremap() and iounmap().
Signed-off-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
---
arch/xtensa/Kconfig | 1 +
arch/xtensa/include/asm/io.h | 32 ++++++++------------
arch/xtensa/mm/ioremap.c | 58 +++++++++---------------------------
3 files changed, 27 insertions(+), 64 deletions(-)
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 3c6e5471f025..474cbbff3e6c 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -29,6 +29,7 @@ config XTENSA
select GENERIC_LIB_UCMPDI2
select GENERIC_PCI_IOMAP
select GENERIC_SCHED_CLOCK
+ select GENERIC_IOREMAP if MMU
select HAVE_ARCH_AUDITSYSCALL
select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
select HAVE_ARCH_KASAN if MMU && !XIP_KERNEL
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h
index a5b707e1c0f4..934e58399c8c 100644
--- a/arch/xtensa/include/asm/io.h
+++ b/arch/xtensa/include/asm/io.h
@@ -16,6 +16,7 @@
#include <asm/vectors.h>
#include <linux/bug.h>
#include <linux/kernel.h>
+#include <linux/pgtable.h>
#include <linux/types.h>
@@ -24,22 +25,24 @@
#define PCI_IOBASE ((void __iomem *)XCHAL_KIO_BYPASS_VADDR)
#ifdef CONFIG_MMU
-
-void __iomem *xtensa_ioremap_nocache(unsigned long addr, unsigned long size);
-void __iomem *xtensa_ioremap_cache(unsigned long addr, unsigned long size);
-void xtensa_iounmap(volatile void __iomem *addr);
-
/*
- * Return the virtual address for the specified bus memory.
+ * I/O memory mapping functions.
*/
+void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
+ unsigned long prot);
+#define ioremap_prot ioremap_prot
+#define iounmap iounmap
+
static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
{
if (offset >= XCHAL_KIO_PADDR
&& offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR);
else
- return xtensa_ioremap_nocache(offset, size);
+ return ioremap_prot(offset, size,
+ pgprot_val(pgprot_noncached(PAGE_KERNEL)));
}
+#define ioremap ioremap
static inline void __iomem *ioremap_cache(unsigned long offset,
unsigned long size)
@@ -48,21 +51,10 @@ static inline void __iomem *ioremap_cache(unsigned long offset,
&& offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);
else
- return xtensa_ioremap_cache(offset, size);
-}
-#define ioremap_cache ioremap_cache
+ return ioremap_prot(offset, size, pgprot_val(PAGE_KERNEL));
-static inline void iounmap(volatile void __iomem *addr)
-{
- unsigned long va = (unsigned long) addr;
-
- if (!(va >= XCHAL_KIO_CACHED_VADDR &&
- va - XCHAL_KIO_CACHED_VADDR < XCHAL_KIO_SIZE) &&
- !(va >= XCHAL_KIO_BYPASS_VADDR &&
- va - XCHAL_KIO_BYPASS_VADDR < XCHAL_KIO_SIZE))
- xtensa_iounmap(addr);
}
-
+#define ioremap_cache ioremap_cache
#endif /* CONFIG_MMU */
#include <asm-generic/io.h>
diff --git a/arch/xtensa/mm/ioremap.c b/arch/xtensa/mm/ioremap.c
index a400188c16b9..8ca660b7ab49 100644
--- a/arch/xtensa/mm/ioremap.c
+++ b/arch/xtensa/mm/ioremap.c
@@ -6,60 +6,30 @@
*/
#include <linux/io.h>
-#include <linux/vmalloc.h>
#include <linux/pgtable.h>
#include <asm/cacheflush.h>
#include <asm/io.h>
-static void __iomem *xtensa_ioremap(unsigned long paddr, unsigned long size,
- pgprot_t prot)
+void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
+ unsigned long prot)
{
- unsigned long offset = paddr & ~PAGE_MASK;
- unsigned long pfn = __phys_to_pfn(paddr);
- struct vm_struct *area;
- unsigned long vaddr;
- int err;
-
- paddr &= PAGE_MASK;
-
+ unsigned long pfn = __phys_to_pfn((phys_addr));
WARN_ON(pfn_valid(pfn));
- size = PAGE_ALIGN(offset + size);
-
- area = get_vm_area(size, VM_IOREMAP);
- if (!area)
- return NULL;
-
- vaddr = (unsigned long)area->addr;
- area->phys_addr = paddr;
-
- err = ioremap_page_range(vaddr, vaddr + size, paddr, prot);
-
- if (err) {
- vunmap((void *)vaddr);
- return NULL;
- }
-
- flush_cache_vmap(vaddr, vaddr + size);
- return (void __iomem *)(offset + vaddr);
-}
-
-void __iomem *xtensa_ioremap_nocache(unsigned long addr, unsigned long size)
-{
- return xtensa_ioremap(addr, size, pgprot_noncached(PAGE_KERNEL));
+ return generic_ioremap_prot(phys_addr, size, __pgprot(prot));
}
-EXPORT_SYMBOL(xtensa_ioremap_nocache);
+EXPORT_SYMBOL(ioremap_prot);
-void __iomem *xtensa_ioremap_cache(unsigned long addr, unsigned long size)
+void iounmap(volatile void __iomem *addr)
{
- return xtensa_ioremap(addr, size, PAGE_KERNEL);
-}
-EXPORT_SYMBOL(xtensa_ioremap_cache);
+ unsigned long va = (unsigned long) addr;
-void xtensa_iounmap(volatile void __iomem *io_addr)
-{
- void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);
+ if ((va >= XCHAL_KIO_CACHED_VADDR &&
+ va - XCHAL_KIO_CACHED_VADDR < XCHAL_KIO_SIZE) ||
+ (va >= XCHAL_KIO_BYPASS_VADDR &&
+ va - XCHAL_KIO_BYPASS_VADDR < XCHAL_KIO_SIZE))
+ return;
- vunmap(addr);
+ generic_iounmap(addr);
}
-EXPORT_SYMBOL(xtensa_iounmap);
+EXPORT_SYMBOL(iounmap);
--
2.34.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH v6 14/19] parisc: mm: Convert to GENERIC_IOREMAP
2023-06-09 7:55 [PATCH v6 00/19] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
` (12 preceding siblings ...)
2023-06-09 7:55 ` [PATCH v6 13/19] xtensa: " Baoquan He
@ 2023-06-09 7:55 ` Baoquan He
2023-06-19 5:47 ` Helge Deller
2023-06-09 7:55 ` [PATCH v6 15/19] mm/ioremap: Consider IOREMAP space in generic ioremap Baoquan He
` (4 subsequent siblings)
18 siblings, 1 reply; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Baoquan He, James E.J. Bottomley, linux-parisc
By taking GENERIC_IOREMAP method, the generic generic_ioremap_prot(),
generic_iounmap(), and their generic wrapper ioremap_prot(), ioremap()
and iounmap() are all visible and available to arch. Arch needs to
provide wrapper functions to override the generic versions if there's
arch specific handling in its ioremap_prot(), ioremap() or iounmap().
This change will simplify implementation by removing duplicated codes
with generic_ioremap_prot() and generic_iounmap(), and has the equivalent
functioality as before.
Here, add wrapper function ioremap_prot() for parisc's special operation
when iounmap().
Signed-off-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-parisc@vger.kernel.org
---
v5->v6:
Remove the stale paragraph related to ARCH_HAS_IOREMAP_WC adding in
log - Mike
arch/parisc/Kconfig | 1 +
arch/parisc/include/asm/io.h | 15 ++++++---
arch/parisc/mm/ioremap.c | 62 +++---------------------------------
3 files changed, 15 insertions(+), 63 deletions(-)
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 967bde65dd0e..315cc42b1a2c 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -36,6 +36,7 @@ config PARISC
select GENERIC_ATOMIC64 if !64BIT
select GENERIC_IRQ_PROBE
select GENERIC_PCI_IOMAP
+ select GENERIC_IOREMAP
select ARCH_HAVE_NMI_SAFE_CMPXCHG
select GENERIC_SMP_IDLE_THREAD
select GENERIC_ARCH_TOPOLOGY if SMP
diff --git a/arch/parisc/include/asm/io.h b/arch/parisc/include/asm/io.h
index c05e781be2f5..366537042465 100644
--- a/arch/parisc/include/asm/io.h
+++ b/arch/parisc/include/asm/io.h
@@ -125,12 +125,17 @@ static inline void gsc_writeq(unsigned long long val, unsigned long addr)
/*
* The standard PCI ioremap interfaces
*/
-void __iomem *ioremap(unsigned long offset, unsigned long size);
-#define ioremap_wc ioremap
-#define ioremap_uc ioremap
-#define pci_iounmap pci_iounmap
+#define ioremap_prot ioremap_prot
+
+#define _PAGE_IOREMAP (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | \
+ _PAGE_ACCESSED | _PAGE_NO_CACHE)
-extern void iounmap(const volatile void __iomem *addr);
+#define ioremap_wc(addr, size) \
+ ioremap_prot((addr), (size), _PAGE_IOREMAP)
+#define ioremap_uc(addr, size) \
+ ioremap_prot((addr), (size), _PAGE_IOREMAP)
+
+#define pci_iounmap pci_iounmap
void memset_io(volatile void __iomem *addr, unsigned char val, int count);
void memcpy_fromio(void *dst, const volatile void __iomem *src, int count);
diff --git a/arch/parisc/mm/ioremap.c b/arch/parisc/mm/ioremap.c
index 345ff0b66499..fd996472dfe7 100644
--- a/arch/parisc/mm/ioremap.c
+++ b/arch/parisc/mm/ioremap.c
@@ -13,25 +13,9 @@
#include <linux/io.h>
#include <linux/mm.h>
-/*
- * Generic mapping function (not visible outside):
- */
-
-/*
- * Remap an arbitrary physical address space into the kernel virtual
- * address space.
- *
- * 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 *ioremap(unsigned long phys_addr, unsigned long size)
+void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
+ unsigned long prot)
{
- void __iomem *addr;
- struct vm_struct *area;
- unsigned long offset, last_addr;
- pgprot_t pgprot;
-
#ifdef CONFIG_EISA
unsigned long end = phys_addr + size - 1;
/* Support EISA addresses */
@@ -40,11 +24,6 @@ void __iomem *ioremap(unsigned long phys_addr, unsigned long size)
phys_addr |= F_EXTEND(0xfc000000);
#endif
- /* Don't allow wraparound or zero size */
- last_addr = phys_addr + size - 1;
- if (!size || last_addr < phys_addr)
- return NULL;
-
/*
* Don't allow anybody to remap normal RAM that we're using..
*/
@@ -62,39 +41,6 @@ void __iomem *ioremap(unsigned long phys_addr, unsigned long size)
}
}
- pgprot = __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY |
- _PAGE_ACCESSED | _PAGE_NO_CACHE);
-
- /*
- * Mappings have to be page-aligned
- */
- offset = phys_addr & ~PAGE_MASK;
- phys_addr &= PAGE_MASK;
- size = PAGE_ALIGN(last_addr + 1) - phys_addr;
-
- /*
- * Ok, go for it..
- */
- area = get_vm_area(size, VM_IOREMAP);
- if (!area)
- return NULL;
-
- addr = (void __iomem *) area->addr;
- if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size,
- phys_addr, pgprot)) {
- vunmap(addr);
- return NULL;
- }
-
- return (void __iomem *) (offset + (char __iomem *)addr);
-}
-EXPORT_SYMBOL(ioremap);
-
-void iounmap(const volatile void __iomem *io_addr)
-{
- unsigned long addr = (unsigned long)io_addr & PAGE_MASK;
-
- if (is_vmalloc_addr((void *)addr))
- vunmap((void *)addr);
+ return generic_ioremap_prot(phys_addr, size, __pgprot(prot));
}
-EXPORT_SYMBOL(iounmap);
+EXPORT_SYMBOL(ioremap_prot);
--
2.34.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* Re: [PATCH v6 14/19] parisc: mm: Convert to GENERIC_IOREMAP
2023-06-09 7:55 ` [PATCH v6 14/19] parisc: " Baoquan He
@ 2023-06-19 5:47 ` Helge Deller
0 siblings, 0 replies; 45+ messages in thread
From: Helge Deller @ 2023-06-19 5:47 UTC (permalink / raw)
To: Baoquan He, linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
James E.J. Bottomley, linux-parisc
On 6/9/23 09:55, Baoquan He wrote:
> By taking GENERIC_IOREMAP method, the generic generic_ioremap_prot(),
> generic_iounmap(), and their generic wrapper ioremap_prot(), ioremap()
> and iounmap() are all visible and available to arch. Arch needs to
> provide wrapper functions to override the generic versions if there's
> arch specific handling in its ioremap_prot(), ioremap() or iounmap().
> This change will simplify implementation by removing duplicated codes
> with generic_ioremap_prot() and generic_iounmap(), and has the equivalent
> functioality as before.
>
> Here, add wrapper function ioremap_prot() for parisc's special operation
> when iounmap().
>
> Signed-off-by: Baoquan He <bhe@redhat.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
> Cc: Helge Deller <deller@gmx.de>
> Cc: linux-parisc@vger.kernel.org
Acked-by: Helge Deller <deller@gmx.de> # parisc
Thanks!
Helge
> ---
> v5->v6:
> Remove the stale paragraph related to ARCH_HAS_IOREMAP_WC adding in
> log - Mike
>
> arch/parisc/Kconfig | 1 +
> arch/parisc/include/asm/io.h | 15 ++++++---
> arch/parisc/mm/ioremap.c | 62 +++---------------------------------
> 3 files changed, 15 insertions(+), 63 deletions(-)
>
> diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
> index 967bde65dd0e..315cc42b1a2c 100644
> --- a/arch/parisc/Kconfig
> +++ b/arch/parisc/Kconfig
> @@ -36,6 +36,7 @@ config PARISC
> select GENERIC_ATOMIC64 if !64BIT
> select GENERIC_IRQ_PROBE
> select GENERIC_PCI_IOMAP
> + select GENERIC_IOREMAP
> select ARCH_HAVE_NMI_SAFE_CMPXCHG
> select GENERIC_SMP_IDLE_THREAD
> select GENERIC_ARCH_TOPOLOGY if SMP
> diff --git a/arch/parisc/include/asm/io.h b/arch/parisc/include/asm/io.h
> index c05e781be2f5..366537042465 100644
> --- a/arch/parisc/include/asm/io.h
> +++ b/arch/parisc/include/asm/io.h
> @@ -125,12 +125,17 @@ static inline void gsc_writeq(unsigned long long val, unsigned long addr)
> /*
> * The standard PCI ioremap interfaces
> */
> -void __iomem *ioremap(unsigned long offset, unsigned long size);
> -#define ioremap_wc ioremap
> -#define ioremap_uc ioremap
> -#define pci_iounmap pci_iounmap
> +#define ioremap_prot ioremap_prot
> +
> +#define _PAGE_IOREMAP (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | \
> + _PAGE_ACCESSED | _PAGE_NO_CACHE)
>
> -extern void iounmap(const volatile void __iomem *addr);
> +#define ioremap_wc(addr, size) \
> + ioremap_prot((addr), (size), _PAGE_IOREMAP)
> +#define ioremap_uc(addr, size) \
> + ioremap_prot((addr), (size), _PAGE_IOREMAP)
> +
> +#define pci_iounmap pci_iounmap
>
> void memset_io(volatile void __iomem *addr, unsigned char val, int count);
> void memcpy_fromio(void *dst, const volatile void __iomem *src, int count);
> diff --git a/arch/parisc/mm/ioremap.c b/arch/parisc/mm/ioremap.c
> index 345ff0b66499..fd996472dfe7 100644
> --- a/arch/parisc/mm/ioremap.c
> +++ b/arch/parisc/mm/ioremap.c
> @@ -13,25 +13,9 @@
> #include <linux/io.h>
> #include <linux/mm.h>
>
> -/*
> - * Generic mapping function (not visible outside):
> - */
> -
> -/*
> - * Remap an arbitrary physical address space into the kernel virtual
> - * address space.
> - *
> - * 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 *ioremap(unsigned long phys_addr, unsigned long size)
> +void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
> + unsigned long prot)
> {
> - void __iomem *addr;
> - struct vm_struct *area;
> - unsigned long offset, last_addr;
> - pgprot_t pgprot;
> -
> #ifdef CONFIG_EISA
> unsigned long end = phys_addr + size - 1;
> /* Support EISA addresses */
> @@ -40,11 +24,6 @@ void __iomem *ioremap(unsigned long phys_addr, unsigned long size)
> phys_addr |= F_EXTEND(0xfc000000);
> #endif
>
> - /* Don't allow wraparound or zero size */
> - last_addr = phys_addr + size - 1;
> - if (!size || last_addr < phys_addr)
> - return NULL;
> -
> /*
> * Don't allow anybody to remap normal RAM that we're using..
> */
> @@ -62,39 +41,6 @@ void __iomem *ioremap(unsigned long phys_addr, unsigned long size)
> }
> }
>
> - pgprot = __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY |
> - _PAGE_ACCESSED | _PAGE_NO_CACHE);
> -
> - /*
> - * Mappings have to be page-aligned
> - */
> - offset = phys_addr & ~PAGE_MASK;
> - phys_addr &= PAGE_MASK;
> - size = PAGE_ALIGN(last_addr + 1) - phys_addr;
> -
> - /*
> - * Ok, go for it..
> - */
> - area = get_vm_area(size, VM_IOREMAP);
> - if (!area)
> - return NULL;
> -
> - addr = (void __iomem *) area->addr;
> - if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size,
> - phys_addr, pgprot)) {
> - vunmap(addr);
> - return NULL;
> - }
> -
> - return (void __iomem *) (offset + (char __iomem *)addr);
> -}
> -EXPORT_SYMBOL(ioremap);
> -
> -void iounmap(const volatile void __iomem *io_addr)
> -{
> - unsigned long addr = (unsigned long)io_addr & PAGE_MASK;
> -
> - if (is_vmalloc_addr((void *)addr))
> - vunmap((void *)addr);
> + return generic_ioremap_prot(phys_addr, size, __pgprot(prot));
> }
> -EXPORT_SYMBOL(iounmap);
> +EXPORT_SYMBOL(ioremap_prot);
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v6 15/19] mm/ioremap: Consider IOREMAP space in generic ioremap
2023-06-09 7:55 [PATCH v6 00/19] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
` (13 preceding siblings ...)
2023-06-09 7:55 ` [PATCH v6 14/19] parisc: " Baoquan He
@ 2023-06-09 7:55 ` Baoquan He
2023-06-10 6:26 ` Christoph Hellwig
2023-06-09 7:55 ` [PATCH v6 16/19] mm: move is_ioremap_addr() into new header file Baoquan He
` (3 subsequent siblings)
18 siblings, 1 reply; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Baoquan He
From: Christophe Leroy <christophe.leroy@csgroup.eu>
Architectures like powerpc have a dedicated space for IOREMAP mappings.
If so, use it in generic_ioremap_prot().
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Baoquan He <bhe@redhat.com>
---
v5->v6:
Add definition of IOREMAP_START|END in mm/ioremap.c so that
we can call __get_vm_area_caller() for all ARCH-es - Christoph
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
^ permalink raw reply related [flat|nested] 45+ messages in thread
* Re: [PATCH v6 15/19] mm/ioremap: Consider IOREMAP space in generic ioremap
2023-06-09 7:55 ` [PATCH v6 15/19] mm/ioremap: Consider IOREMAP space in generic ioremap Baoquan He
@ 2023-06-10 6:26 ` Christoph Hellwig
0 siblings, 0 replies; 45+ messages in thread
From: Christoph Hellwig @ 2023-06-10 6:26 UTC (permalink / raw)
To: Baoquan He
Cc: linux-kernel, linux-arch, linux-mm, arnd, christophe.leroy, hch,
rppt, willy, agordeev, wangkefeng.wang, schnelle, David.Laight,
shorne, deller
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v6 16/19] mm: move is_ioremap_addr() into new header file
2023-06-09 7:55 [PATCH v6 00/19] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
` (14 preceding siblings ...)
2023-06-09 7:55 ` [PATCH v6 15/19] mm/ioremap: Consider IOREMAP space in generic ioremap Baoquan He
@ 2023-06-09 7:55 ` Baoquan He
2023-06-09 7:55 ` Baoquan He
` (2 subsequent siblings)
18 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Baoquan He
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 <hch@lst.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Baoquan He <bhe@redhat.com>
---
v6:
Newly added - Christoph
arch/powerpc/include/asm/pgtable.h | 8 --------
include/linux/ioremap.h | 30 ++++++++++++++++++++++++++++++
include/linux/mm.h | 5 -----
kernel/iomem.c | 1 +
mm/ioremap.c | 10 +---------
5 files changed, 32 insertions(+), 22 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 9972626ddaf6..d252323a753f 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -158,14 +158,6 @@ static inline pgtable_t pmd_pgtable(pmd_t 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;
-}
-
struct seq_file;
void arch_report_meminfo(struct seq_file *m);
#endif /* CONFIG_PPC64 */
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 27ce77080c79..7379f19768b4 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1041,11 +1041,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
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH v6 17/19] powerpc: mm: Convert to GENERIC_IOREMAP
2023-06-09 7:55 [PATCH v6 00/19] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
@ 2023-06-09 7:55 ` Baoquan He
2023-06-09 7:55 ` [PATCH v6 02/19] hexagon: mm: Convert to GENERIC_IOREMAP Baoquan He
` (17 subsequent siblings)
18 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Baoquan He, Michael Ellerman, Nicholas Piggin,
linuxppc-dev
From: Christophe Leroy <christophe.leroy@csgroup.eu>
By taking GENERIC_IOREMAP method, the generic generic_ioremap_prot(),
generic_iounmap(), and their generic wrapper ioremap_prot(), ioremap()
and iounmap() are all visible and available to arch. Arch needs to
provide wrapper functions to override the generic versions if there's
arch specific handling in its ioremap_prot(), ioremap() or iounmap().
This change will simplify implementation by removing duplicated codes
with generic_ioremap_prot() and generic_iounmap(), and has the equivalent
functioality as before.
Here, add wrapper functions ioremap_prot() and iounmap() for powerpc's
special operation when ioremap() and iounmap().
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org
---
arch/powerpc/Kconfig | 1 +
arch/powerpc/include/asm/io.h | 8 +++-----
arch/powerpc/mm/ioremap.c | 26 +-------------------------
arch/powerpc/mm/ioremap_32.c | 19 +++++++++----------
arch/powerpc/mm/ioremap_64.c | 12 ++----------
5 files changed, 16 insertions(+), 50 deletions(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index bff5820b7cda..aadb280a539e 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -194,6 +194,7 @@ config PPC
select GENERIC_CPU_VULNERABILITIES if PPC_BARRIER_NOSPEC
select GENERIC_EARLY_IOREMAP
select GENERIC_GETTIMEOFDAY
+ select GENERIC_IOREMAP
select GENERIC_IRQ_SHOW
select GENERIC_IRQ_SHOW_LEVEL
select GENERIC_PCI_IOMAP if PCI
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index 67a3fb6de498..0732b743e099 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -889,8 +889,8 @@ static inline void iosync(void)
*
*/
extern void __iomem *ioremap(phys_addr_t address, unsigned long size);
-extern void __iomem *ioremap_prot(phys_addr_t address, unsigned long size,
- unsigned long flags);
+#define ioremap ioremap
+#define ioremap_prot ioremap_prot
extern void __iomem *ioremap_wc(phys_addr_t address, unsigned long size);
#define ioremap_wc ioremap_wc
@@ -904,14 +904,12 @@ void __iomem *ioremap_coherent(phys_addr_t address, unsigned long size);
#define ioremap_cache(addr, size) \
ioremap_prot((addr), (size), pgprot_val(PAGE_KERNEL))
-extern void iounmap(volatile void __iomem *addr);
+#define iounmap iounmap
void __iomem *ioremap_phb(phys_addr_t paddr, unsigned long size);
int early_ioremap_range(unsigned long ea, phys_addr_t pa,
unsigned long size, pgprot_t prot);
-void __iomem *do_ioremap(phys_addr_t pa, phys_addr_t offset, unsigned long size,
- pgprot_t prot, void *caller);
extern void __iomem *__ioremap_caller(phys_addr_t, unsigned long size,
pgprot_t prot, void *caller);
diff --git a/arch/powerpc/mm/ioremap.c b/arch/powerpc/mm/ioremap.c
index 4f12504fb405..705e8e8ffde4 100644
--- a/arch/powerpc/mm/ioremap.c
+++ b/arch/powerpc/mm/ioremap.c
@@ -41,7 +41,7 @@ void __iomem *ioremap_coherent(phys_addr_t addr, unsigned long size)
return __ioremap_caller(addr, size, prot, caller);
}
-void __iomem *ioremap_prot(phys_addr_t addr, unsigned long size, unsigned long flags)
+void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long flags)
{
pte_t pte = __pte(flags);
void *caller = __builtin_return_address(0);
@@ -74,27 +74,3 @@ int early_ioremap_range(unsigned long ea, phys_addr_t pa,
return 0;
}
-
-void __iomem *do_ioremap(phys_addr_t pa, phys_addr_t offset, unsigned long size,
- pgprot_t prot, void *caller)
-{
- struct vm_struct *area;
- int ret;
- unsigned long va;
-
- area = __get_vm_area_caller(size, VM_IOREMAP, IOREMAP_START, IOREMAP_END, caller);
- if (area == NULL)
- return NULL;
-
- area->phys_addr = pa;
- va = (unsigned long)area->addr;
-
- ret = ioremap_page_range(va, va + size, pa, prot);
- if (!ret)
- return (void __iomem *)area->addr + offset;
-
- vunmap_range(va, va + size);
- free_vm_area(area);
-
- return NULL;
-}
diff --git a/arch/powerpc/mm/ioremap_32.c b/arch/powerpc/mm/ioremap_32.c
index 9d13143b8be4..ca5bc6be3e6f 100644
--- a/arch/powerpc/mm/ioremap_32.c
+++ b/arch/powerpc/mm/ioremap_32.c
@@ -21,6 +21,13 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, pgprot_t prot, void *call
phys_addr_t p, offset;
int err;
+ /*
+ * If the address lies within the first 16 MB, assume it's in ISA
+ * memory space
+ */
+ if (addr < SZ_16M)
+ addr += _ISA_MEM_BASE;
+
/*
* Choose an address to map it to.
* Once the vmalloc system is running, we use it.
@@ -31,13 +38,6 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, pgprot_t prot, void *call
offset = addr & ~PAGE_MASK;
size = PAGE_ALIGN(addr + size) - p;
- /*
- * If the address lies within the first 16 MB, assume it's in ISA
- * memory space
- */
- if (p < 16 * 1024 * 1024)
- p += _ISA_MEM_BASE;
-
#ifndef CONFIG_CRASH_DUMP
/*
* Don't allow anybody to remap normal RAM that we're using.
@@ -63,7 +63,7 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, pgprot_t prot, void *call
return (void __iomem *)v + offset;
if (slab_is_available())
- return do_ioremap(p, offset, size, prot, caller);
+ return generic_ioremap_prot(addr, size, prot);
/*
* Should check if it is a candidate for a BAT mapping
@@ -87,7 +87,6 @@ void iounmap(volatile void __iomem *addr)
if (v_block_mapped((unsigned long)addr))
return;
- if (addr > high_memory && (unsigned long)addr < ioremap_bot)
- vunmap((void *)(PAGE_MASK & (unsigned long)addr));
+ generic_iounmap(addr);
}
EXPORT_SYMBOL(iounmap);
diff --git a/arch/powerpc/mm/ioremap_64.c b/arch/powerpc/mm/ioremap_64.c
index 3acece00b33e..d24e5f166723 100644
--- a/arch/powerpc/mm/ioremap_64.c
+++ b/arch/powerpc/mm/ioremap_64.c
@@ -29,7 +29,7 @@ void __iomem *__ioremap_caller(phys_addr_t addr, unsigned long size,
return NULL;
if (slab_is_available())
- return do_ioremap(paligned, offset, size, prot, caller);
+ return generic_ioremap_prot(addr, size, prot);
pr_warn("ioremap() called early from %pS. Use early_ioremap() instead\n", caller);
@@ -49,17 +49,9 @@ void __iomem *__ioremap_caller(phys_addr_t addr, unsigned long size,
*/
void iounmap(volatile void __iomem *token)
{
- void *addr;
-
if (!slab_is_available())
return;
- addr = (void *)((unsigned long __force)PCI_FIX_ADDR(token) & PAGE_MASK);
-
- if ((unsigned long)addr < ioremap_bot) {
- pr_warn("Attempt to iounmap early bolted mapping at 0x%p\n", addr);
- return;
- }
- vunmap(addr);
+ generic_iounmap(PCI_FIX_ADDR(token));
}
EXPORT_SYMBOL(iounmap);
--
2.34.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH v6 17/19] powerpc: mm: Convert to GENERIC_IOREMAP
@ 2023-06-09 7:55 ` Baoquan He
0 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, wangkefeng.wang, Baoquan He, arnd, schnelle, deller,
Nicholas Piggin, linux-mm, David.Laight, willy, shorne, agordeev,
linuxppc-dev, hch, rppt
From: Christophe Leroy <christophe.leroy@csgroup.eu>
By taking GENERIC_IOREMAP method, the generic generic_ioremap_prot(),
generic_iounmap(), and their generic wrapper ioremap_prot(), ioremap()
and iounmap() are all visible and available to arch. Arch needs to
provide wrapper functions to override the generic versions if there's
arch specific handling in its ioremap_prot(), ioremap() or iounmap().
This change will simplify implementation by removing duplicated codes
with generic_ioremap_prot() and generic_iounmap(), and has the equivalent
functioality as before.
Here, add wrapper functions ioremap_prot() and iounmap() for powerpc's
special operation when ioremap() and iounmap().
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org
---
arch/powerpc/Kconfig | 1 +
arch/powerpc/include/asm/io.h | 8 +++-----
arch/powerpc/mm/ioremap.c | 26 +-------------------------
arch/powerpc/mm/ioremap_32.c | 19 +++++++++----------
arch/powerpc/mm/ioremap_64.c | 12 ++----------
5 files changed, 16 insertions(+), 50 deletions(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index bff5820b7cda..aadb280a539e 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -194,6 +194,7 @@ config PPC
select GENERIC_CPU_VULNERABILITIES if PPC_BARRIER_NOSPEC
select GENERIC_EARLY_IOREMAP
select GENERIC_GETTIMEOFDAY
+ select GENERIC_IOREMAP
select GENERIC_IRQ_SHOW
select GENERIC_IRQ_SHOW_LEVEL
select GENERIC_PCI_IOMAP if PCI
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index 67a3fb6de498..0732b743e099 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -889,8 +889,8 @@ static inline void iosync(void)
*
*/
extern void __iomem *ioremap(phys_addr_t address, unsigned long size);
-extern void __iomem *ioremap_prot(phys_addr_t address, unsigned long size,
- unsigned long flags);
+#define ioremap ioremap
+#define ioremap_prot ioremap_prot
extern void __iomem *ioremap_wc(phys_addr_t address, unsigned long size);
#define ioremap_wc ioremap_wc
@@ -904,14 +904,12 @@ void __iomem *ioremap_coherent(phys_addr_t address, unsigned long size);
#define ioremap_cache(addr, size) \
ioremap_prot((addr), (size), pgprot_val(PAGE_KERNEL))
-extern void iounmap(volatile void __iomem *addr);
+#define iounmap iounmap
void __iomem *ioremap_phb(phys_addr_t paddr, unsigned long size);
int early_ioremap_range(unsigned long ea, phys_addr_t pa,
unsigned long size, pgprot_t prot);
-void __iomem *do_ioremap(phys_addr_t pa, phys_addr_t offset, unsigned long size,
- pgprot_t prot, void *caller);
extern void __iomem *__ioremap_caller(phys_addr_t, unsigned long size,
pgprot_t prot, void *caller);
diff --git a/arch/powerpc/mm/ioremap.c b/arch/powerpc/mm/ioremap.c
index 4f12504fb405..705e8e8ffde4 100644
--- a/arch/powerpc/mm/ioremap.c
+++ b/arch/powerpc/mm/ioremap.c
@@ -41,7 +41,7 @@ void __iomem *ioremap_coherent(phys_addr_t addr, unsigned long size)
return __ioremap_caller(addr, size, prot, caller);
}
-void __iomem *ioremap_prot(phys_addr_t addr, unsigned long size, unsigned long flags)
+void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long flags)
{
pte_t pte = __pte(flags);
void *caller = __builtin_return_address(0);
@@ -74,27 +74,3 @@ int early_ioremap_range(unsigned long ea, phys_addr_t pa,
return 0;
}
-
-void __iomem *do_ioremap(phys_addr_t pa, phys_addr_t offset, unsigned long size,
- pgprot_t prot, void *caller)
-{
- struct vm_struct *area;
- int ret;
- unsigned long va;
-
- area = __get_vm_area_caller(size, VM_IOREMAP, IOREMAP_START, IOREMAP_END, caller);
- if (area == NULL)
- return NULL;
-
- area->phys_addr = pa;
- va = (unsigned long)area->addr;
-
- ret = ioremap_page_range(va, va + size, pa, prot);
- if (!ret)
- return (void __iomem *)area->addr + offset;
-
- vunmap_range(va, va + size);
- free_vm_area(area);
-
- return NULL;
-}
diff --git a/arch/powerpc/mm/ioremap_32.c b/arch/powerpc/mm/ioremap_32.c
index 9d13143b8be4..ca5bc6be3e6f 100644
--- a/arch/powerpc/mm/ioremap_32.c
+++ b/arch/powerpc/mm/ioremap_32.c
@@ -21,6 +21,13 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, pgprot_t prot, void *call
phys_addr_t p, offset;
int err;
+ /*
+ * If the address lies within the first 16 MB, assume it's in ISA
+ * memory space
+ */
+ if (addr < SZ_16M)
+ addr += _ISA_MEM_BASE;
+
/*
* Choose an address to map it to.
* Once the vmalloc system is running, we use it.
@@ -31,13 +38,6 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, pgprot_t prot, void *call
offset = addr & ~PAGE_MASK;
size = PAGE_ALIGN(addr + size) - p;
- /*
- * If the address lies within the first 16 MB, assume it's in ISA
- * memory space
- */
- if (p < 16 * 1024 * 1024)
- p += _ISA_MEM_BASE;
-
#ifndef CONFIG_CRASH_DUMP
/*
* Don't allow anybody to remap normal RAM that we're using.
@@ -63,7 +63,7 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, pgprot_t prot, void *call
return (void __iomem *)v + offset;
if (slab_is_available())
- return do_ioremap(p, offset, size, prot, caller);
+ return generic_ioremap_prot(addr, size, prot);
/*
* Should check if it is a candidate for a BAT mapping
@@ -87,7 +87,6 @@ void iounmap(volatile void __iomem *addr)
if (v_block_mapped((unsigned long)addr))
return;
- if (addr > high_memory && (unsigned long)addr < ioremap_bot)
- vunmap((void *)(PAGE_MASK & (unsigned long)addr));
+ generic_iounmap(addr);
}
EXPORT_SYMBOL(iounmap);
diff --git a/arch/powerpc/mm/ioremap_64.c b/arch/powerpc/mm/ioremap_64.c
index 3acece00b33e..d24e5f166723 100644
--- a/arch/powerpc/mm/ioremap_64.c
+++ b/arch/powerpc/mm/ioremap_64.c
@@ -29,7 +29,7 @@ void __iomem *__ioremap_caller(phys_addr_t addr, unsigned long size,
return NULL;
if (slab_is_available())
- return do_ioremap(paligned, offset, size, prot, caller);
+ return generic_ioremap_prot(addr, size, prot);
pr_warn("ioremap() called early from %pS. Use early_ioremap() instead\n", caller);
@@ -49,17 +49,9 @@ void __iomem *__ioremap_caller(phys_addr_t addr, unsigned long size,
*/
void iounmap(volatile void __iomem *token)
{
- void *addr;
-
if (!slab_is_available())
return;
- addr = (void *)((unsigned long __force)PCI_FIX_ADDR(token) & PAGE_MASK);
-
- if ((unsigned long)addr < ioremap_bot) {
- pr_warn("Attempt to iounmap early bolted mapping at 0x%p\n", addr);
- return;
- }
- vunmap(addr);
+ generic_iounmap(PCI_FIX_ADDR(token));
}
EXPORT_SYMBOL(iounmap);
--
2.34.1
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH v6 18/19] arm64 : mm: add wrapper function ioremap_prot()
2023-06-09 7:55 [PATCH v6 00/19] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
@ 2023-06-09 7:55 ` Baoquan He
2023-06-09 7:55 ` [PATCH v6 02/19] hexagon: mm: Convert to GENERIC_IOREMAP Baoquan He
` (17 subsequent siblings)
18 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Baoquan He, Catalin Marinas, Will Deacon,
linux-arm-kernel
Since hook functions ioremap_allowed() and iounmap_allowed() will be
obsoleted, add wrapper function ioremap_prot() to contain the
specific handling in addition to generic_ioremap_prot() invocation.
Signed-off-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
---
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 877495a0fd0c..97dd4ff1253b 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
^ permalink raw reply related [flat|nested] 45+ messages in thread
* [PATCH v6 18/19] arm64 : mm: add wrapper function ioremap_prot()
@ 2023-06-09 7:55 ` Baoquan He
0 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Baoquan He, Catalin Marinas, Will Deacon,
linux-arm-kernel
Since hook functions ioremap_allowed() and iounmap_allowed() will be
obsoleted, add wrapper function ioremap_prot() to contain the
specific handling in addition to generic_ioremap_prot() invocation.
Signed-off-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
---
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 877495a0fd0c..97dd4ff1253b 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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 45+ messages in thread
* Re: [PATCH v6 18/19] arm64 : mm: add wrapper function ioremap_prot()
2023-06-09 7:55 ` Baoquan He
@ 2023-06-14 15:14 ` Catalin Marinas
-1 siblings, 0 replies; 45+ messages in thread
From: Catalin Marinas @ 2023-06-14 15:14 UTC (permalink / raw)
To: Baoquan He
Cc: linux-kernel, linux-arch, linux-mm, arnd, christophe.leroy, hch,
rppt, willy, agordeev, wangkefeng.wang, schnelle, David.Laight,
shorne, deller, Will Deacon, linux-arm-kernel
On Fri, Jun 09, 2023 at 03:55:27PM +0800, Baoquan He wrote:
> Since hook functions ioremap_allowed() and iounmap_allowed() will be
> obsoleted, add wrapper function ioremap_prot() to contain the
> specific handling in addition to generic_ioremap_prot() invocation.
>
> Signed-off-by: Baoquan He <bhe@redhat.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: linux-arm-kernel@lists.infradead.org
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v6 18/19] arm64 : mm: add wrapper function ioremap_prot()
@ 2023-06-14 15:14 ` Catalin Marinas
0 siblings, 0 replies; 45+ messages in thread
From: Catalin Marinas @ 2023-06-14 15:14 UTC (permalink / raw)
To: Baoquan He
Cc: linux-kernel, linux-arch, linux-mm, arnd, christophe.leroy, hch,
rppt, willy, agordeev, wangkefeng.wang, schnelle, David.Laight,
shorne, deller, Will Deacon, linux-arm-kernel
On Fri, Jun 09, 2023 at 03:55:27PM +0800, Baoquan He wrote:
> Since hook functions ioremap_allowed() and iounmap_allowed() will be
> obsoleted, add wrapper function ioremap_prot() to contain the
> specific handling in addition to generic_ioremap_prot() invocation.
>
> Signed-off-by: Baoquan He <bhe@redhat.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: linux-arm-kernel@lists.infradead.org
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v6 19/19] mm: ioremap: remove unneeded ioremap_allowed and iounmap_allowed
2023-06-09 7:55 [PATCH v6 00/19] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
` (17 preceding siblings ...)
2023-06-09 7:55 ` Baoquan He
@ 2023-06-09 7:55 ` Baoquan He
18 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2023-06-09 7:55 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mm, arnd, christophe.leroy, hch, rppt, willy,
agordeev, wangkefeng.wang, schnelle, David.Laight, shorne,
deller, Baoquan He
Now there are no users of ioremap_allowed and iounmap_allowed, clean
them up.
Signed-off-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
---
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
^ permalink raw reply related [flat|nested] 45+ messages in thread