linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Move the ARCH_DMA_MINALIGN definition to asm/cache.h
@ 2023-06-13 15:52 Catalin Marinas
  2023-06-13 15:52 ` [PATCH 1/3] powerpc: " Catalin Marinas
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Catalin Marinas @ 2023-06-13 15:52 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Michal Simek, Rich Felker, Yoshinori Sato, linux-sh, linuxppc-dev,
	linux-kernel, Nicholas Piggin, John Paul Adrian Glaubitz,
	Linus Torvalds, Vlastimil Babka

Hi,

The ARCH_KMALLOC_MINALIGN reduction series defines a generic
ARCH_DMA_MINALIGN in linux/cache.h:

https://lore.kernel.org/r/20230612153201.554742-2-catalin.marinas@arm.com/

Unfortunately, this causes a duplicate definition warning for
microblaze, powerpc (32-bit only) and sh as these architectures define
ARCH_DMA_MINALIGN in a different file than asm/cache.h. Move the macro
to asm/cache.h to avoid this issue and also bring them in line with the
other architectures.

Andrew, if the arch maintainers cc'ed are fine with such change, could
you please take these three patches together with the
ARCH_KMALLOC_MINALIGN series?

Thank you.

Catalin Marinas (3):
  powerpc: Move the ARCH_DMA_MINALIGN definition to asm/cache.h
  microblaze: Move the ARCH_{DMA,SLAB}_MINALIGN definitions to
    asm/cache.h
  sh: Move the ARCH_DMA_MINALIGN definition to asm/cache.h

 arch/microblaze/include/asm/cache.h | 5 +++++
 arch/microblaze/include/asm/page.h  | 5 -----
 arch/powerpc/include/asm/cache.h    | 4 ++++
 arch/powerpc/include/asm/page_32.h  | 4 ----
 arch/sh/include/asm/cache.h         | 6 ++++++
 arch/sh/include/asm/page.h          | 6 ------
 6 files changed, 15 insertions(+), 15 deletions(-)


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

* [PATCH 1/3] powerpc: Move the ARCH_DMA_MINALIGN definition to asm/cache.h
  2023-06-13 15:52 [PATCH 0/3] Move the ARCH_DMA_MINALIGN definition to asm/cache.h Catalin Marinas
@ 2023-06-13 15:52 ` Catalin Marinas
  2023-06-13 15:52 ` [PATCH 2/3] microblaze: Move the ARCH_{DMA,SLAB}_MINALIGN definitions " Catalin Marinas
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2023-06-13 15:52 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Michal Simek, Rich Felker, kernel test robot, Yoshinori Sato,
	linux-sh, linuxppc-dev, linux-kernel, Nicholas Piggin,
	John Paul Adrian Glaubitz, Linus Torvalds, Vlastimil Babka

The powerpc architecture defines ARCH_DMA_MINALIGN in asm/page_32.h and
only if CONFIG_NOT_COHERENT_CACHE is enabled (32-bit platforms only).
Move this macro to asm/cache.h to allow a generic ARCH_DMA_MINALIGN
definition in linux/cache.h without redefine errors/warnings.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202306131053.1ybvRRhO-lkp@intel.com/
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: linuxppc-dev@lists.ozlabs.org
---
 arch/powerpc/include/asm/cache.h   | 4 ++++
 arch/powerpc/include/asm/page_32.h | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/include/asm/cache.h b/arch/powerpc/include/asm/cache.h
index ae0a68a838e8..69232231d270 100644
--- a/arch/powerpc/include/asm/cache.h
+++ b/arch/powerpc/include/asm/cache.h
@@ -33,6 +33,10 @@
 
 #define IFETCH_ALIGN_BYTES	(1 << IFETCH_ALIGN_SHIFT)
 
+#ifdef CONFIG_NOT_COHERENT_CACHE
+#define ARCH_DMA_MINALIGN	L1_CACHE_BYTES
+#endif
+
 #if !defined(__ASSEMBLY__)
 #ifdef CONFIG_PPC64
 
diff --git a/arch/powerpc/include/asm/page_32.h b/arch/powerpc/include/asm/page_32.h
index 56f217606327..b9ac9e3a771c 100644
--- a/arch/powerpc/include/asm/page_32.h
+++ b/arch/powerpc/include/asm/page_32.h
@@ -12,10 +12,6 @@
 
 #define VM_DATA_DEFAULT_FLAGS	VM_DATA_DEFAULT_FLAGS32
 
-#ifdef CONFIG_NOT_COHERENT_CACHE
-#define ARCH_DMA_MINALIGN	L1_CACHE_BYTES
-#endif
-
 #if defined(CONFIG_PPC_256K_PAGES) || \
     (defined(CONFIG_PPC_8xx) && defined(CONFIG_PPC_16K_PAGES))
 #define PTE_SHIFT	(PAGE_SHIFT - PTE_T_LOG2 - 2)	/* 1/4 of a page */

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

* [PATCH 2/3] microblaze: Move the ARCH_{DMA,SLAB}_MINALIGN definitions to asm/cache.h
  2023-06-13 15:52 [PATCH 0/3] Move the ARCH_DMA_MINALIGN definition to asm/cache.h Catalin Marinas
  2023-06-13 15:52 ` [PATCH 1/3] powerpc: " Catalin Marinas
@ 2023-06-13 15:52 ` Catalin Marinas
  2023-06-13 15:52 ` [PATCH 3/3] sh: Move the ARCH_DMA_MINALIGN definition " Catalin Marinas
  2023-06-13 16:42 ` [PATCH 0/3] " Christophe Leroy
  3 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2023-06-13 15:52 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Michal Simek, Rich Felker, Yoshinori Sato, linux-sh, linuxppc-dev,
	linux-kernel, Nicholas Piggin, John Paul Adrian Glaubitz,
	Linus Torvalds, Vlastimil Babka

The microblaze architecture defines ARCH_DMA_MINALIGN in asm/page.h.
Move it to asm/cache.h to allow a generic ARCH_DMA_MINALIGN definition
in linux/cache.h without redefine errors/warnings.

While at it, also move ARCH_SLAB_MINALIGN to asm/cache.h for
consistency.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Michal Simek <monstr@monstr.eu>
---
 arch/microblaze/include/asm/cache.h | 5 +++++
 arch/microblaze/include/asm/page.h  | 5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/microblaze/include/asm/cache.h b/arch/microblaze/include/asm/cache.h
index a149b3e711ec..1903988b9e23 100644
--- a/arch/microblaze/include/asm/cache.h
+++ b/arch/microblaze/include/asm/cache.h
@@ -18,4 +18,9 @@
 
 #define SMP_CACHE_BYTES	L1_CACHE_BYTES
 
+/* MS be sure that SLAB allocates aligned objects */
+#define ARCH_DMA_MINALIGN	L1_CACHE_BYTES
+
+#define ARCH_SLAB_MINALIGN	L1_CACHE_BYTES
+
 #endif /* _ASM_MICROBLAZE_CACHE_H */
diff --git a/arch/microblaze/include/asm/page.h b/arch/microblaze/include/asm/page.h
index 7b9861bcd458..337f23eabc71 100644
--- a/arch/microblaze/include/asm/page.h
+++ b/arch/microblaze/include/asm/page.h
@@ -30,11 +30,6 @@
 
 #ifndef __ASSEMBLY__
 
-/* MS be sure that SLAB allocates aligned objects */
-#define ARCH_DMA_MINALIGN	L1_CACHE_BYTES
-
-#define ARCH_SLAB_MINALIGN	L1_CACHE_BYTES
-
 /*
  * PAGE_OFFSET -- the first address of the first page of memory. With MMU
  * it is set to the kernel start address (aligned on a page boundary).

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

* [PATCH 3/3] sh: Move the ARCH_DMA_MINALIGN definition to asm/cache.h
  2023-06-13 15:52 [PATCH 0/3] Move the ARCH_DMA_MINALIGN definition to asm/cache.h Catalin Marinas
  2023-06-13 15:52 ` [PATCH 1/3] powerpc: " Catalin Marinas
  2023-06-13 15:52 ` [PATCH 2/3] microblaze: Move the ARCH_{DMA,SLAB}_MINALIGN definitions " Catalin Marinas
@ 2023-06-13 15:52 ` Catalin Marinas
  2023-06-13 16:42 ` [PATCH 0/3] " Christophe Leroy
  3 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2023-06-13 15:52 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Michal Simek, Rich Felker, Yoshinori Sato, linux-sh, linuxppc-dev,
	linux-kernel, Nicholas Piggin, John Paul Adrian Glaubitz,
	Linus Torvalds, Vlastimil Babka

The sh architecture defines ARCH_DMA_MINALIGN in asm/page.h. Move it to
asm/cache.h to allow a generic ARCH_DMA_MINALIGN definition in
linux/cache.h without redefine errors/warnings.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: linux-sh@vger.kernel.org
---
 arch/sh/include/asm/cache.h | 6 ++++++
 arch/sh/include/asm/page.h  | 6 ------
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/sh/include/asm/cache.h b/arch/sh/include/asm/cache.h
index 32dfa6b82ec6..b38dbc975581 100644
--- a/arch/sh/include/asm/cache.h
+++ b/arch/sh/include/asm/cache.h
@@ -14,6 +14,12 @@
 
 #define L1_CACHE_BYTES		(1 << L1_CACHE_SHIFT)
 
+/*
+ * Some drivers need to perform DMA into kmalloc'ed buffers
+ * and so we have to increase the kmalloc minalign for this.
+ */
+#define ARCH_DMA_MINALIGN	L1_CACHE_BYTES
+
 #define __read_mostly __section(".data..read_mostly")
 
 #ifndef __ASSEMBLY__
diff --git a/arch/sh/include/asm/page.h b/arch/sh/include/asm/page.h
index 09ac6c7faee0..62f4b9edcb98 100644
--- a/arch/sh/include/asm/page.h
+++ b/arch/sh/include/asm/page.h
@@ -174,10 +174,4 @@ typedef struct page *pgtable_t;
 #include <asm-generic/memory_model.h>
 #include <asm-generic/getorder.h>
 
-/*
- * Some drivers need to perform DMA into kmalloc'ed buffers
- * and so we have to increase the kmalloc minalign for this.
- */
-#define ARCH_DMA_MINALIGN	L1_CACHE_BYTES
-
 #endif /* __ASM_SH_PAGE_H */

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

* Re: [PATCH 0/3] Move the ARCH_DMA_MINALIGN definition to asm/cache.h
  2023-06-13 15:52 [PATCH 0/3] Move the ARCH_DMA_MINALIGN definition to asm/cache.h Catalin Marinas
                   ` (2 preceding siblings ...)
  2023-06-13 15:52 ` [PATCH 3/3] sh: Move the ARCH_DMA_MINALIGN definition " Catalin Marinas
@ 2023-06-13 16:42 ` Christophe Leroy
  2023-06-13 19:49   ` Catalin Marinas
  3 siblings, 1 reply; 6+ messages in thread
From: Christophe Leroy @ 2023-06-13 16:42 UTC (permalink / raw)
  To: Catalin Marinas, Andrew Morton
  Cc: Michal Simek, Rich Felker, Yoshinori Sato,
	linux-sh@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	Nicholas Piggin, linux-kernel@vger.kernel.org,
	John Paul Adrian Glaubitz, Linus Torvalds, Vlastimil Babka



Le 13/06/2023 à 17:52, Catalin Marinas a écrit :
> Hi,
> 
> The ARCH_KMALLOC_MINALIGN reduction series defines a generic
> ARCH_DMA_MINALIGN in linux/cache.h:
> 
> https://lore.kernel.org/r/20230612153201.554742-2-catalin.marinas@arm.com/
> 
> Unfortunately, this causes a duplicate definition warning for
> microblaze, powerpc (32-bit only) and sh as these architectures define
> ARCH_DMA_MINALIGN in a different file than asm/cache.h. Move the macro
> to asm/cache.h to avoid this issue and also bring them in line with the
> other architectures.

What about mips ?

arch/mips/include/asm/mach-generic/kmalloc.h:#define ARCH_DMA_MINALIGN	128
arch/mips/include/asm/mach-ip32/kmalloc.h:#define ARCH_DMA_MINALIGN	32
arch/mips/include/asm/mach-ip32/kmalloc.h:#define ARCH_DMA_MINALIGN	128
arch/mips/include/asm/mach-n64/kmalloc.h:#define ARCH_DMA_MINALIGN 
L1_CACHE_BYTES
arch/mips/include/asm/mach-tx49xx/kmalloc.h:#define ARCH_DMA_MINALIGN 
L1_CACHE_BYTES


> 
> Andrew, if the arch maintainers cc'ed are fine with such change, could
> you please take these three patches together with the
> ARCH_KMALLOC_MINALIGN series?
> 
> Thank you.
> 
> Catalin Marinas (3):
>    powerpc: Move the ARCH_DMA_MINALIGN definition to asm/cache.h
>    microblaze: Move the ARCH_{DMA,SLAB}_MINALIGN definitions to
>      asm/cache.h
>    sh: Move the ARCH_DMA_MINALIGN definition to asm/cache.h
> 
>   arch/microblaze/include/asm/cache.h | 5 +++++
>   arch/microblaze/include/asm/page.h  | 5 -----
>   arch/powerpc/include/asm/cache.h    | 4 ++++
>   arch/powerpc/include/asm/page_32.h  | 4 ----
>   arch/sh/include/asm/cache.h         | 6 ++++++
>   arch/sh/include/asm/page.h          | 6 ------
>   6 files changed, 15 insertions(+), 15 deletions(-)
> 

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

* Re: [PATCH 0/3] Move the ARCH_DMA_MINALIGN definition to asm/cache.h
  2023-06-13 16:42 ` [PATCH 0/3] " Christophe Leroy
@ 2023-06-13 19:49   ` Catalin Marinas
  0 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2023-06-13 19:49 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Michal Simek, Rich Felker, Yoshinori Sato,
	linux-sh@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	Nicholas Piggin, linux-kernel@vger.kernel.org,
	John Paul Adrian Glaubitz, Andrew Morton, Linus Torvalds,
	Vlastimil Babka

On Tue, Jun 13, 2023 at 04:42:40PM +0000, Christophe Leroy wrote:
> 
> 
> Le 13/06/2023 à 17:52, Catalin Marinas a écrit :
> > Hi,
> > 
> > The ARCH_KMALLOC_MINALIGN reduction series defines a generic
> > ARCH_DMA_MINALIGN in linux/cache.h:
> > 
> > https://lore.kernel.org/r/20230612153201.554742-2-catalin.marinas@arm.com/
> > 
> > Unfortunately, this causes a duplicate definition warning for
> > microblaze, powerpc (32-bit only) and sh as these architectures define
> > ARCH_DMA_MINALIGN in a different file than asm/cache.h. Move the macro
> > to asm/cache.h to avoid this issue and also bring them in line with the
> > other architectures.
> 
> What about mips ?
> 
> arch/mips/include/asm/mach-generic/kmalloc.h:#define ARCH_DMA_MINALIGN	128
> arch/mips/include/asm/mach-ip32/kmalloc.h:#define ARCH_DMA_MINALIGN	32
> arch/mips/include/asm/mach-ip32/kmalloc.h:#define ARCH_DMA_MINALIGN	128
> arch/mips/include/asm/mach-n64/kmalloc.h:#define ARCH_DMA_MINALIGN	L1_CACHE_BYTES
> arch/mips/include/asm/mach-tx49xx/kmalloc.h:#define ARCH_DMA_MINALIGN	L1_CACHE_BYTES

Sorry, I should have mentioned it in the cover letter (discussed here -
https://lore.kernel.org/r/ZIhPaixb%2F0ve7zZo@arm.com/). These kmalloc.h
files are included in asm/cache.h, based on which machine is enabled, so
there's no problem for mips. It makes more sense to keep them in those
mach-*/kmalloc.h files instead of having lots of #ifdefs in cache.h.

-- 
Catalin

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

end of thread, other threads:[~2023-06-13 19:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-13 15:52 [PATCH 0/3] Move the ARCH_DMA_MINALIGN definition to asm/cache.h Catalin Marinas
2023-06-13 15:52 ` [PATCH 1/3] powerpc: " Catalin Marinas
2023-06-13 15:52 ` [PATCH 2/3] microblaze: Move the ARCH_{DMA,SLAB}_MINALIGN definitions " Catalin Marinas
2023-06-13 15:52 ` [PATCH 3/3] sh: Move the ARCH_DMA_MINALIGN definition " Catalin Marinas
2023-06-13 16:42 ` [PATCH 0/3] " Christophe Leroy
2023-06-13 19:49   ` Catalin Marinas

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