linux-csky.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/5] Consolidate IO memcpy functions
@ 2024-09-24  9:22 Julian Vetter
  2024-09-24  9:22 ` [PATCH v4 1/5] Consolidate __memcpy_{to,from}io and __memset_io into a single lib Julian Vetter
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Julian Vetter @ 2024-09-24  9:22 UTC (permalink / raw)
  To: Arnd Bergmann, Catalin Marinas, Will Deacon, Guo Ren, Huacai Chen,
	WANG Xuerui, Andrew Morton
  Cc: linux-arm-kernel, linux-kernel, linux-csky, loongarch,
	Yann Sionneau, Julian Vetter

Thank you again for your feedback. Sorry for the delay, I didn't see the
remarks you made on v2 of the patchset in regards to the
asm-generic/io.h. This patchset takes your remarks on v2 into account.

Signed-off-by: Julian Vetter <jvetter@kalrayinc.com>

---
Changes for v4:
- Replaced memcpy/memset in asm-generic/io.h by the new
  __memcpy_{to,from}io and __memset_io, so individual architectures can
  use it instead of using their own implementation.
---
Julian Vetter (5):
  Consolidate __memcpy_{to,from}io and __memset_io into a single lib
  Replace generic memcpy and memset by IO memcpy functions
  Use generic io memcpy functions on the arm64 architecture
  Use generic io memcpy functions on the csky architecture
  Use generic io memcpy functions on the loongarch architecture

 arch/arm64/Kconfig             |   1 +
 arch/arm64/kernel/io.c         |  87 --------------------------
 arch/csky/Kconfig              |   1 +
 arch/csky/kernel/Makefile      |   2 +-
 arch/csky/kernel/io.c          |  91 ---------------------------
 arch/loongarch/Kconfig         |   1 +
 arch/loongarch/kernel/Makefile |   2 +-
 arch/loongarch/kernel/io.c     |  94 ----------------------------
 include/asm-generic/io.h       |   6 +-
 lib/Kconfig                    |   3 +
 lib/Makefile                   |   1 +
 lib/io_copy.c                  | 110 +++++++++++++++++++++++++++++++++
 12 files changed, 122 insertions(+), 277 deletions(-)
 delete mode 100644 arch/csky/kernel/io.c
 delete mode 100644 arch/loongarch/kernel/io.c
 create mode 100644 lib/io_copy.c

-- 
2.34.1






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

* [PATCH v4 1/5] Consolidate __memcpy_{to,from}io and __memset_io into a single lib
  2024-09-24  9:22 [PATCH v4 0/5] Consolidate IO memcpy functions Julian Vetter
@ 2024-09-24  9:22 ` Julian Vetter
  2024-09-24  9:22 ` [PATCH v4 2/5] Replace generic memcpy and memset by IO memcpy functions Julian Vetter
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Julian Vetter @ 2024-09-24  9:22 UTC (permalink / raw)
  To: Arnd Bergmann, Catalin Marinas, Will Deacon, Guo Ren, Huacai Chen,
	WANG Xuerui, Andrew Morton
  Cc: linux-arm-kernel, linux-kernel, linux-csky, loongarch,
	Yann Sionneau, Julian Vetter

Various architectures have almost the same implementations for
__memcpy_{to,from}io and __memset_io functions. So, consolidate them and
introduce a CONFIG_GENERIC_IO_COPY flag to build the given
lib/io_copy.c.

Reviewed-by: Yann Sionneau <ysionneau@kalrayinc.com>
Signed-off-by: Julian Vetter <jvetter@kalrayinc.com>
---
 lib/Kconfig   |   3 ++
 lib/Makefile  |   1 +
 lib/io_copy.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 114 insertions(+)
 create mode 100644 lib/io_copy.c

diff --git a/lib/Kconfig b/lib/Kconfig
index b38849af6f13..741550bc3856 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -70,6 +70,9 @@ source "lib/math/Kconfig"
 config NO_GENERIC_PCI_IOPORT_MAP
 	bool
 
+config GENERIC_IO_COPY
+	bool
+
 config GENERIC_IOMAP
 	bool
 	select GENERIC_PCI_IOMAP
diff --git a/lib/Makefile b/lib/Makefile
index 322bb127b4dc..4f56ad5f9ed6 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -130,6 +130,7 @@ CFLAGS_debug_info.o += $(call cc-option, -femit-struct-debug-detailed=any)
 
 obj-y += math/ crypto/
 
+obj-$(CONFIG_GENERIC_IO_COPY) += io_copy.o
 obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
 obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o
 obj-$(CONFIG_CHECK_SIGNATURE) += check_signature.o
diff --git a/lib/io_copy.c b/lib/io_copy.c
new file mode 100644
index 000000000000..f44583166325
--- /dev/null
+++ b/lib/io_copy.c
@@ -0,0 +1,110 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * derived from arch/arm/kernel/io.c
+ *
+ * Copyright (C) 2024 Kalray Inc.
+ * Author(s): Julian Vetter
+ */
+
+#include <asm/unaligned.h>
+
+#include <linux/export.h>
+#include <linux/types.h>
+#include <linux/io.h>
+
+#define NATIVE_STORE_SIZE	(BITS_PER_LONG/8)
+
+void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count)
+{
+	while (count && !IS_ALIGNED((unsigned long)from, NATIVE_STORE_SIZE)) {
+		*(u8 *)to = __raw_readb(from);
+		from++;
+		to++;
+		count--;
+	}
+
+	while (count >= NATIVE_STORE_SIZE) {
+#ifdef CONFIG_64BIT
+			put_unaligned(__raw_readq(from), (uintptr_t *)to);
+#else
+			put_unaligned(__raw_readl(from), (uintptr_t *)to);
+#endif
+
+		from += NATIVE_STORE_SIZE;
+		to += NATIVE_STORE_SIZE;
+		count -= NATIVE_STORE_SIZE;
+	}
+
+	while (count) {
+		*(u8 *)to = __raw_readb(from);
+		from++;
+		to++;
+		count--;
+	}
+}
+EXPORT_SYMBOL(__memcpy_fromio);
+
+void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count)
+{
+	while (count && !IS_ALIGNED((unsigned long)to, NATIVE_STORE_SIZE)) {
+		__raw_writeb(*(u8 *)from, to);
+		from++;
+		to++;
+		count--;
+	}
+
+	while (count >= NATIVE_STORE_SIZE) {
+#ifdef CONFIG_64BIT
+			__raw_writeq(get_unaligned((uintptr_t *)from), to);
+#else
+			__raw_writel(get_unaligned((uintptr_t *)from), to);
+#endif
+
+		from += NATIVE_STORE_SIZE;
+		to += NATIVE_STORE_SIZE;
+		count -= NATIVE_STORE_SIZE;
+	}
+
+	while (count) {
+		__raw_writeb(*(u8 *)from, to);
+		from++;
+		to++;
+		count--;
+	}
+}
+EXPORT_SYMBOL(__memcpy_toio);
+
+void __memset_io(volatile void __iomem *dst, int c, size_t count)
+{
+	uintptr_t qc = (u8)c;
+
+	qc |= qc << 8;
+	qc |= qc << 16;
+
+	if (IS_ENABLED(CONFIG_64BIT))
+		qc |= qc << 32;
+
+	while (count && !IS_ALIGNED((unsigned long)dst, NATIVE_STORE_SIZE)) {
+		__raw_writeb(c, dst);
+		dst++;
+		count--;
+	}
+
+	while (count >= NATIVE_STORE_SIZE) {
+#ifdef CONFIG_64BIT
+			__raw_writeq(qc, dst);
+#else
+			__raw_writel(qc, dst);
+#endif
+
+		dst += NATIVE_STORE_SIZE;
+		count -= NATIVE_STORE_SIZE;
+	}
+
+	while (count) {
+		__raw_writeb(c, dst);
+		dst++;
+		count--;
+	}
+}
+EXPORT_SYMBOL(__memset_io);
-- 
2.34.1






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

* [PATCH v4 2/5] Replace generic memcpy and memset by IO memcpy functions
  2024-09-24  9:22 [PATCH v4 0/5] Consolidate IO memcpy functions Julian Vetter
  2024-09-24  9:22 ` [PATCH v4 1/5] Consolidate __memcpy_{to,from}io and __memset_io into a single lib Julian Vetter
@ 2024-09-24  9:22 ` Julian Vetter
  2024-09-24 17:31   ` kernel test robot
  2024-09-24 20:25   ` kernel test robot
  2024-09-24  9:22 ` [PATCH v4 3/5] Use generic io memcpy functions on the arm64 architecture Julian Vetter
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 8+ messages in thread
From: Julian Vetter @ 2024-09-24  9:22 UTC (permalink / raw)
  To: Arnd Bergmann, Catalin Marinas, Will Deacon, Guo Ren, Huacai Chen,
	WANG Xuerui, Andrew Morton
  Cc: linux-arm-kernel, linux-kernel, linux-csky, loongarch,
	Yann Sionneau, Julian Vetter

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>
---
 include/asm-generic/io.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 80de699bf6af..0f05d2399938 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -1163,7 +1163,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
 
@@ -1181,7 +1181,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
 
@@ -1198,7 +1198,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
 
-- 
2.34.1






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

* [PATCH v4 3/5] Use generic io memcpy functions on the arm64 architecture
  2024-09-24  9:22 [PATCH v4 0/5] Consolidate IO memcpy functions Julian Vetter
  2024-09-24  9:22 ` [PATCH v4 1/5] Consolidate __memcpy_{to,from}io and __memset_io into a single lib Julian Vetter
  2024-09-24  9:22 ` [PATCH v4 2/5] Replace generic memcpy and memset by IO memcpy functions Julian Vetter
@ 2024-09-24  9:22 ` Julian Vetter
  2024-09-24  9:22 ` [PATCH v4 4/5] Use generic io memcpy functions on the csky architecture Julian Vetter
  2024-09-24  9:22 ` [PATCH v4 5/5] Use generic io memcpy functions on the loongarch architecture Julian Vetter
  4 siblings, 0 replies; 8+ messages in thread
From: Julian Vetter @ 2024-09-24  9:22 UTC (permalink / raw)
  To: Arnd Bergmann, Catalin Marinas, Will Deacon, Guo Ren, Huacai Chen,
	WANG Xuerui, Andrew Morton
  Cc: linux-arm-kernel, linux-kernel, linux-csky, loongarch,
	Yann Sionneau, Julian Vetter

Use the generic __memcpy_{from,to}io and __memset_io functions on the
arm64 processor architecture.

Reviewed-by: Yann Sionneau <ysionneau@kalrayinc.com>
Signed-off-by: Julian Vetter <jvetter@kalrayinc.com>
---
 arch/arm64/Kconfig     |  1 +
 arch/arm64/kernel/io.c | 87 ------------------------------------------
 2 files changed, 1 insertion(+), 87 deletions(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index a2f8ff354ca6..cfb1c729c9a1 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -140,6 +140,7 @@ config ARM64
 	select GENERIC_CPU_VULNERABILITIES
 	select GENERIC_EARLY_IOREMAP
 	select GENERIC_IDLE_POLL_SETUP
+	select GENERIC_IO_COPY
 	select GENERIC_IOREMAP
 	select GENERIC_IRQ_IPI
 	select GENERIC_IRQ_PROBE
diff --git a/arch/arm64/kernel/io.c b/arch/arm64/kernel/io.c
index ef48089fbfe1..fe86ada23c7d 100644
--- a/arch/arm64/kernel/io.c
+++ b/arch/arm64/kernel/io.c
@@ -9,34 +9,6 @@
 #include <linux/types.h>
 #include <linux/io.h>
 
-/*
- * Copy data from IO memory space to "real" memory space.
- */
-void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count)
-{
-	while (count && !IS_ALIGNED((unsigned long)from, 8)) {
-		*(u8 *)to = __raw_readb(from);
-		from++;
-		to++;
-		count--;
-	}
-
-	while (count >= 8) {
-		*(u64 *)to = __raw_readq(from);
-		from += 8;
-		to += 8;
-		count -= 8;
-	}
-
-	while (count) {
-		*(u8 *)to = __raw_readb(from);
-		from++;
-		to++;
-		count--;
-	}
-}
-EXPORT_SYMBOL(__memcpy_fromio);
-
 /*
  * This generates a memcpy that works on a from/to address which is aligned to
  * bits. Count is in terms of the number of bits sized quantities to copy. It
@@ -78,62 +50,3 @@ void __iowrite32_copy_full(void __iomem *to, const void *from, size_t count)
 	dgh();
 }
 EXPORT_SYMBOL(__iowrite32_copy_full);
-
-/*
- * Copy data from "real" memory space to IO memory space.
- */
-void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count)
-{
-	while (count && !IS_ALIGNED((unsigned long)to, 8)) {
-		__raw_writeb(*(u8 *)from, to);
-		from++;
-		to++;
-		count--;
-	}
-
-	while (count >= 8) {
-		__raw_writeq(*(u64 *)from, to);
-		from += 8;
-		to += 8;
-		count -= 8;
-	}
-
-	while (count) {
-		__raw_writeb(*(u8 *)from, to);
-		from++;
-		to++;
-		count--;
-	}
-}
-EXPORT_SYMBOL(__memcpy_toio);
-
-/*
- * "memset" on IO memory space.
- */
-void __memset_io(volatile void __iomem *dst, int c, size_t count)
-{
-	u64 qc = (u8)c;
-
-	qc |= qc << 8;
-	qc |= qc << 16;
-	qc |= qc << 32;
-
-	while (count && !IS_ALIGNED((unsigned long)dst, 8)) {
-		__raw_writeb(c, dst);
-		dst++;
-		count--;
-	}
-
-	while (count >= 8) {
-		__raw_writeq(qc, dst);
-		dst += 8;
-		count -= 8;
-	}
-
-	while (count) {
-		__raw_writeb(c, dst);
-		dst++;
-		count--;
-	}
-}
-EXPORT_SYMBOL(__memset_io);
-- 
2.34.1






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

* [PATCH v4 4/5] Use generic io memcpy functions on the csky architecture
  2024-09-24  9:22 [PATCH v4 0/5] Consolidate IO memcpy functions Julian Vetter
                   ` (2 preceding siblings ...)
  2024-09-24  9:22 ` [PATCH v4 3/5] Use generic io memcpy functions on the arm64 architecture Julian Vetter
@ 2024-09-24  9:22 ` Julian Vetter
  2024-09-24  9:22 ` [PATCH v4 5/5] Use generic io memcpy functions on the loongarch architecture Julian Vetter
  4 siblings, 0 replies; 8+ messages in thread
From: Julian Vetter @ 2024-09-24  9:22 UTC (permalink / raw)
  To: Arnd Bergmann, Catalin Marinas, Will Deacon, Guo Ren, Huacai Chen,
	WANG Xuerui, Andrew Morton
  Cc: linux-arm-kernel, linux-kernel, linux-csky, loongarch,
	Yann Sionneau, Julian Vetter

Use the generic __memcpy_{from,to}io and __memset_io functions on the
csky processor architecture.

Reviewed-by: Yann Sionneau <ysionneau@kalrayinc.com>
Signed-off-by: Julian Vetter <jvetter@kalrayinc.com>
---
 arch/csky/Kconfig         |  1 +
 arch/csky/kernel/Makefile |  2 +-
 arch/csky/kernel/io.c     | 91 ---------------------------------------
 3 files changed, 2 insertions(+), 92 deletions(-)
 delete mode 100644 arch/csky/kernel/io.c

diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig
index 5479707eb5d1..59d4051b2a83 100644
--- a/arch/csky/Kconfig
+++ b/arch/csky/Kconfig
@@ -48,6 +48,7 @@ config CSKY
 	select DMA_DIRECT_REMAP
 	select IRQ_DOMAIN
 	select DW_APB_TIMER_OF
+	select GENERIC_IO_COPY
 	select GENERIC_IOREMAP
 	select GENERIC_LIB_ASHLDI3
 	select GENERIC_LIB_ASHRDI3
diff --git a/arch/csky/kernel/Makefile b/arch/csky/kernel/Makefile
index 8a868316b912..de1c3472e8f0 100644
--- a/arch/csky/kernel/Makefile
+++ b/arch/csky/kernel/Makefile
@@ -2,7 +2,7 @@
 extra-y := vmlinux.lds
 
 obj-y += head.o entry.o atomic.o signal.o traps.o irq.o time.o vdso.o vdso/
-obj-y += power.o syscall.o syscall_table.o setup.o io.o
+obj-y += power.o syscall.o syscall_table.o setup.o
 obj-y += process.o cpu-probe.o ptrace.o stacktrace.o
 obj-y += probes/
 
diff --git a/arch/csky/kernel/io.c b/arch/csky/kernel/io.c
deleted file mode 100644
index 5883f13fa2b1..000000000000
--- a/arch/csky/kernel/io.c
+++ /dev/null
@@ -1,91 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-#include <linux/export.h>
-#include <linux/types.h>
-#include <linux/io.h>
-
-/*
- * Copy data from IO memory space to "real" memory space.
- */
-void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count)
-{
-	while (count && !IS_ALIGNED((unsigned long)from, 4)) {
-		*(u8 *)to = __raw_readb(from);
-		from++;
-		to++;
-		count--;
-	}
-
-	while (count >= 4) {
-		*(u32 *)to = __raw_readl(from);
-		from += 4;
-		to += 4;
-		count -= 4;
-	}
-
-	while (count) {
-		*(u8 *)to = __raw_readb(from);
-		from++;
-		to++;
-		count--;
-	}
-}
-EXPORT_SYMBOL(__memcpy_fromio);
-
-/*
- * Copy data from "real" memory space to IO memory space.
- */
-void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count)
-{
-	while (count && !IS_ALIGNED((unsigned long)to, 4)) {
-		__raw_writeb(*(u8 *)from, to);
-		from++;
-		to++;
-		count--;
-	}
-
-	while (count >= 4) {
-		__raw_writel(*(u32 *)from, to);
-		from += 4;
-		to += 4;
-		count -= 4;
-	}
-
-	while (count) {
-		__raw_writeb(*(u8 *)from, to);
-		from++;
-		to++;
-		count--;
-	}
-}
-EXPORT_SYMBOL(__memcpy_toio);
-
-/*
- * "memset" on IO memory space.
- */
-void __memset_io(volatile void __iomem *dst, int c, size_t count)
-{
-	u32 qc = (u8)c;
-
-	qc |= qc << 8;
-	qc |= qc << 16;
-
-	while (count && !IS_ALIGNED((unsigned long)dst, 4)) {
-		__raw_writeb(c, dst);
-		dst++;
-		count--;
-	}
-
-	while (count >= 4) {
-		__raw_writel(qc, dst);
-		dst += 4;
-		count -= 4;
-	}
-
-	while (count) {
-		__raw_writeb(c, dst);
-		dst++;
-		count--;
-	}
-}
-EXPORT_SYMBOL(__memset_io);
-- 
2.34.1






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

* [PATCH v4 5/5] Use generic io memcpy functions on the loongarch architecture
  2024-09-24  9:22 [PATCH v4 0/5] Consolidate IO memcpy functions Julian Vetter
                   ` (3 preceding siblings ...)
  2024-09-24  9:22 ` [PATCH v4 4/5] Use generic io memcpy functions on the csky architecture Julian Vetter
@ 2024-09-24  9:22 ` Julian Vetter
  4 siblings, 0 replies; 8+ messages in thread
From: Julian Vetter @ 2024-09-24  9:22 UTC (permalink / raw)
  To: Arnd Bergmann, Catalin Marinas, Will Deacon, Guo Ren, Huacai Chen,
	WANG Xuerui, Andrew Morton
  Cc: linux-arm-kernel, linux-kernel, linux-csky, loongarch,
	Yann Sionneau, Julian Vetter

Use the generic __memcpy_{from,to}io and __memset_io functions on the
loongarch processor architecture.

Reviewed-by: Yann Sionneau <ysionneau@kalrayinc.com>
Signed-off-by: Julian Vetter <jvetter@kalrayinc.com>
---
 arch/loongarch/Kconfig         |  1 +
 arch/loongarch/kernel/Makefile |  2 +-
 arch/loongarch/kernel/io.c     | 94 ----------------------------------
 3 files changed, 2 insertions(+), 95 deletions(-)
 delete mode 100644 arch/loongarch/kernel/io.c

diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
index 70f169210b52..bc97b09efd16 100644
--- a/arch/loongarch/Kconfig
+++ b/arch/loongarch/Kconfig
@@ -84,6 +84,7 @@ config LOONGARCH
 	select GENERIC_CPU_DEVICES
 	select GENERIC_ENTRY
 	select GENERIC_GETTIMEOFDAY
+	select GENERIC_IO_COPY
 	select GENERIC_IOREMAP if !ARCH_IOREMAP
 	select GENERIC_IRQ_MULTI_HANDLER
 	select GENERIC_IRQ_PROBE
diff --git a/arch/loongarch/kernel/Makefile b/arch/loongarch/kernel/Makefile
index c9bfeda89e40..9497968ee158 100644
--- a/arch/loongarch/kernel/Makefile
+++ b/arch/loongarch/kernel/Makefile
@@ -8,7 +8,7 @@ OBJECT_FILES_NON_STANDARD_head.o := y
 extra-y		:= vmlinux.lds
 
 obj-y		+= head.o cpu-probe.o cacheinfo.o env.o setup.o entry.o genex.o \
-		   traps.o irq.o idle.o process.o dma.o mem.o io.o reset.o switch.o \
+		   traps.o irq.o idle.o process.o dma.o mem.o reset.o switch.o \
 		   elf.o syscall.o signal.o time.o topology.o inst.o ptrace.o vdso.o \
 		   alternative.o unwind.o
 
diff --git a/arch/loongarch/kernel/io.c b/arch/loongarch/kernel/io.c
deleted file mode 100644
index cb85bda5a6ad..000000000000
--- a/arch/loongarch/kernel/io.c
+++ /dev/null
@@ -1,94 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
- */
-#include <linux/export.h>
-#include <linux/types.h>
-#include <linux/io.h>
-
-/*
- * Copy data from IO memory space to "real" memory space.
- */
-void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count)
-{
-	while (count && !IS_ALIGNED((unsigned long)from, 8)) {
-		*(u8 *)to = __raw_readb(from);
-		from++;
-		to++;
-		count--;
-	}
-
-	while (count >= 8) {
-		*(u64 *)to = __raw_readq(from);
-		from += 8;
-		to += 8;
-		count -= 8;
-	}
-
-	while (count) {
-		*(u8 *)to = __raw_readb(from);
-		from++;
-		to++;
-		count--;
-	}
-}
-EXPORT_SYMBOL(__memcpy_fromio);
-
-/*
- * Copy data from "real" memory space to IO memory space.
- */
-void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count)
-{
-	while (count && !IS_ALIGNED((unsigned long)to, 8)) {
-		__raw_writeb(*(u8 *)from, to);
-		from++;
-		to++;
-		count--;
-	}
-
-	while (count >= 8) {
-		__raw_writeq(*(u64 *)from, to);
-		from += 8;
-		to += 8;
-		count -= 8;
-	}
-
-	while (count) {
-		__raw_writeb(*(u8 *)from, to);
-		from++;
-		to++;
-		count--;
-	}
-}
-EXPORT_SYMBOL(__memcpy_toio);
-
-/*
- * "memset" on IO memory space.
- */
-void __memset_io(volatile void __iomem *dst, int c, size_t count)
-{
-	u64 qc = (u8)c;
-
-	qc |= qc << 8;
-	qc |= qc << 16;
-	qc |= qc << 32;
-
-	while (count && !IS_ALIGNED((unsigned long)dst, 8)) {
-		__raw_writeb(c, dst);
-		dst++;
-		count--;
-	}
-
-	while (count >= 8) {
-		__raw_writeq(qc, dst);
-		dst += 8;
-		count -= 8;
-	}
-
-	while (count) {
-		__raw_writeb(c, dst);
-		dst++;
-		count--;
-	}
-}
-EXPORT_SYMBOL(__memset_io);
-- 
2.34.1






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

* Re: [PATCH v4 2/5] Replace generic memcpy and memset by IO memcpy functions
  2024-09-24  9:22 ` [PATCH v4 2/5] Replace generic memcpy and memset by IO memcpy functions Julian Vetter
@ 2024-09-24 17:31   ` kernel test robot
  2024-09-24 20:25   ` kernel test robot
  1 sibling, 0 replies; 8+ messages in thread
From: kernel test robot @ 2024-09-24 17:31 UTC (permalink / raw)
  To: Julian Vetter, Arnd Bergmann, Catalin Marinas, Will Deacon,
	Guo Ren, Huacai Chen, WANG Xuerui, Andrew Morton
  Cc: oe-kbuild-all, Linux Memory Management List, linux-arm-kernel,
	linux-kernel, linux-csky, loongarch, Yann Sionneau, Julian Vetter

Hi Julian,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-nonmm-unstable]
[also build test ERROR on arm64/for-next/core soc/for-next linus/master v6.11 next-20240924]
[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-a-single-lib/20240924-172751
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable
patch link:    https://lore.kernel.org/r/20240924092223.534040-3-jvetter%40kalrayinc.com
patch subject: [PATCH v4 2/5] Replace generic memcpy and memset by IO memcpy functions
config: openrisc-defconfig (https://download.01.org/0day-ci/archive/20240925/202409250049.WzbuwMDw-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240925/202409250049.WzbuwMDw-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/202409250049.WzbuwMDw-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from arch/openrisc/include/asm/io.h:37,
                    from include/linux/io.h:14,
                    from arch/openrisc/kernel/asm-offsets.c:31:
   include/asm-generic/io.h: In function 'memset_io':
>> include/asm-generic/io.h:1166:9: error: implicit declaration of function '__memset_io'; did you mean 'memset_io'? [-Wimplicit-function-declaration]
    1166 |         __memset_io(__io_virt(addr), value, size);
         |         ^~~~~~~~~~~
         |         memset_io
   include/asm-generic/io.h: In function 'memcpy_fromio':
>> include/asm-generic/io.h:1184:9: error: implicit declaration of function '__memcpy_fromio'; did you mean 'memcpy_fromio'? [-Wimplicit-function-declaration]
    1184 |         __memcpy_fromio(buffer, __io_virt(addr), size);
         |         ^~~~~~~~~~~~~~~
         |         memcpy_fromio
   include/asm-generic/io.h: In function 'memcpy_toio':
>> include/asm-generic/io.h:1201:9: error: implicit declaration of function '__memcpy_toio'; did you mean 'memcpy_toio'? [-Wimplicit-function-declaration]
    1201 |         __memcpy_toio(__io_virt(addr), buffer, size);
         |         ^~~~~~~~~~~~~
         |         memcpy_toio
   make[3]: *** [scripts/Makefile.build:117: arch/openrisc/kernel/asm-offsets.s] Error 1
   make[3]: Target 'prepare' not remade because of errors.
   make[2]: *** [Makefile:1193: prepare0] Error 2
   make[2]: Target 'prepare' not remade because of errors.
   make[1]: *** [Makefile:224: __sub-make] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [Makefile:224: __sub-make] Error 2
   make: Target 'prepare' not remade because of errors.


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

  1152	
  1153	#ifndef memset_io
  1154	#define memset_io memset_io
  1155	/**
  1156	 * memset_io	Set a range of I/O memory to a constant value
  1157	 * @addr:	The beginning of the I/O-memory range to set
  1158	 * @val:	The value to set the memory to
  1159	 * @count:	The number of bytes to set
  1160	 *
  1161	 * Set a range of I/O memory to a given value.
  1162	 */
  1163	static inline void memset_io(volatile void __iomem *addr, int value,
  1164				     size_t size)
  1165	{
> 1166		__memset_io(__io_virt(addr), value, size);
  1167	}
  1168	#endif
  1169	
  1170	#ifndef memcpy_fromio
  1171	#define memcpy_fromio memcpy_fromio
  1172	/**
  1173	 * memcpy_fromio	Copy a block of data from I/O memory
  1174	 * @dst:		The (RAM) destination for the copy
  1175	 * @src:		The (I/O memory) source for the data
  1176	 * @count:		The number of bytes to copy
  1177	 *
  1178	 * Copy a block of data from I/O memory.
  1179	 */
  1180	static inline void memcpy_fromio(void *buffer,
  1181					 const volatile void __iomem *addr,
  1182					 size_t size)
  1183	{
> 1184		__memcpy_fromio(buffer, __io_virt(addr), size);
  1185	}
  1186	#endif
  1187	
  1188	#ifndef memcpy_toio
  1189	#define memcpy_toio memcpy_toio
  1190	/**
  1191	 * memcpy_toio		Copy a block of data into I/O memory
  1192	 * @dst:		The (I/O memory) destination for the copy
  1193	 * @src:		The (RAM) source for the data
  1194	 * @count:		The number of bytes to copy
  1195	 *
  1196	 * Copy a block of data to I/O memory.
  1197	 */
  1198	static inline void memcpy_toio(volatile void __iomem *addr, const void *buffer,
  1199				       size_t size)
  1200	{
> 1201		__memcpy_toio(__io_virt(addr), buffer, size);
  1202	}
  1203	#endif
  1204	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH v4 2/5] Replace generic memcpy and memset by IO memcpy functions
  2024-09-24  9:22 ` [PATCH v4 2/5] Replace generic memcpy and memset by IO memcpy functions Julian Vetter
  2024-09-24 17:31   ` kernel test robot
@ 2024-09-24 20:25   ` kernel test robot
  1 sibling, 0 replies; 8+ messages in thread
From: kernel test robot @ 2024-09-24 20:25 UTC (permalink / raw)
  To: Julian Vetter, Arnd Bergmann, Catalin Marinas, Will Deacon,
	Guo Ren, Huacai Chen, WANG Xuerui, Andrew Morton
  Cc: llvm, oe-kbuild-all, Linux Memory Management List,
	linux-arm-kernel, linux-kernel, linux-csky, loongarch,
	Yann Sionneau, Julian Vetter

Hi Julian,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-nonmm-unstable]
[also build test ERROR on arm64/for-next/core soc/for-next linus/master v6.11 next-20240924]
[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-a-single-lib/20240924-172751
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable
patch link:    https://lore.kernel.org/r/20240924092223.534040-3-jvetter%40kalrayinc.com
patch subject: [PATCH v4 2/5] Replace generic memcpy and memset by IO memcpy functions
config: um-x86_64_defconfig (https://download.01.org/0day-ci/archive/20240925/202409250346.N624LLrr-lkp@intel.com/config)
compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240925/202409250346.N624LLrr-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/202409250346.N624LLrr-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from kernel/time/time.c:31:
   In file included from include/linux/timekeeper_internal.h:10:
   In file included from include/linux/clocksource.h:22:
   In file included from arch/um/include/asm/io.h:24:
   include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           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'
   #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
                                                     ^
   In file included from kernel/time/time.c:31:
   In file included from include/linux/timekeeper_internal.h:10:
   In file included from include/linux/clocksource.h:22:
   In file included from arch/um/include/asm/io.h:24:
   include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           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'
   #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
                                                     ^
   In file included from kernel/time/time.c:31:
   In file included from include/linux/timekeeper_internal.h:10:
   In file included from include/linux/clocksource.h:22:
   In file included from arch/um/include/asm/io.h:24:
   include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:693:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsb(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:701:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsw(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:709:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsl(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:718:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesb(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:727:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesw(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:736:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesl(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
>> include/asm-generic/io.h:1166:2: error: call to undeclared function '__memset_io'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
           __memset_io(__io_virt(addr), value, size);
           ^
   include/asm-generic/io.h:1166:2: note: did you mean 'memset_io'?
   include/asm-generic/io.h:1163:20: note: 'memset_io' declared here
   static inline void memset_io(volatile void __iomem *addr, int value,
                      ^
   include/asm-generic/io.h:1154:19: note: expanded from macro 'memset_io'
   #define memset_io memset_io
                     ^
>> include/asm-generic/io.h:1184:2: error: call to undeclared function '__memcpy_fromio'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
           __memcpy_fromio(buffer, __io_virt(addr), size);
           ^
   include/asm-generic/io.h:1184:2: note: did you mean 'memcpy_fromio'?
   include/asm-generic/io.h:1180:20: note: 'memcpy_fromio' declared here
   static inline void memcpy_fromio(void *buffer,
                      ^
   include/asm-generic/io.h:1171:23: note: expanded from macro 'memcpy_fromio'
   #define memcpy_fromio memcpy_fromio
                         ^
>> include/asm-generic/io.h:1201:2: error: call to undeclared function '__memcpy_toio'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
           __memcpy_toio(__io_virt(addr), buffer, size);
           ^
   include/asm-generic/io.h:1201:2: note: did you mean 'memcpy_toio'?
   include/asm-generic/io.h:1198:20: note: 'memcpy_toio' declared here
   static inline void memcpy_toio(volatile void __iomem *addr, const void *buffer,
                      ^
   include/asm-generic/io.h:1189:21: note: expanded from macro 'memcpy_toio'
   #define memcpy_toio memcpy_toio
                       ^
   12 warnings and 3 errors generated.
--
   In file included from kernel/time/hrtimer.c:30:
   In file included from include/linux/syscalls.h:93:
   In file included from include/trace/syscall.h:7:
   In file included from include/linux/trace_events.h:9:
   In file included from include/linux/hardirq.h:11:
   In file included from arch/um/include/asm/hardirq.h:5:
   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:14:
   In file included from arch/um/include/asm/io.h:24:
   include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           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'
   #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
                                                     ^
   In file included from kernel/time/hrtimer.c:30:
   In file included from include/linux/syscalls.h:93:
   In file included from include/trace/syscall.h:7:
   In file included from include/linux/trace_events.h:9:
   In file included from include/linux/hardirq.h:11:
   In file included from arch/um/include/asm/hardirq.h:5:
   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:14:
   In file included from arch/um/include/asm/io.h:24:
   include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           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'
   #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
                                                     ^
   In file included from kernel/time/hrtimer.c:30:
   In file included from include/linux/syscalls.h:93:
   In file included from include/trace/syscall.h:7:
   In file included from include/linux/trace_events.h:9:
   In file included from include/linux/hardirq.h:11:
   In file included from arch/um/include/asm/hardirq.h:5:
   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:14:
   In file included from arch/um/include/asm/io.h:24:
   include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:693:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsb(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:701:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsw(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:709:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsl(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:718:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesb(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:727:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesw(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:736:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesl(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
>> include/asm-generic/io.h:1166:2: error: call to undeclared function '__memset_io'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
           __memset_io(__io_virt(addr), value, size);
           ^
   include/asm-generic/io.h:1166:2: note: did you mean 'memset_io'?
   include/asm-generic/io.h:1163:20: note: 'memset_io' declared here
   static inline void memset_io(volatile void __iomem *addr, int value,
                      ^
   include/asm-generic/io.h:1154:19: note: expanded from macro 'memset_io'
   #define memset_io memset_io
                     ^
>> include/asm-generic/io.h:1184:2: error: call to undeclared function '__memcpy_fromio'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
           __memcpy_fromio(buffer, __io_virt(addr), size);
           ^
   include/asm-generic/io.h:1184:2: note: did you mean 'memcpy_fromio'?
   include/asm-generic/io.h:1180:20: note: 'memcpy_fromio' declared here
   static inline void memcpy_fromio(void *buffer,
                      ^
   include/asm-generic/io.h:1171:23: note: expanded from macro 'memcpy_fromio'
   #define memcpy_fromio memcpy_fromio
                         ^
>> include/asm-generic/io.h:1201:2: error: call to undeclared function '__memcpy_toio'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
           __memcpy_toio(__io_virt(addr), buffer, size);
           ^
   include/asm-generic/io.h:1201:2: note: did you mean 'memcpy_toio'?
   include/asm-generic/io.h:1198:20: note: 'memcpy_toio' declared here
   static inline void memcpy_toio(volatile void __iomem *addr, const void *buffer,
                      ^
   include/asm-generic/io.h:1189:21: note: expanded from macro 'memcpy_toio'
   #define memcpy_toio memcpy_toio
                       ^
   kernel/time/hrtimer.c:121:21: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [CLOCK_REALTIME]        = HRTIMER_BASE_REALTIME,
                                     ^~~~~~~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:119:27: note: previous initialization is here
           [0 ... MAX_CLOCKS - 1]  = HRTIMER_MAX_CLOCK_BASES,
                                     ^~~~~~~~~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:122:22: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [CLOCK_MONOTONIC]       = HRTIMER_BASE_MONOTONIC,
                                     ^~~~~~~~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:119:27: note: previous initialization is here
           [0 ... MAX_CLOCKS - 1]  = HRTIMER_MAX_CLOCK_BASES,
                                     ^~~~~~~~~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:123:21: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [CLOCK_BOOTTIME]        = HRTIMER_BASE_BOOTTIME,
                                     ^~~~~~~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:119:27: note: previous initialization is here
           [0 ... MAX_CLOCKS - 1]  = HRTIMER_MAX_CLOCK_BASES,
                                     ^~~~~~~~~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:124:17: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [CLOCK_TAI]             = HRTIMER_BASE_TAI,
                                     ^~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:119:27: note: previous initialization is here
           [0 ... MAX_CLOCKS - 1]  = HRTIMER_MAX_CLOCK_BASES,
                                     ^~~~~~~~~~~~~~~~~~~~~~~
   16 warnings and 3 errors generated.


vim +/__memset_io +1166 include/asm-generic/io.h

  1152	
  1153	#ifndef memset_io
  1154	#define memset_io memset_io
  1155	/**
  1156	 * memset_io	Set a range of I/O memory to a constant value
  1157	 * @addr:	The beginning of the I/O-memory range to set
  1158	 * @val:	The value to set the memory to
  1159	 * @count:	The number of bytes to set
  1160	 *
  1161	 * Set a range of I/O memory to a given value.
  1162	 */
  1163	static inline void memset_io(volatile void __iomem *addr, int value,
  1164				     size_t size)
  1165	{
> 1166		__memset_io(__io_virt(addr), value, size);
  1167	}
  1168	#endif
  1169	
  1170	#ifndef memcpy_fromio
  1171	#define memcpy_fromio memcpy_fromio
  1172	/**
  1173	 * memcpy_fromio	Copy a block of data from I/O memory
  1174	 * @dst:		The (RAM) destination for the copy
  1175	 * @src:		The (I/O memory) source for the data
  1176	 * @count:		The number of bytes to copy
  1177	 *
  1178	 * Copy a block of data from I/O memory.
  1179	 */
  1180	static inline void memcpy_fromio(void *buffer,
  1181					 const volatile void __iomem *addr,
  1182					 size_t size)
  1183	{
> 1184		__memcpy_fromio(buffer, __io_virt(addr), size);
  1185	}
  1186	#endif
  1187	
  1188	#ifndef memcpy_toio
  1189	#define memcpy_toio memcpy_toio
  1190	/**
  1191	 * memcpy_toio		Copy a block of data into I/O memory
  1192	 * @dst:		The (I/O memory) destination for the copy
  1193	 * @src:		The (RAM) source for the data
  1194	 * @count:		The number of bytes to copy
  1195	 *
  1196	 * Copy a block of data to I/O memory.
  1197	 */
  1198	static inline void memcpy_toio(volatile void __iomem *addr, const void *buffer,
  1199				       size_t size)
  1200	{
> 1201		__memcpy_toio(__io_virt(addr), buffer, size);
  1202	}
  1203	#endif
  1204	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2024-09-24 20:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-24  9:22 [PATCH v4 0/5] Consolidate IO memcpy functions Julian Vetter
2024-09-24  9:22 ` [PATCH v4 1/5] Consolidate __memcpy_{to,from}io and __memset_io into a single lib Julian Vetter
2024-09-24  9:22 ` [PATCH v4 2/5] Replace generic memcpy and memset by IO memcpy functions Julian Vetter
2024-09-24 17:31   ` kernel test robot
2024-09-24 20:25   ` kernel test robot
2024-09-24  9:22 ` [PATCH v4 3/5] Use generic io memcpy functions on the arm64 architecture Julian Vetter
2024-09-24  9:22 ` [PATCH v4 4/5] Use generic io memcpy functions on the csky architecture Julian Vetter
2024-09-24  9:22 ` [PATCH v4 5/5] Use generic io memcpy functions on the loongarch architecture Julian Vetter

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