[PATCH] dmatest: flush and invalidate destination buffer before DMA
From: Atsushi Nemoto
Date: Fri Dec 26 2008 - 10:31:22 EST
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@xxxxxxxxxxxxx>
---
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/