public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dmatest: flush and invalidate destination buffer before DMA
@ 2008-12-26 15:31 Atsushi Nemoto
  2008-12-27 10:10 ` Haavard Skinnemoen
  0 siblings, 1 reply; 15+ messages in thread
From: Atsushi Nemoto @ 2008-12-26 15:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: hskinnemoen, maciej.sosnowski, dan.j.williams, ralf

On non-coherent architectures, such as MIPS, the dmatest reports
mismatches on just before and after the DMA area.  This is because
test patterns in the dstbuf discarded from cache without writing to
main memory.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
 drivers/dma/dmatest.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index ed9636b..6b747dc 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -202,6 +202,7 @@ static int dmatest_func(void *data)
 	dma_cookie_t		cookie;
 	enum dma_status		status;
 	int			ret;
+	dma_addr_t		dma_dest;
 
 	thread_name = current->comm;
 
@@ -226,6 +227,12 @@ static int dmatest_func(void *data)
 
 		dmatest_init_srcbuf(thread->srcbuf, src_off, len);
 		dmatest_init_dstbuf(thread->dstbuf, dst_off, len);
+		/* flush and invalidate caches for whole dstbuf */
+		dma_dest = dma_map_single(chan->device->dev,
+				thread->dstbuf,
+				test_buf_size, DMA_BIDIRECTIONAL);
+		dma_unmap_single(chan->device->dev, dma_dest,
+				test_buf_size, DMA_BIDIRECTIONAL);
 
 		cookie = dma_async_memcpy_buf_to_buf(chan,
 				thread->dstbuf + dst_off,
-- 
1.5.6.3


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

end of thread, other threads:[~2009-01-11 18:44 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-26 15:31 [PATCH] dmatest: flush and invalidate destination buffer before DMA Atsushi Nemoto
2008-12-27 10:10 ` Haavard Skinnemoen
2008-12-28 17:53   ` Atsushi Nemoto
2009-01-05 18:31     ` Dan Williams
2009-01-06  1:14       ` Atsushi Nemoto
2009-01-06  1:29         ` Dan Williams
2009-01-06  2:06           ` Atsushi Nemoto
2009-01-08  4:43       ` Atsushi Nemoto
2009-01-08  8:36         ` Haavard Skinnemoen
2009-01-08 17:20           ` Dan Williams
2009-01-09  8:30             ` Atsushi Nemoto
2009-01-10  0:39               ` Dan Williams
2009-01-09 11:19           ` Ralf Baechle
2009-01-09 22:27             ` Russell King
2009-01-11 18:44               ` Ralf Baechle

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