Commit 34f8be79 authored by Alexander Duyck's avatar Alexander Duyck Committed by Linus Torvalds

arch/frv: add option to skip sync on DMA map

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.

Link: http://lkml.kernel.org/r/20161110113447.76501.93160.stgit@ahduyck-blue-test.jf.intel.comSigned-off-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 64c596b5
...@@ -109,16 +109,19 @@ static int frv_dma_map_sg(struct device *dev, struct scatterlist *sglist, ...@@ -109,16 +109,19 @@ static int frv_dma_map_sg(struct device *dev, struct scatterlist *sglist,
int nents, enum dma_data_direction direction, int nents, enum dma_data_direction direction,
unsigned long attrs) unsigned long attrs)
{ {
int i;
struct scatterlist *sg; struct scatterlist *sg;
int i;
BUG_ON(direction == DMA_NONE);
if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
return nents;
for_each_sg(sglist, sg, nents, i) { for_each_sg(sglist, sg, nents, i) {
frv_cache_wback_inv(sg_dma_address(sg), frv_cache_wback_inv(sg_dma_address(sg),
sg_dma_address(sg) + sg_dma_len(sg)); sg_dma_address(sg) + sg_dma_len(sg));
} }
BUG_ON(direction == DMA_NONE);
return nents; return nents;
} }
...@@ -127,7 +130,10 @@ static dma_addr_t frv_dma_map_page(struct device *dev, struct page *page, ...@@ -127,7 +130,10 @@ static dma_addr_t frv_dma_map_page(struct device *dev, struct page *page,
enum dma_data_direction direction, unsigned long attrs) enum dma_data_direction direction, unsigned long attrs)
{ {
BUG_ON(direction == DMA_NONE); BUG_ON(direction == DMA_NONE);
if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
flush_dcache_page(page); flush_dcache_page(page);
return (dma_addr_t) page_to_phys(page) + offset; return (dma_addr_t) page_to_phys(page) + offset;
} }
......
...@@ -40,13 +40,16 @@ static int frv_dma_map_sg(struct device *dev, struct scatterlist *sglist, ...@@ -40,13 +40,16 @@ static int frv_dma_map_sg(struct device *dev, struct scatterlist *sglist,
int nents, enum dma_data_direction direction, int nents, enum dma_data_direction direction,
unsigned long attrs) unsigned long attrs)
{ {
struct scatterlist *sg;
unsigned long dampr2; unsigned long dampr2;
void *vaddr; void *vaddr;
int i; int i;
struct scatterlist *sg;
BUG_ON(direction == DMA_NONE); BUG_ON(direction == DMA_NONE);
if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
return nents;
dampr2 = __get_DAMPR(2); dampr2 = __get_DAMPR(2);
for_each_sg(sglist, sg, nents, i) { for_each_sg(sglist, sg, nents, i) {
...@@ -70,7 +73,9 @@ static dma_addr_t frv_dma_map_page(struct device *dev, struct page *page, ...@@ -70,7 +73,9 @@ static dma_addr_t frv_dma_map_page(struct device *dev, struct page *page,
unsigned long offset, size_t size, unsigned long offset, size_t size,
enum dma_data_direction direction, unsigned long attrs) enum dma_data_direction direction, unsigned long attrs)
{ {
if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
flush_dcache_page(page); flush_dcache_page(page);
return (dma_addr_t) page_to_phys(page) + offset; return (dma_addr_t) page_to_phys(page) + offset;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment