Lines Matching refs:buffer

85 	struct system_heap_buffer *buffer = dmabuf->priv;  in system_heap_attach()  local
93 table = dup_sg_table(&buffer->sg_table); in system_heap_attach()
106 mutex_lock(&buffer->lock); in system_heap_attach()
107 list_add(&a->list, &buffer->attachments); in system_heap_attach()
108 mutex_unlock(&buffer->lock); in system_heap_attach()
116 struct system_heap_buffer *buffer = dmabuf->priv; in system_heap_detach() local
119 mutex_lock(&buffer->lock); in system_heap_detach()
121 mutex_unlock(&buffer->lock); in system_heap_detach()
156 struct system_heap_buffer *buffer = dmabuf->priv; in system_heap_dma_buf_begin_cpu_access() local
159 mutex_lock(&buffer->lock); in system_heap_dma_buf_begin_cpu_access()
161 if (buffer->vmap_cnt) in system_heap_dma_buf_begin_cpu_access()
162 invalidate_kernel_vmap_range(buffer->vaddr, buffer->len); in system_heap_dma_buf_begin_cpu_access()
164 list_for_each_entry(a, &buffer->attachments, list) { in system_heap_dma_buf_begin_cpu_access()
169 mutex_unlock(&buffer->lock); in system_heap_dma_buf_begin_cpu_access()
177 struct system_heap_buffer *buffer = dmabuf->priv; in system_heap_dma_buf_end_cpu_access() local
180 mutex_lock(&buffer->lock); in system_heap_dma_buf_end_cpu_access()
182 if (buffer->vmap_cnt) in system_heap_dma_buf_end_cpu_access()
183 flush_kernel_vmap_range(buffer->vaddr, buffer->len); in system_heap_dma_buf_end_cpu_access()
185 list_for_each_entry(a, &buffer->attachments, list) { in system_heap_dma_buf_end_cpu_access()
190 mutex_unlock(&buffer->lock); in system_heap_dma_buf_end_cpu_access()
197 struct system_heap_buffer *buffer = dmabuf->priv; in system_heap_mmap() local
198 struct sg_table *table = &buffer->sg_table; in system_heap_mmap()
217 static void *system_heap_do_vmap(struct system_heap_buffer *buffer) in system_heap_do_vmap() argument
219 struct sg_table *table = &buffer->sg_table; in system_heap_do_vmap()
220 int npages = PAGE_ALIGN(buffer->len) / PAGE_SIZE; in system_heap_do_vmap()
245 struct system_heap_buffer *buffer = dmabuf->priv; in system_heap_vmap() local
249 mutex_lock(&buffer->lock); in system_heap_vmap()
250 if (buffer->vmap_cnt) { in system_heap_vmap()
251 buffer->vmap_cnt++; in system_heap_vmap()
252 iosys_map_set_vaddr(map, buffer->vaddr); in system_heap_vmap()
256 vaddr = system_heap_do_vmap(buffer); in system_heap_vmap()
262 buffer->vaddr = vaddr; in system_heap_vmap()
263 buffer->vmap_cnt++; in system_heap_vmap()
264 iosys_map_set_vaddr(map, buffer->vaddr); in system_heap_vmap()
266 mutex_unlock(&buffer->lock); in system_heap_vmap()
273 struct system_heap_buffer *buffer = dmabuf->priv; in system_heap_vunmap() local
275 mutex_lock(&buffer->lock); in system_heap_vunmap()
276 if (!--buffer->vmap_cnt) { in system_heap_vunmap()
277 vunmap(buffer->vaddr); in system_heap_vunmap()
278 buffer->vaddr = NULL; in system_heap_vunmap()
280 mutex_unlock(&buffer->lock); in system_heap_vunmap()
286 struct system_heap_buffer *buffer = dmabuf->priv; in system_heap_dma_buf_release() local
291 table = &buffer->sg_table; in system_heap_dma_buf_release()
298 kfree(buffer); in system_heap_dma_buf_release()
339 struct system_heap_buffer *buffer; in system_heap_allocate() local
350 buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); in system_heap_allocate()
351 if (!buffer) in system_heap_allocate()
354 INIT_LIST_HEAD(&buffer->attachments); in system_heap_allocate()
355 mutex_init(&buffer->lock); in system_heap_allocate()
356 buffer->heap = heap; in system_heap_allocate()
357 buffer->len = len; in system_heap_allocate()
381 table = &buffer->sg_table; in system_heap_allocate()
395 exp_info.size = buffer->len; in system_heap_allocate()
397 exp_info.priv = buffer; in system_heap_allocate()
415 kfree(buffer); in system_heap_allocate()