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
61 * This Callback must not sleep.61 * This Callback must not sleep.
62 * @kmap: maps a page from the buffer into kernel address space.62 * @kmap: maps a page from the buffer into kernel address space.
63 * @kunmap: [optional] unmaps a page from the buffer.63 * @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
64 */71 */
65struct dma_buf_ops {72struct dma_buf_ops {
66 int (*attach)(struct dma_buf *, struct device *,73 int (*attach)(struct dma_buf *, struct device *,
@@ -92,6 +99,11 @@ struct dma_buf_ops { · 25 unmodified lines
92 void (*kunmap_atomic)(struct dma_buf *, unsigned long, void *);99 void (*kunmap_atomic)(struct dma_buf *, unsigned long, void *);
93 void *(*kmap)(struct dma_buf *, unsigned long);100 void *(*kmap)(struct dma_buf *, unsigned long);
94 void (*kunmap)(struct dma_buf *, unsigned long, void *);101 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);
95};107};
96 108
97/**109/**
@@ -167,6 +179,11 @@ void *dma_buf_kmap_atomic(struct dma_buf *, unsigned long); · 69 unmodified lines
167void dma_buf_kunmap_atomic(struct dma_buf *, unsigned long, void *);179void dma_buf_kunmap_atomic(struct dma_buf *, unsigned long, void *);
168void *dma_buf_kmap(struct dma_buf *, unsigned long);180void *dma_buf_kmap(struct dma_buf *, unsigned long);
169void dma_buf_kunmap(struct dma_buf *, unsigned long, void *);181void dma_buf_kunmap(struct dma_buf *, unsigned long, void *);
182
183int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *,
184 unsigned long);
185void *dma_buf_vmap(struct dma_buf *);
186void dma_buf_vunmap(struct dma_buf *, void *vaddr);
170#else187#else
171 188
172static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,189static 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
248 unsigned long pnum, void *vaddr)265 unsigned long pnum, void *vaddr)
249{266{
250}267}
268
269static 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
276static inline void *dma_buf_vmap(struct dma_buf *dmabuf)
277{
278 return NULL;
279}
280
281static inline void dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr)
282{
283}
251#endif /* CONFIG_DMA_SHARED_BUFFER */284#endif /* CONFIG_DMA_SHARED_BUFFER */
252 285
253#endif /* __DMA_BUF_H__ */286#endif /* __DMA_BUF_H__ */