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: <1446631008-5854-1-git-send-email-sanjeev_sharma@mentor.com>
Date:	Wed, 4 Nov 2015 15:26:48 +0530
From:	Sanjeev Sharma <sanjeev_sharma@...tor.com>
To:	<linux@....linux.org.uk>, <m.szyprowski@...sung.com>,
	<will.deacon@....com>
CC:	<linux-arm-kernel@...ts.infradead.org>,
	<linux-kernel@...r.kernel.org>,
	Sanjeev Sharma <sanjeev_sharma@...tor.com>
Subject: [PATCH] ARM:dma-mapping: Handle DMA_BIDIRECTIONAL in _dma_page_cpu_to_dev()

_dma_page_cpu_to_dev() treat DMA_BIDIRECTIONAL similar to DMA_TO_DEVICE
which means that destination buffer is device memory,means cpu may have
written some data to source buffer and data may be in cache line.For
cleaner operation we need to call outer_flush_range() which will
clean and invalidate outer cache lines.

Signed-off-by: Sanjeev Sharma <sanjeev_sharma@...tor.com>
---
 arch/arm/mm/dma-mapping.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index e62400e..e195235 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -850,12 +850,20 @@ static void __dma_page_cpu_to_dev(struct page *page, unsigned long off,
 	dma_cache_maint_page(page, off, size, dir, dmac_map_area);
 
 	paddr = page_to_phys(page) + off;
-	if (dir == DMA_FROM_DEVICE) {
-		outer_inv_range(paddr, paddr + size);
-	} else {
-		outer_clean_range(paddr, paddr + size);
+
+	switch (dir) {
+	case DMA_FROM_DEVICE:
+			outer_inv_range(paddr, paddr + size);
+			break;
+	case DMA_TO_DEVICE:
+			outer_clean_range(paddr, paddr + size);
+			break;
+	case DMA_BIDIRECTIONAL:
+			outer_flush_range(paddr, paddr + size);
+			break;
+	default:
+			break;
 	}
-	/* FIXME: non-speculating: flush on bidirectional mappings? */
 }
 
 static void __dma_page_dev_to_cpu(struct page *page, unsigned long off,
-- 
1.7.11.7

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