lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1230305468-18021-1-git-send-email-anemo@mba.ocn.ne.jp>
Date:	Sat, 27 Dec 2008 00:31:08 +0900
From:	Atsushi Nemoto <anemo@....ocn.ne.jp>
To:	linux-kernel@...r.kernel.org
Cc:	hskinnemoen@...el.com, maciej.sosnowski@...el.com,
	dan.j.williams@...el.com, ralf@...ux-mips.org
Subject: [PATCH] dmatest: flush and invalidate destination buffer before DMA

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@....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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ