History

Merge tag 'tag-for-linus-3.5' of git://git.linaro.org/people/sumitsemwal/linux-dma-buf

Pull dma-buf updates from Sumit Semwal: "Here's the first signed-tag pull request for dma-buf framework. It includes the following key items: - mmap support - vmap support - related documentation updates These are needed by various drivers to allow mmap/vmap of dma-buf shared buffers. Dave Airlie has some prime patches dependent on the vmap pull as well." * tag 'tag-for-linus-3.5' of git://git.linaro.org/people/sumitsemwal/linux-dma-buf: dma-buf: add initial vmap documentation dma-buf: minor documentation fixes. dma-buf: add vmap interface dma-buf: mmap support

Linus Torvalds committed 14 years ago

Commit da89fb12 parents d5adf23 b25b0863 files · +233 −8Browse files

Showing the changes to include (1 of 3 files). Show all

Unified · Split

include/linux/dma-buf.h+33−0
@@ -61,6 +61,13 @@ struct dma_buf_attachment; · 60 unmodified lines
6161 * This Callback must not sleep.
6262 * @kmap: maps a page from the buffer into kernel address space.
6363 * @kunmap: [optional] unmaps a page from the buffer.
64+ * @mmap: used to expose the backing storage to userspace. Note that the
65+ * mapping needs to be coherent - if the exporter doesn't directly
66+ * support this, it needs to fake coherency by shooting down any ptes
67+ * when transitioning away from the cpu domain.
68+ * @vmap: [optional] creates a virtual mapping for the buffer into kernel
69+ * address space. Same restrictions as for vmap and friends apply.
70+ * @vunmap: [optional] unmaps a vmap from the buffer
6471 */
6572 struct dma_buf_ops {
6673 int (*attach)(struct dma_buf *, struct device *,
@@ -92,6 +99,11 @@ struct dma_buf_ops { · 25 unmodified lines
9299 void (*kunmap_atomic)(struct dma_buf *, unsigned long, void *);
93100 void *(*kmap)(struct dma_buf *, unsigned long);
94101 void (*kunmap)(struct dma_buf *, unsigned long, void *);
102+
103+ int (*mmap)(struct dma_buf *, struct vm_area_struct *vma);
104+
105+ void *(*vmap)(struct dma_buf *);
106+ void (*vunmap)(struct dma_buf *, void *vaddr);
95107 };
96108
97109 /**
@@ -167,6 +179,11 @@ void *dma_buf_kmap_atomic(struct dma_buf *, unsigned long); · 69 unmodified lines
167179 void dma_buf_kunmap_atomic(struct dma_buf *, unsigned long, void *);
168180 void *dma_buf_kmap(struct dma_buf *, unsigned long);
169181 void dma_buf_kunmap(struct dma_buf *, unsigned long, void *);
182+
183+int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *,
184+ unsigned long);
185+void *dma_buf_vmap(struct dma_buf *);
186+void dma_buf_vunmap(struct dma_buf *, void *vaddr);
170187 #else
171188
172189 static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
@@ -248,6 +265,22 @@ static inline void dma_buf_kunmap(struct dma_buf *dmabuf, · 75 unmodified lines
248265 unsigned long pnum, void *vaddr)
249266 {
250267 }
268+
269+static inline int dma_buf_mmap(struct dma_buf *dmabuf,
270+ struct vm_area_struct *vma,
271+ unsigned long pgoff)
272+{
273+ return -ENODEV;
274+}
275+
276+static inline void *dma_buf_vmap(struct dma_buf *dmabuf)
277+{
278+ return NULL;
279+}
280+
281+static inline void dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr)
282+{
283+}
251284 #endif /* CONFIG_DMA_SHARED_BUFFER */
252285
253286 #endif /* __DMA_BUF_H__ */