diff mbox series

[v6,2/5] Replace generic memcpy and memset by IO memcpy functions

Message ID 20240925132420.821473-3-jvetter@kalrayinc.com (mailing list archive)
State New, archived
Headers show
Series Consolidate IO memcpy functions | expand

Commit Message

Julian Vetter Sept. 25, 2024, 1:24 p.m. UTC
Some architectures implement their own memcpy_{to,from}io and memset_io
functions, because the generic memcpy_{to,from}io and memset_io just use
memcpy/memset.This commit replaces the generic memcpy/memset functions
by IO memcpy/memset functions that respect the given architectures
alignment constraints. So, later we can get rid of the individual
implementations and use the generic ones.

Reviewed-by: Yann Sionneau <ysionneau@kalrayinc.com>
Signed-off-by: Julian Vetter <jvetter@kalrayinc.com>
---
Changes for v6:
- No changes
---
 include/asm-generic/io.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

kernel test robot Sept. 27, 2024, 5:28 a.m. UTC | #1
Hi Julian,

kernel test robot noticed the following build errors:

[auto build test ERROR on arm64/for-next/core]
[also build test ERROR on soc/for-next linus/master v6.11 next-20240926]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Julian-Vetter/Consolidate-__memcpy_-to-from-io-and-__memset_io-into-iomap_copy-c/20240925-225627
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
patch link:    https://lore.kernel.org/r/20240925132420.821473-3-jvetter%40kalrayinc.com
patch subject: [PATCH v6 2/5] Replace generic memcpy and memset by IO memcpy functions
config: um-randconfig-001-20240927 (https://download.01.org/0day-ci/archive/20240927/202409271351.RPEyNO3U-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240927/202409271351.RPEyNO3U-lkp@intel.com/reproduce)

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/202409271351.RPEyNO3U-lkp@intel.com/

All errors (new ones prefixed by >>):

   /usr/bin/ld: warning: .tmp_vmlinux1 has a LOAD segment with RWX permissions
   /usr/bin/ld: drivers/bus/mhi/ep/ring.o: in function `memcpy_toio':
>> include/asm-generic/io.h:1213: undefined reference to `__memcpy_toio'
   /usr/bin/ld: drivers/bus/mhi/ep/ring.o: in function `memcpy_fromio':
>> include/asm-generic/io.h:1196: undefined reference to `__memcpy_fromio'
>> /usr/bin/ld: include/asm-generic/io.h:1196: undefined reference to `__memcpy_fromio'
>> /usr/bin/ld: include/asm-generic/io.h:1196: undefined reference to `__memcpy_fromio'
>> /usr/bin/ld: include/asm-generic/io.h:1196: undefined reference to `__memcpy_fromio'
   clang: error: linker command failed with exit code 1 (use -v to see invocation)


vim +1213 include/asm-generic/io.h

  1181	
  1182	#ifndef memcpy_fromio
  1183	#define memcpy_fromio memcpy_fromio
  1184	/**
  1185	 * memcpy_fromio	Copy a block of data from I/O memory
  1186	 * @dst:		The (RAM) destination for the copy
  1187	 * @src:		The (I/O memory) source for the data
  1188	 * @count:		The number of bytes to copy
  1189	 *
  1190	 * Copy a block of data from I/O memory.
  1191	 */
  1192	static inline void memcpy_fromio(void *buffer,
  1193					 const volatile void __iomem *addr,
  1194					 size_t size)
  1195	{
> 1196		__memcpy_fromio(buffer, __io_virt(addr), size);
  1197	}
  1198	#endif
  1199	
  1200	#ifndef memcpy_toio
  1201	#define memcpy_toio memcpy_toio
  1202	/**
  1203	 * memcpy_toio		Copy a block of data into I/O memory
  1204	 * @dst:		The (I/O memory) destination for the copy
  1205	 * @src:		The (RAM) source for the data
  1206	 * @count:		The number of bytes to copy
  1207	 *
  1208	 * Copy a block of data to I/O memory.
  1209	 */
  1210	static inline void memcpy_toio(volatile void __iomem *addr, const void *buffer,
  1211				       size_t size)
  1212	{
> 1213		__memcpy_toio(__io_virt(addr), buffer, size);
  1214	}
  1215	#endif
  1216
kernel test robot Sept. 27, 2024, 5:49 a.m. UTC | #2
Hi Julian,

kernel test robot noticed the following build errors:

[auto build test ERROR on arm64/for-next/core]
[also build test ERROR on arnd-asm-generic/master soc/for-next linus/master v6.11 next-20240926]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Julian-Vetter/Consolidate-__memcpy_-to-from-io-and-__memset_io-into-iomap_copy-c/20240925-225627
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
patch link:    https://lore.kernel.org/r/20240925132420.821473-3-jvetter%40kalrayinc.com
patch subject: [PATCH v6 2/5] Replace generic memcpy and memset by IO memcpy functions
config: um-randconfig-r072-20240927 (https://download.01.org/0day-ci/archive/20240927/202409271356.SXoT779W-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240927/202409271356.SXoT779W-lkp@intel.com/reproduce)

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/202409271356.SXoT779W-lkp@intel.com/

All errors (new ones prefixed by >>, old ones prefixed by <<):

WARNING: modpost: missing MODULE_DESCRIPTION() in lib/zlib_inflate/zlib_inflate.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/fpga/tests/fpga-mgr-test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/fpga/tests/fpga-bridge-test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/fpga/tests/fpga-region-test.o
>> ERROR: modpost: "__memcpy_fromio" [drivers/mtd/chips/cfi_cmdset_0002.ko] undefined!
>> ERROR: modpost: "__memcpy_fromio" [drivers/mtd/chips/map_ram.ko] undefined!
>> ERROR: modpost: "__memcpy_toio" [drivers/mtd/chips/map_ram.ko] undefined!
>> ERROR: modpost: "__memcpy_fromio" [drivers/mtd/chips/map_rom.ko] undefined!
diff mbox series

Patch

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 9b8e0449da28..3b7deb724a2c 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -1175,7 +1175,7 @@  static inline void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr)
 static inline void memset_io(volatile void __iomem *addr, int value,
 			     size_t size)
 {
-	memset(__io_virt(addr), value, size);
+	__memset_io(__io_virt(addr), value, size);
 }
 #endif
 
@@ -1193,7 +1193,7 @@  static inline void memcpy_fromio(void *buffer,
 				 const volatile void __iomem *addr,
 				 size_t size)
 {
-	memcpy(buffer, __io_virt(addr), size);
+	__memcpy_fromio(buffer, __io_virt(addr), size);
 }
 #endif
 
@@ -1210,7 +1210,7 @@  static inline void memcpy_fromio(void *buffer,
 static inline void memcpy_toio(volatile void __iomem *addr, const void *buffer,
 			       size_t size)
 {
-	memcpy(__io_virt(addr), buffer, size);
+	__memcpy_toio(__io_virt(addr), buffer, size);
 }
 #endif