diff options
author | Vandana Salve <vsalve@nvidia.com> | 2013-11-21 16:41:15 +0530 |
---|---|---|
committer | Hiroshi Doyu <hdoyu@nvidia.com> | 2013-11-28 23:01:33 -0800 |
commit | f5427b266fe43a53997dcaf7ec19b5e87a84033a (patch) | |
tree | e53ef470660397b76436b17b2137a40f12cbec9a /include/asm-generic | |
parent | e4cde18e622451d86bd9fd8df24ede94f347bde0 (diff) |
base: dma-coherent: add dma exact size alloc/release functions
Add functions dma_alloc_from_coherent_attr and
dma_release_from_coherent_attr. use attribute
DMA_ATTR_ALLOC_EXACT_SIZE to allocate/release
memory of exact size rather than order of 2^pages to
reduce internal fragmentation
bug 1380639
Change-Id: Ia7f560bf94960dfa9570f5be597f7f25b49150e1
Signed-off-by: Vandana Salve <vsalve@nvidia.com>
Reviewed-on: http://git-master/r/333986
Reviewed-by: Hiroshi Doyu <hdoyu@nvidia.com>
Tested-by: Hiroshi Doyu <hdoyu@nvidia.com>
Diffstat (limited to 'include/asm-generic')
-rw-r--r-- | include/asm-generic/dma-coherent.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/include/asm-generic/dma-coherent.h b/include/asm-generic/dma-coherent.h index 2be8a2dbc868..c28cb3576f45 100644 --- a/include/asm-generic/dma-coherent.h +++ b/include/asm-generic/dma-coherent.h @@ -6,9 +6,15 @@ * These three functions are only for dma allocator. * Don't use them in device drivers. */ -int dma_alloc_from_coherent(struct device *dev, ssize_t size, - dma_addr_t *dma_handle, void **ret); -int dma_release_from_coherent(struct device *dev, int order, void *vaddr); +int dma_alloc_from_coherent_attr(struct device *dev, ssize_t size, + dma_addr_t *dma_handle, void **ret, + struct dma_attrs *attrs); +int dma_release_from_coherent_attr(struct device *dev, size_t size, void *vaddr, + struct dma_attrs *attrs); +#define dma_alloc_from_coherent(d, s, h, r) \ + dma_alloc_from_coherent_attr(d, s, h, r, NULL) +#define dma_release_from_coherent(d, s, v) \ + dma_release_from_coherent_attr(d, s, v, NULL) int dma_mmap_from_coherent(struct device *dev, struct vm_area_struct *vma, void *cpu_addr, size_t size, int *ret); @@ -27,6 +33,8 @@ extern void * dma_mark_declared_memory_occupied(struct device *dev, dma_addr_t device_addr, size_t size); #else +#define dma_alloc_from_coherent_attr(dev, size, handle, ret, attr) (0) +#define dma_release_from_coherent_attr(dev, size, vaddr, attr) (0) #define dma_alloc_from_coherent(dev, size, handle, ret) (0) #define dma_release_from_coherent(dev, order, vaddr) (0) #define dma_mmap_from_coherent(dev, vma, vaddr, order, ret) (0) |