From: Abhinav Kochhar <kochhar.abhinav@gmail.com>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: linux-arm-kernel@lists.infradead.org,
linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org,
Kyungmin Park <kyungmin.park@samsung.com>
Subject: [Linaro-mm-sig] [PATCH 2/3] [RFC] Kernel Virtual Memory allocation issue in dma-mapping framework
Date: Fri, 11 May 2012 11:01:58 +0900 [thread overview]
Message-ID: <CALYq+qR=i56xPELGh6Lp9tOY=u-=OZv_Ljh7FMkTPWFC44k5ow@mail.gmail.com> (raw)
In-Reply-To: <CALYq+qSrgKqkENSL6zRaE76oraunyidJmb-KS+JRMBqihMvKLg@mail.gmail.com>
[-- 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 --]
parent reply other threads:[~2012-05-11 2:01 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <CALYq+qSrgKqkENSL6zRaE76oraunyidJmb-KS+JRMBqihMvKLg@mail.gmail.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CALYq+qR=i56xPELGh6Lp9tOY=u-=OZv_Ljh7FMkTPWFC44k5ow@mail.gmail.com' \
--to=kochhar.abhinav@gmail.com \
--cc=kyungmin.park@samsung.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mm@kvack.org \
--cc=m.szyprowski@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox