@@ -14,6 +14,12 @@
#define DMA_ERROR_CODE (~0)
extern struct dma_map_ops arm_dma_ops;
+struct page_infodma {
+ struct page **pages;
+ unsigned long nr_pages;
+ unsigned long shared;
+};
+
static inline struct dma_map_ops *get_dma_ops(struct device *dev)
{
if (dev && dev->archdata.dma_ops)
@@ -205,6 +211,14 @@ static inline void *dma_alloc_writecombine(struct device *dev, size_t size,
return dma_alloc_attrs(dev, size, dma_handle, flag, &attrs);
}
+static inline void *dma_alloc_writecombine_user(struct device *dev, size_t size,
+ dma_addr_t *dma_handle, gfp_t flag)
+{
+ DEFINE_DMA_ATTRS(attrs);
+ dma_set_attr(DMA_ATTR_USER_SPACE, &attrs);
+ return dma_alloc_attrs(dev, size, dma_handle, flag, &attrs);
+}
+
static inline void dma_free_writecombine(struct device *dev, size_t size,
void *cpu_addr, dma_addr_t dma_handle)
{
@@ -213,6 +227,14 @@ static inline void dma_free_writecombine(struct device *dev, size_t size,
return dma_free_attrs(dev, size, cpu_addr, dma_handle, &attrs);
}
+static inline void dma_free_writecombine_user(struct device *dev, size_t size,
+ void *cpu_addr, dma_addr_t dma_handle)
+{
+ DEFINE_DMA_ATTRS(attrs);
+ dma_set_attr(DMA_ATTR_USER_SPACE, &attrs);
+ return dma_free_attrs(dev, size, cpu_addr, dma_handle, &attrs);
+}
+
static inline int dma_mmap_writecombine(struct device *dev, struct vm_area_struct *vma,
void *cpu_addr, dma_addr_t dma_addr, size_t size)
{
@@ -221,6 +243,14 @@ static inline int dma_mmap_writecombine(struct device *dev, struct vm_area_struc
return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs);
}
+static inline int dma_mmap_writecombine_user(struct device *dev, struct vm_area_struct *vma,
+ void *cpu_addr, dma_addr_t dma_addr, size_t size)
+{
+ DEFINE_DMA_ATTRS(attrs);
+ dma_set_attr(DMA_ATTR_USER_SPACE, &attrs);
+ return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs);
+}
+
/*
* This can be called during boot to increase the size of the consistent
* DMA region above it's default value of 2MB. It must be called before the
With these new functions the drivers can pass the new dma attribute to IOMMU ops of dma mapping framework to differentiate between kernel and user space allocations. Signed-off-by: Abhinav <abhinav.k@samsung.com> --- arch/arm/include/asm/dma-mapping.h | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-) -- 1.7.0.4