* [Linaro-mm-sig] [PATCH 2/3] [RFC] Kernel Virtual Memory allocation issue in dma-mapping framework
[not found] <CALYq+qSrgKqkENSL6zRaE76oraunyidJmb-KS+JRMBqihMvKLg@mail.gmail.com>
@ 2012-05-11 2:01 ` Abhinav Kochhar
0 siblings, 0 replies; only message in thread
From: Abhinav Kochhar @ 2012-05-11 2:01 UTC (permalink / raw)
To: Marek Szyprowski; +Cc: linux-arm-kernel, linaro-mm-sig, linux-mm, Kyungmin Park
[-- Attachment #1: Type: text/plain, Size: 2672 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 3161 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-05-11 2:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CALYq+qSrgKqkENSL6zRaE76oraunyidJmb-KS+JRMBqihMvKLg@mail.gmail.com>
2012-05-11 2:01 ` [Linaro-mm-sig] [PATCH 2/3] [RFC] Kernel Virtual Memory allocation issue in dma-mapping framework Abhinav Kochhar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox