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
Showing the changes to include (1 of 3 files). Show all
Unified · Split
| @@ -61,6 +61,13 @@ struct dma_buf_attachment; · 60 unmodified lines | ||
| 61 | 61 | * This Callback must not sleep. |
| 62 | 62 | * @kmap: maps a page from the buffer into kernel address space. |
| 63 | 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 | */ |
| 65 | 72 | struct dma_buf_ops { |
| 66 | 73 | int (*attach)(struct dma_buf *, struct device *, |
| @@ -92,6 +99,11 @@ struct dma_buf_ops { · 25 unmodified lines | ||
| 92 | 99 | void (*kunmap_atomic)(struct dma_buf *, unsigned long, void *); |
| 93 | 100 | void *(*kmap)(struct dma_buf *, unsigned long); |
| 94 | 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 | ||
| 167 | 179 | void dma_buf_kunmap_atomic(struct dma_buf *, unsigned long, void *); |
| 168 | 180 | void *dma_buf_kmap(struct dma_buf *, unsigned long); |
| 169 | 181 | 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); | |
| 170 | 187 | #else |
| 171 | 188 | |
| 172 | 189 | 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 | ||
| 248 | 265 | unsigned long pnum, void *vaddr) |
| 249 | 266 | { |
| 250 | 267 | } |
| 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 | +} | |
| 251 | 284 | #endif /* CONFIG_DMA_SHARED_BUFFER */ |
| 252 | 285 | |
| 253 | 286 | #endif /* __DMA_BUF_H__ */ |