[v6,10/19] s390: mm: Convert to GENERIC_IOREMAP

Message ID 20230609075528.9390-11-bhe@redhat.com
State New
Headers
Series mm: ioremap: Convert architectures to take GENERIC_IOREMAP way |

Commit Message

Baoquan He June 9, 2023, 7:55 a.m. UTC
  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(-)
  

Comments

kernel test robot June 9, 2023, 3:41 p.m. UTC | #1
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
  
kernel test robot June 9, 2023, 5:42 p.m. UTC | #2
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
  
kernel test robot June 9, 2023, 5:42 p.m. UTC | #3
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
  
Baoquan He June 11, 2023, 11:10 a.m. UTC | #4
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.
  
Alexander Gordeev June 21, 2023, 2:53 p.m. UTC | #5
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!
  

Patch

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);