Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH 2/2] MIPS: Loongson64: Add cache_sync to loongson_dma_map_ops
@ 2017-11-16  8:35 Huacai Chen
  2018-01-24 14:02 ` James Hogan
  0 siblings, 1 reply; 12+ messages in thread
From: Huacai Chen @ 2017-11-16  8:35 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: James Hogan, Steven J . Hill, linux-mips, Fuxin Zhang,
	Zhangjin Wu, Huacai Chen

To support coherent & non-coherent DMA co-exsistance, we should add
cache_sync to loongson_dma_map_ops.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
---
 arch/mips/include/asm/dma-mapping.h       | 3 +++
 arch/mips/loongson64/common/dma-swiotlb.c | 1 +
 arch/mips/mm/dma-default.c                | 2 +-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h
index 0d9418d..5544276 100644
--- a/arch/mips/include/asm/dma-mapping.h
+++ b/arch/mips/include/asm/dma-mapping.h
@@ -37,4 +37,7 @@ static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base,
 #endif
 }
 
+void mips_dma_cache_sync(struct device *dev, void *vaddr,
+		size_t size, enum dma_data_direction direction);
+
 #endif /* _ASM_DMA_MAPPING_H */
diff --git a/arch/mips/loongson64/common/dma-swiotlb.c b/arch/mips/loongson64/common/dma-swiotlb.c
index ef07740..17956f2 100644
--- a/arch/mips/loongson64/common/dma-swiotlb.c
+++ b/arch/mips/loongson64/common/dma-swiotlb.c
@@ -120,6 +120,7 @@ static const struct dma_map_ops loongson_dma_map_ops = {
 	.sync_sg_for_device = loongson_dma_sync_sg_for_device,
 	.mapping_error = swiotlb_dma_mapping_error,
 	.dma_supported = loongson_dma_supported,
+	.cache_sync = mips_dma_cache_sync,
 };
 
 void __init plat_swiotlb_setup(void)
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index e3e94d0..e86bf5d 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -383,7 +383,7 @@ static int mips_dma_supported(struct device *dev, u64 mask)
 	return plat_dma_supported(dev, mask);
 }
 
-static void mips_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
+void mips_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
 			 enum dma_data_direction direction)
 {
 	BUG_ON(direction == DMA_NONE);
-- 
2.7.0

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

end of thread, other threads:[~2018-01-26  7:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-16  8:35 [PATCH 2/2] MIPS: Loongson64: Add cache_sync to loongson_dma_map_ops Huacai Chen
2018-01-24 14:02 ` James Hogan
2018-01-24 14:11   ` Christoph Hellwig
2018-01-24 15:03     ` James Hogan
2018-01-24 15:29       ` Christoph Hellwig
2018-01-25  7:09         ` Huacai Chen
2018-01-25  7:55           ` James Hogan
2018-01-25  8:44             ` Huacai Chen
2018-01-25 10:54               ` James Hogan
2018-01-25 11:04                 ` Huacai Chen
2018-01-25 12:31                   ` James Hogan
2018-01-26  7:56               ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox