Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1507553

[net-next PATCH RFC 08/26] arch/frv: Add option to skip sync on DMA map

From Alexander Duyck <alexander.h.duyck@intel.com>
Newsgroups linux.kernel
Subject [net-next PATCH RFC 08/26] arch/frv: Add option to skip sync on DMA map
Date 2016-10-24 20:20 +0200
Message-ID <svS0N-2QU-23@gated-at.bofh.it> (permalink)
References <svRR7-2Kt-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The use of DMA_ATTR_SKIP_CPU_SYNC was not consistent across all of the DMA
APIs in the arch/arm folder.  This change is meant to correct that so that
we get consistent behavior.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
 arch/frv/mb93090-mb00/pci-dma-nommu.c |   16 +++++++++++-----
 arch/frv/mb93090-mb00/pci-dma.c       |    7 ++++++-
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/arch/frv/mb93090-mb00/pci-dma-nommu.c b/arch/frv/mb93090-mb00/pci-dma-nommu.c
index 90f2e4c..ff606d1 100644
--- a/arch/frv/mb93090-mb00/pci-dma-nommu.c
+++ b/arch/frv/mb93090-mb00/pci-dma-nommu.c
@@ -109,16 +109,19 @@ static int frv_dma_map_sg(struct device *dev, struct scatterlist *sglist,
 		int nents, enum dma_data_direction direction,
 		unsigned long attrs)
 {
-	int i;
 	struct scatterlist *sg;
+	int i;
+
+	WARN_ON(direction == DMA_NONE);
+
+	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
+		return nents;
 
 	for_each_sg(sglist, sg, nents, i) {
 		frv_cache_wback_inv(sg_dma_address(sg),
 				    sg_dma_address(sg) + sg_dma_len(sg));
 	}
 
-	BUG_ON(direction == DMA_NONE);
-
 	return nents;
 }
 
@@ -126,8 +129,11 @@ static dma_addr_t frv_dma_map_page(struct device *dev, struct page *page,
 		unsigned long offset, size_t size,
 		enum dma_data_direction direction, unsigned long attrs)
 {
-	BUG_ON(direction == DMA_NONE);
-	flush_dcache_page(page);
+	WARN_ON(direction == DMA_NONE);
+
+	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		flush_dcache_page(page);
+
 	return (dma_addr_t) page_to_phys(page) + offset;
 }
 
diff --git a/arch/frv/mb93090-mb00/pci-dma.c b/arch/frv/mb93090-mb00/pci-dma.c
index f585745..ee5dadf 100644
--- a/arch/frv/mb93090-mb00/pci-dma.c
+++ b/arch/frv/mb93090-mb00/pci-dma.c
@@ -52,6 +52,9 @@ static int frv_dma_map_sg(struct device *dev, struct scatterlist *sglist,
 	for_each_sg(sglist, sg, nents, i) {
 		vaddr = kmap_atomic_primary(sg_page(sg));
 
+		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
+			continue;
+
 		frv_dcache_writeback((unsigned long) vaddr,
 				     (unsigned long) vaddr + PAGE_SIZE);
 
@@ -70,7 +73,9 @@ static dma_addr_t frv_dma_map_page(struct device *dev, struct page *page,
 		unsigned long offset, size_t size,
 		enum dma_data_direction direction, unsigned long attrs)
 {
-	flush_dcache_page(page);
+	if (!(attr & DMA_ATTR_SKIP_CPU_SYNC))
+		flush_dcache_page(page);
+
 	return (dma_addr_t) page_to_phys(page) + offset;
 }
 

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[net-next PATCH RFC 00/26] Add support for DMA writable pages being  writable by the network stack Alexander Duyck <alexander.h.duyck@intel.com> - 2016-10-24 20:10 +0200
  [net-next PATCH RFC 26/26] igb: Revert "igb: Revert support for  build_skb in igb" Alexander Duyck <alexander.h.duyck@intel.com> - 2016-10-24 20:10 +0200
  [net-next PATCH RFC 07/26] arch/c6x: Add option to skip sync on DMA  map and unmap Alexander Duyck <alexander.h.duyck@intel.com> - 2016-10-24 20:10 +0200
  [net-next PATCH RFC 10/26] arch/m68k: Add option to skip DMA sync  as a part of mapping Alexander Duyck <alexander.h.duyck@intel.com> - 2016-10-24 20:10 +0200
  [net-next PATCH RFC 13/26] arch/mips: Add option to skip DMA sync  as a part of map and unmap Alexander Duyck <alexander.h.duyck@intel.com> - 2016-10-24 20:10 +0200
  [net-next PATCH RFC 12/26] arch/microblaze: Add option to skip DMA  sync as a part of map and unmap Alexander Duyck <alexander.h.duyck@intel.com> - 2016-10-24 20:10 +0200
  Re: [net-next PATCH RFC 01/26] swiotlb: Drop unused function  swiotlb_map_sg Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> - 2016-10-24 20:20 +0200
  [net-next PATCH RFC 02/26] swiotlb: Add support for  DMA_ATTR_SKIP_CPU_SYNC Alexander Duyck <alexander.h.duyck@intel.com> - 2016-10-24 20:20 +0200
  [net-next PATCH RFC 01/26] swiotlb: Drop unused function  swiotlb_map_sg Alexander Duyck <alexander.h.duyck@intel.com> - 2016-10-24 20:20 +0200
  [net-next PATCH RFC 09/26] arch/hexagon: Add option to skip DMA  sync as a part of mapping Alexander Duyck <alexander.h.duyck@intel.com> - 2016-10-24 20:20 +0200
  [net-next PATCH RFC 08/26] arch/frv: Add option to skip sync on DMA  map Alexander Duyck <alexander.h.duyck@intel.com> - 2016-10-24 20:20 +0200
  [net-next PATCH RFC 15/26] arch/openrisc: Add option to skip DMA  sync as a part of mapping Alexander Duyck <alexander.h.duyck@intel.com> - 2016-10-24 20:20 +0200
  [net-next PATCH RFC 03/26] arch/arc: Add option to skip sync on DMA  mapping Alexander Duyck <alexander.h.duyck@intel.com> - 2016-10-24 20:20 +0200

csiph-web