[Linaro-mm-sig] [PATCH 2/3] [RFC] Kernel Virtual Memory allocation issue in dma-mapping framework

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With this define new wrapper functions which enables to pass the new dma attribute to IOMMU ops of dma-mapping framework

diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h

index bbef15d..7fc003a 100644

--- a/arch/arm/include/asm/dma-mapping.h

+++ b/arch/arm/include/asm/dma-mapping.h

@@ -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


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]