diff options
Diffstat (limited to 'include/linux/dma-buf.h')
-rw-r--r-- | include/linux/dma-buf.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index 3efbfc2145c3..eb48f3816df9 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h | |||
@@ -61,6 +61,13 @@ struct dma_buf_attachment; | |||
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 | */ |
65 | struct dma_buf_ops { | 72 | struct 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 { | |||
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); | |||
167 | void dma_buf_kunmap_atomic(struct dma_buf *, unsigned long, void *); | 179 | void dma_buf_kunmap_atomic(struct dma_buf *, unsigned long, void *); |
168 | void *dma_buf_kmap(struct dma_buf *, unsigned long); | 180 | void *dma_buf_kmap(struct dma_buf *, unsigned long); |
169 | void dma_buf_kunmap(struct dma_buf *, unsigned long, void *); | 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 | #else | 187 | #else |
171 | 188 | ||
172 | static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, | 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, | |||
248 | unsigned long pnum, void *vaddr) | 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 | #endif /* CONFIG_DMA_SHARED_BUFFER */ | 284 | #endif /* CONFIG_DMA_SHARED_BUFFER */ |
252 | 285 | ||
253 | #endif /* __DMA_BUF_H__ */ | 286 | #endif /* __DMA_BUF_H__ */ |