Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1732690 > unrolled thread

[PATCH V4 1/3] dma-mapping: Provide a default plat_device_is_coherent()

Started byHuacai Chen <chenhc@lemote.com>
First post2017-09-15 05:00 +0200
Last post2017-09-15 17:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH V4 1/3] dma-mapping: Provide a default plat_device_is_coherent() Huacai Chen <chenhc@lemote.com> - 2017-09-15 05:00 +0200
    Re: [PATCH V4 1/3] dma-mapping: Provide a default         plat_device_is_coherent() Christoph Hellwig <hch@lst.de> - 2017-09-15 17:20 +0200

#1732690 — [PATCH V4 1/3] dma-mapping: Provide a default plat_device_is_coherent()

FromHuacai Chen <chenhc@lemote.com>
Date2017-09-15 05:00 +0200
Subject[PATCH V4 1/3] dma-mapping: Provide a default plat_device_is_coherent()
Message-ID<upP1f-5eR-3@gated-at.bofh.it>
We will use plat_device_is_coherent() in generic cases, but it is
MIPS-specific now. So we provide a default implementation.

BTW, export the symbol hw_coherentio for MIPS if the caller of
plat_device_is_coherent() is in a module.

Cc: stable@vger.kernel.org
Signed-off-by: Huacai Chen <chenhc@lemote.com>
---
 arch/mips/include/asm/dma-mapping.h | 1 +
 arch/mips/mm/dma-default.c          | 1 +
 include/linux/dma-mapping.h         | 8 ++++++++
 3 files changed, 10 insertions(+)

diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h
index aba7138..662eca9 100644
--- a/arch/mips/include/asm/dma-mapping.h
+++ b/arch/mips/include/asm/dma-mapping.h
@@ -8,6 +8,7 @@
 #ifndef CONFIG_SGI_IP27 /* Kludge to fix 2.6.39 build for IP27 */
 #include <dma-coherence.h>
 #endif
+#define ARCH_HAS_PLAT_DEVICE_IS_COHERENT
 
 extern const struct dma_map_ops *mips_dma_map_ops;
 
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index 8e78251..b4c74ab 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -29,6 +29,7 @@
 enum coherent_io_user_state coherentio = IO_COHERENCE_DEFAULT;
 EXPORT_SYMBOL_GPL(coherentio);
 int hw_coherentio = 0;	/* Actual hardware supported DMA coherency setting. */
+EXPORT_SYMBOL_GPL(hw_coherentio);
 
 static int __init setcoherentio(char *str)
 {
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 29ce981..6517388 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -697,6 +697,14 @@ static inline void *dma_zalloc_coherent(struct device *dev, size_t size,
 }
 
 #ifdef CONFIG_HAS_DMA
+
+#ifndef ARCH_HAS_PLAT_DEVICE_IS_COHERENT
+static inline int plat_device_is_coherent(struct device *dev)
+{
+	return 1;
+}
+#endif
+
 static inline int dma_get_cache_alignment(void)
 {
 #ifdef ARCH_DMA_MINALIGN
-- 
2.7.0

[toc] | [next] | [standalone]


#1732922 — Re: [PATCH V4 1/3] dma-mapping: Provide a default plat_device_is_coherent()

FromChristoph Hellwig <hch@lst.de>
Date2017-09-15 17:20 +0200
SubjectRe: [PATCH V4 1/3] dma-mapping: Provide a default plat_device_is_coherent()
Message-ID<uq0zn-4II-1@gated-at.bofh.it>
In reply to#1732690
NAK.

For one plat_* is not a valid name for dma-mapping operations.

Second this needs a detailed explanation of the semantics and why
they matter.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web