Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1514020
| From | Alexander Duyck <alexander.h.duyck@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [mm PATCH v2 23/26] dma: Add calls for dma_map_page_attrs and dma_unmap_page_attrs |
| Date | 2016-11-02 18:20 +0100 |
| Message-ID | <sz7mH-J6-65@gated-at.bofh.it> (permalink) |
| References | <sz7mF-J6-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Add support for mapping and unmapping a page with attributes. The primary
use for this is currently to allow for us to pass the
DMA_ATTR_SKIP_CPU_SYNC attribute when mapping and unmapping a page. On
some architectures such as ARM the synchronization has significant overhead
and if we are already taking care of the sync_for_cpu and sync_for_device
from the driver there isn't much need to handle this in the map/unmap calls
as well.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
include/linux/dma-mapping.h | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 08528af..10c5a17 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -243,29 +243,33 @@ static inline void dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg
ops->unmap_sg(dev, sg, nents, dir, attrs);
}
-static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
- size_t offset, size_t size,
- enum dma_data_direction dir)
+static inline dma_addr_t dma_map_page_attrs(struct device *dev,
+ struct page *page,
+ size_t offset, size_t size,
+ enum dma_data_direction dir,
+ unsigned long attrs)
{
struct dma_map_ops *ops = get_dma_ops(dev);
dma_addr_t addr;
kmemcheck_mark_initialized(page_address(page) + offset, size);
BUG_ON(!valid_dma_direction(dir));
- addr = ops->map_page(dev, page, offset, size, dir, 0);
+ addr = ops->map_page(dev, page, offset, size, dir, attrs);
debug_dma_map_page(dev, page, offset, size, dir, addr, false);
return addr;
}
-static inline void dma_unmap_page(struct device *dev, dma_addr_t addr,
- size_t size, enum dma_data_direction dir)
+static inline void dma_unmap_page_attrs(struct device *dev,
+ dma_addr_t addr, size_t size,
+ enum dma_data_direction dir,
+ unsigned long attrs)
{
struct dma_map_ops *ops = get_dma_ops(dev);
BUG_ON(!valid_dma_direction(dir));
if (ops->unmap_page)
- ops->unmap_page(dev, addr, size, dir, 0);
+ ops->unmap_page(dev, addr, size, dir, attrs);
debug_dma_unmap_page(dev, addr, size, dir, false);
}
@@ -385,6 +389,8 @@ static inline void dma_sync_single_range_for_device(struct device *dev,
#define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, 0)
#define dma_map_sg(d, s, n, r) dma_map_sg_attrs(d, s, n, r, 0)
#define dma_unmap_sg(d, s, n, r) dma_unmap_sg_attrs(d, s, n, r, 0)
+#define dma_map_page(d, p, o, s, r) dma_map_page_attrs(d, p, o, s, r, 0)
+#define dma_unmap_page(d, a, s, r) dma_unmap_page_attrs(d, a, s, r, 0)
extern int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
void *cpu_addr, dma_addr_t dma_addr, size_t size);
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[mm PATCH v2 00/26] Add support for DMA writable pages being writable by the network stack Alexander Duyck <alexander.h.duyck@intel.com> - 2016-11-02 18:20 +0100
[mm PATCH v2 01/26] swiotlb: Drop unused functions swiotlb_map_sg and swiotlb_unmap_sg Alexander Duyck <alexander.h.duyck@intel.com> - 2016-11-02 18:20 +0100
Re: [mm PATCH v2 01/26] swiotlb: Drop unused functions swiotlb_map_sg and swiotlb_unmap_sg Christoph Hellwig <hch@infradead.org> - 2016-11-03 15:20 +0100
Re: [mm PATCH v2 01/26] swiotlb: Drop unused functions swiotlb_map_sg and swiotlb_unmap_sg Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> - 2016-11-03 15:40 +0100
Re: [mm PATCH v2 01/26] swiotlb: Drop unused functions swiotlb_map_sg and swiotlb_unmap_sg Christoph Hellwig <hch@infradead.org> - 2016-11-03 15:50 +0100
RE: [mm PATCH v2 01/26] swiotlb: Drop unused functions swiotlb_map_sg and swiotlb_unmap_sg "Duyck, Alexander H" <alexander.h.duyck@intel.com> - 2016-11-03 16:10 +0100
[mm PATCH v2 06/26] arch/avr32: Add option to skip sync on DMA map Alexander Duyck <alexander.h.duyck@intel.com> - 2016-11-02 18:20 +0100
[mm PATCH v2 23/26] dma: Add calls for dma_map_page_attrs and dma_unmap_page_attrs Alexander Duyck <alexander.h.duyck@intel.com> - 2016-11-02 18:20 +0100
[mm PATCH v2 21/26] arch/tile: Add option to skip DMA sync as a part of map and unmap Alexander Duyck <alexander.h.duyck@intel.com> - 2016-11-02 18:20 +0100
[mm PATCH v2 04/26] arch/arc: Add option to skip sync on DMA mapping Alexander Duyck <alexander.h.duyck@intel.com> - 2016-11-02 18:20 +0100
[mm PATCH v2 09/26] arch/frv: Add option to skip sync on DMA map Alexander Duyck <alexander.h.duyck@intel.com> - 2016-11-02 18:20 +0100
[mm PATCH v2 26/26] igb: Update code to better handle incrementing page count Alexander Duyck <alexander.h.duyck@intel.com> - 2016-11-02 18:20 +0100
[mm PATCH v2 12/26] arch/metag: Add option to skip DMA sync as a part of map and unmap Alexander Duyck <alexander.h.duyck@intel.com> - 2016-11-02 18:20 +0100
[mm PATCH v2 08/26] arch/c6x: Add option to skip sync on DMA map and unmap Alexander Duyck <alexander.h.duyck@intel.com> - 2016-11-02 18:20 +0100
[mm PATCH v2 24/26] mm: Add support for releasing multiple instances of a page Alexander Duyck <alexander.h.duyck@intel.com> - 2016-11-02 18:20 +0100
[mm PATCH v2 16/26] arch/openrisc: Add option to skip DMA sync as a part of mapping Alexander Duyck <alexander.h.duyck@intel.com> - 2016-11-02 18:20 +0100
[mm PATCH v2 13/26] arch/microblaze: Add option to skip DMA sync as a part of map and unmap Alexander Duyck <alexander.h.duyck@intel.com> - 2016-11-02 18:30 +0100
csiph-web