diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2016-12-14 18:04:55 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-14 19:04:07 -0500 |
commit | 98ac2fc274e07a22bea43682cf8998f47ffea9d0 (patch) | |
tree | 4ddf06f30ac96c18d67dfe4789e1121a4c6b7a24 /arch/microblaze | |
parent | 38bdbdc7e391f5326a9f27f0bc8be0c175a73567 (diff) |
arch/microblaze: add option to skip DMA sync as a part of map and unmap
This change allows us to pass DMA_ATTR_SKIP_CPU_SYNC which allows us to
avoid invoking cache line invalidation if the driver will just handle it
via a sync_for_cpu or sync_for_device call.
Link: http://lkml.kernel.org/r/20161110113508.76501.77583.stgit@ahduyck-blue-test.jf.intel.com
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Cc: Michal Simek <monstr@monstr.eu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/microblaze')
-rw-r--r-- | arch/microblaze/kernel/dma.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c index ec04dc1e2527..818daf230eb4 100644 --- a/arch/microblaze/kernel/dma.c +++ b/arch/microblaze/kernel/dma.c | |||
@@ -61,6 +61,10 @@ static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, | |||
61 | /* FIXME this part of code is untested */ | 61 | /* FIXME this part of code is untested */ |
62 | for_each_sg(sgl, sg, nents, i) { | 62 | for_each_sg(sgl, sg, nents, i) { |
63 | sg->dma_address = sg_phys(sg); | 63 | sg->dma_address = sg_phys(sg); |
64 | |||
65 | if (attrs & DMA_ATTR_SKIP_CPU_SYNC) | ||
66 | continue; | ||
67 | |||
64 | __dma_sync(page_to_phys(sg_page(sg)) + sg->offset, | 68 | __dma_sync(page_to_phys(sg_page(sg)) + sg->offset, |
65 | sg->length, direction); | 69 | sg->length, direction); |
66 | } | 70 | } |
@@ -80,7 +84,8 @@ static inline dma_addr_t dma_direct_map_page(struct device *dev, | |||
80 | enum dma_data_direction direction, | 84 | enum dma_data_direction direction, |
81 | unsigned long attrs) | 85 | unsigned long attrs) |
82 | { | 86 | { |
83 | __dma_sync(page_to_phys(page) + offset, size, direction); | 87 | if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC)) |
88 | __dma_sync(page_to_phys(page) + offset, size, direction); | ||
84 | return page_to_phys(page) + offset; | 89 | return page_to_phys(page) + offset; |
85 | } | 90 | } |
86 | 91 | ||
@@ -95,7 +100,8 @@ static inline void dma_direct_unmap_page(struct device *dev, | |||
95 | * phys_to_virt is here because in __dma_sync_page is __virt_to_phys and | 100 | * phys_to_virt is here because in __dma_sync_page is __virt_to_phys and |
96 | * dma_address is physical address | 101 | * dma_address is physical address |
97 | */ | 102 | */ |
98 | __dma_sync(dma_address, size, direction); | 103 | if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC)) |
104 | __dma_sync(dma_address, size, direction); | ||
99 | } | 105 | } |
100 | 106 | ||
101 | static inline void | 107 | static inline void |