* [PATCH] dmatest: Use custom map/unmap for destination buffer
@ 2009-01-13 15:34 Atsushi Nemoto
2009-01-13 15:48 ` Haavard Skinnemoen
2009-01-14 14:32 ` Sosnowski, Maciej
0 siblings, 2 replies; 4+ messages in thread
From: Atsushi Nemoto @ 2009-01-13 15:34 UTC (permalink / raw)
To: linux-kernel; +Cc: haavard.skinnemoen, dan.j.williams, maciej.sosnowski
The dmatest driver should use DMA_BIDIRECTIONAL on the destination buffer
to ensure that the poison values are written to RAM and not just written
to cache and discarded.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
drivers/dma/dmatest.c | 35 +++++++++++++++++++++++++++++++----
1 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index ed9636b..02c171f 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -218,6 +218,10 @@ static int dmatest_func(void *data)
dma_chan_get(chan);
while (!kthread_should_stop()) {
+ struct dma_device *dev = chan->device;
+ struct dma_async_tx_descriptor *tx;
+ dma_addr_t dma_src, dma_dest;
+
total_tests++;
len = dmatest_random() % test_buf_size + 1;
@@ -227,10 +231,30 @@ static int dmatest_func(void *data)
dmatest_init_srcbuf(thread->srcbuf, src_off, len);
dmatest_init_dstbuf(thread->dstbuf, dst_off, len);
- cookie = dma_async_memcpy_buf_to_buf(chan,
- thread->dstbuf + dst_off,
- thread->srcbuf + src_off,
- len);
+ dma_src = dma_map_single(dev->dev, thread->srcbuf + src_off,
+ len, DMA_TO_DEVICE);
+ /* map with DMA_BIDIRECTIONAL to force writeback/invalidate */
+ dma_dest = dma_map_single(dev->dev, thread->dstbuf,
+ test_buf_size, DMA_BIDIRECTIONAL);
+
+ tx = dev->device_prep_dma_memcpy(chan, dma_dest + dst_off,
+ dma_src, len,
+ DMA_CTRL_ACK | DMA_COMPL_SKIP_DEST_UNMAP);
+ if (!tx) {
+ dma_unmap_single(dev->dev, dma_src, len, DMA_TO_DEVICE);
+ dma_unmap_single(dev->dev, dma_dest,
+ test_buf_size, DMA_BIDIRECTIONAL);
+ pr_warning("%s: #%u: prep error with src_off=0x%x "
+ "dst_off=0x%x len=0x%x\n",
+ thread_name, total_tests - 1,
+ src_off, dst_off, len);
+ msleep(100);
+ failed_tests++;
+ continue;
+ }
+ tx->callback = NULL;
+ cookie = tx->tx_submit(tx);
+
if (dma_submit_error(cookie)) {
pr_warning("%s: #%u: submit error %d with src_off=0x%x "
"dst_off=0x%x len=0x%x\n",
@@ -254,6 +278,9 @@ static int dmatest_func(void *data)
failed_tests++;
continue;
}
+ /* Unmap by myself (see DMA_COMPL_SKIP_DEST_UNMAP above) */
+ dma_unmap_single(dev->dev, dma_dest,
+ test_buf_size, DMA_BIDIRECTIONAL);
error_count = 0;
--
1.5.6.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] dmatest: Use custom map/unmap for destination buffer
2009-01-13 15:34 [PATCH] dmatest: Use custom map/unmap for destination buffer Atsushi Nemoto
@ 2009-01-13 15:48 ` Haavard Skinnemoen
2009-01-13 19:20 ` Dan Williams
2009-01-14 14:32 ` Sosnowski, Maciej
1 sibling, 1 reply; 4+ messages in thread
From: Haavard Skinnemoen @ 2009-01-13 15:48 UTC (permalink / raw)
To: Atsushi Nemoto; +Cc: linux-kernel, dan.j.williams, maciej.sosnowski
Atsushi Nemoto wrote:
> The dmatest driver should use DMA_BIDIRECTIONAL on the destination buffer
> to ensure that the poison values are written to RAM and not just written
> to cache and discarded.
>
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] dmatest: Use custom map/unmap for destination buffer
2009-01-13 15:48 ` Haavard Skinnemoen
@ 2009-01-13 19:20 ` Dan Williams
0 siblings, 0 replies; 4+ messages in thread
From: Dan Williams @ 2009-01-13 19:20 UTC (permalink / raw)
To: Atsushi Nemoto; +Cc: Haavard Skinnemoen, linux-kernel, maciej.sosnowski
On Tue, Jan 13, 2009 at 8:48 AM, Haavard Skinnemoen
<haavard.skinnemoen@atmel.com> wrote:
> Atsushi Nemoto wrote:
>> The dmatest driver should use DMA_BIDIRECTIONAL on the destination buffer
>> to ensure that the poison values are written to RAM and not just written
>> to cache and discarded.
>>
>> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
>
> Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Applied to async_tx.git/fixes.
Thanks,
Dan
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] dmatest: Use custom map/unmap for destination buffer
2009-01-13 15:34 [PATCH] dmatest: Use custom map/unmap for destination buffer Atsushi Nemoto
2009-01-13 15:48 ` Haavard Skinnemoen
@ 2009-01-14 14:32 ` Sosnowski, Maciej
1 sibling, 0 replies; 4+ messages in thread
From: Sosnowski, Maciej @ 2009-01-14 14:32 UTC (permalink / raw)
To: Atsushi Nemoto; +Cc: linux-kernel, haavard.skinnemoen, Williams, Dan J
Atsushi Nemoto wrote:
> The dmatest driver should use DMA_BIDIRECTIONAL on the destination
> buffer
> to ensure that the poison values are written to RAM and not just
> written
> to cache and discarded.
>
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
> ---
Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-01-14 14:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-13 15:34 [PATCH] dmatest: Use custom map/unmap for destination buffer Atsushi Nemoto
2009-01-13 15:48 ` Haavard Skinnemoen
2009-01-13 19:20 ` Dan Williams
2009-01-14 14:32 ` Sosnowski, Maciej
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®