Lines Matching +full:sig +full:- +full:dir +full:- +full:cmd
1 // SPDX-License-Identifier: GPL-2.0-only
8 * Many thanks to linaro-mm-sig list, and specially
16 #include <linux/dma-buf.h>
17 #include <linux/dma-fence.h>
24 #include <linux/dma-resv.h>
29 #include <uapi/linux/dma-buf.h>
32 #include "dma-buf-sysfs-stats.h"
49 dmabuf = dentry->d_fsdata; in dmabuffs_dname()
50 spin_lock(&dmabuf->name_lock); in dmabuffs_dname()
51 if (dmabuf->name) in dmabuffs_dname()
52 ret = strlcpy(name, dmabuf->name, DMA_BUF_NAME_LEN); in dmabuffs_dname()
53 spin_unlock(&dmabuf->name_lock); in dmabuffs_dname()
56 dentry->d_name.name, ret > 0 ? name : ""); in dmabuffs_dname()
63 dmabuf = dentry->d_fsdata; in dma_buf_release()
67 BUG_ON(dmabuf->vmapping_counter); in dma_buf_release()
70 * Any fences that a dma-buf poll can wait on should be signaled in dma_buf_release()
71 * before releasing dma-buf. This is the responsibility of each in dma_buf_release()
75 * dma-buf while still having pending operation to the buffer. in dma_buf_release()
77 BUG_ON(dmabuf->cb_shared.active || dmabuf->cb_excl.active); in dma_buf_release()
80 dmabuf->ops->release(dmabuf); in dma_buf_release()
82 if (dmabuf->resv == (struct dma_resv *)&dmabuf[1]) in dma_buf_release()
83 dma_resv_fini(dmabuf->resv); in dma_buf_release()
85 module_put(dmabuf->owner); in dma_buf_release()
86 kfree(dmabuf->name); in dma_buf_release()
95 return -EINVAL; in dma_buf_file_release()
97 dmabuf = file->private_data; in dma_buf_file_release()
100 list_del(&dmabuf->list_node); in dma_buf_file_release()
119 return -ENOMEM; in dma_buf_fs_init_context()
120 ctx->dops = &dma_buf_dentry_ops; in dma_buf_fs_init_context()
135 return -EINVAL; in dma_buf_mmap_internal()
137 dmabuf = file->private_data; in dma_buf_mmap_internal()
140 if (!dmabuf->ops->mmap) in dma_buf_mmap_internal()
141 return -EINVAL; in dma_buf_mmap_internal()
144 if (vma->vm_pgoff + vma_pages(vma) > in dma_buf_mmap_internal()
145 dmabuf->size >> PAGE_SHIFT) in dma_buf_mmap_internal()
146 return -EINVAL; in dma_buf_mmap_internal()
148 return dmabuf->ops->mmap(dmabuf, vma); in dma_buf_mmap_internal()
157 return -EBADF; in dma_buf_llseek()
159 dmabuf = file->private_data; in dma_buf_llseek()
165 base = dmabuf->size; in dma_buf_llseek()
169 return -EINVAL; in dma_buf_llseek()
172 return -EINVAL; in dma_buf_llseek()
180 * To support cross-device and cross-driver synchronization of buffer access
188 * - Checking for EPOLLIN, i.e. read access, can be use to query the state of the
191 * - Checking for EPOLLOUT, i.e. write access, can be used to query the state of
204 spin_lock_irqsave(&dcb->poll->lock, flags); in dma_buf_poll_cb()
205 wake_up_locked_poll(dcb->poll, dcb->active); in dma_buf_poll_cb()
206 dcb->active = 0; in dma_buf_poll_cb()
207 spin_unlock_irqrestore(&dcb->poll->lock, flags); in dma_buf_poll_cb()
219 dmabuf = file->private_data; in dma_buf_poll()
220 if (!dmabuf || !dmabuf->resv) in dma_buf_poll()
223 resv = dmabuf->resv; in dma_buf_poll()
225 poll_wait(file, &dmabuf->poll, poll); in dma_buf_poll()
232 seq = read_seqcount_begin(&resv->seq); in dma_buf_poll()
235 fobj = rcu_dereference(resv->fence); in dma_buf_poll()
237 shared_count = fobj->shared_count; in dma_buf_poll()
241 if (read_seqcount_retry(&resv->seq, seq)) { in dma_buf_poll()
247 struct dma_buf_poll_cb_t *dcb = &dmabuf->cb_excl; in dma_buf_poll()
253 spin_lock_irq(&dmabuf->poll.lock); in dma_buf_poll()
254 if (dcb->active) { in dma_buf_poll()
255 dcb->active |= pevents; in dma_buf_poll()
258 dcb->active = pevents; in dma_buf_poll()
259 spin_unlock_irq(&dmabuf->poll.lock); in dma_buf_poll()
265 dma_buf_poll_cb(NULL, &dcb->cb); in dma_buf_poll()
266 } else if (!dma_fence_add_callback(fence_excl, &dcb->cb, in dma_buf_poll()
276 dma_buf_poll_cb(NULL, &dcb->cb); in dma_buf_poll()
282 struct dma_buf_poll_cb_t *dcb = &dmabuf->cb_shared; in dma_buf_poll()
286 spin_lock_irq(&dmabuf->poll.lock); in dma_buf_poll()
287 if (dcb->active) in dma_buf_poll()
290 dcb->active = EPOLLOUT; in dma_buf_poll()
291 spin_unlock_irq(&dmabuf->poll.lock); in dma_buf_poll()
297 struct dma_fence *fence = rcu_dereference(fobj->shared[i]); in dma_buf_poll()
307 dma_buf_poll_cb(NULL, &dcb->cb); in dma_buf_poll()
310 if (!dma_fence_add_callback(fence, &dcb->cb, in dma_buf_poll()
321 dma_buf_poll_cb(NULL, &dcb->cb); in dma_buf_poll()
330 * dma_buf_set_name - Set a name to a specific dma_buf to track the usage.
331 * The name of the dma-buf buffer can only be set when the dma-buf is not
333 * name of the dma-buf if the same piece of memory is used for multiple
338 * the dma-buf.
340 * Returns 0 on success. If the dma-buf buffer is already attached to
341 * devices, return -EBUSY.
352 dma_resv_lock(dmabuf->resv, NULL); in dma_buf_set_name()
353 if (!list_empty(&dmabuf->attachments)) { in dma_buf_set_name()
354 ret = -EBUSY; in dma_buf_set_name()
358 spin_lock(&dmabuf->name_lock); in dma_buf_set_name()
359 kfree(dmabuf->name); in dma_buf_set_name()
360 dmabuf->name = name; in dma_buf_set_name()
361 spin_unlock(&dmabuf->name_lock); in dma_buf_set_name()
364 dma_resv_unlock(dmabuf->resv); in dma_buf_set_name()
369 unsigned int cmd, unsigned long arg) in dma_buf_ioctl() argument
376 dmabuf = file->private_data; in dma_buf_ioctl()
378 switch (cmd) { in dma_buf_ioctl()
381 return -EFAULT; in dma_buf_ioctl()
384 return -EINVAL; in dma_buf_ioctl()
397 return -EINVAL; in dma_buf_ioctl()
412 return -ENOTTY; in dma_buf_ioctl()
418 struct dma_buf *dmabuf = file->private_data; in dma_buf_show_fdinfo()
420 seq_printf(m, "size:\t%zu\n", dmabuf->size); in dma_buf_show_fdinfo()
422 seq_printf(m, "count:\t%ld\n", file_count(dmabuf->file) - 1); in dma_buf_show_fdinfo()
423 seq_printf(m, "exp_name:\t%s\n", dmabuf->exp_name); in dma_buf_show_fdinfo()
424 spin_lock(&dmabuf->name_lock); in dma_buf_show_fdinfo()
425 if (dmabuf->name) in dma_buf_show_fdinfo()
426 seq_printf(m, "name:\t%s\n", dmabuf->name); in dma_buf_show_fdinfo()
427 spin_unlock(&dmabuf->name_lock); in dma_buf_show_fdinfo()
441 * is_dma_buf_file - Check if struct file* is associated with dma_buf
445 return file->f_op == &dma_buf_fops; in is_dma_buf_file()
451 struct inode *inode = alloc_anon_inode(dma_buf_mnt->mnt_sb); in dma_buf_getfile()
456 inode->i_size = dmabuf->size; in dma_buf_getfile()
457 inode_set_bytes(inode, dmabuf->size); in dma_buf_getfile()
463 file->f_flags = flags & (O_ACCMODE | O_NONBLOCK); in dma_buf_getfile()
464 file->private_data = dmabuf; in dma_buf_getfile()
465 file->f_path.dentry->d_fsdata = dmabuf; in dma_buf_getfile()
485 * 2. Userspace passes this file-descriptors to all drivers it wants this buffer
506 * dma_buf_export - Creates a new dma_buf, and associates an anon file
526 struct dma_resv *resv = exp_info->resv; in dma_buf_export()
531 if (!exp_info->resv) in dma_buf_export()
534 /* prevent &dma_buf[1] == dma_buf->resv */ in dma_buf_export()
537 if (WARN_ON(!exp_info->priv in dma_buf_export()
538 || !exp_info->ops in dma_buf_export()
539 || !exp_info->ops->map_dma_buf in dma_buf_export()
540 || !exp_info->ops->unmap_dma_buf in dma_buf_export()
541 || !exp_info->ops->release)) { in dma_buf_export()
542 return ERR_PTR(-EINVAL); in dma_buf_export()
545 if (WARN_ON(exp_info->ops->cache_sgt_mapping && in dma_buf_export()
546 (exp_info->ops->pin || exp_info->ops->unpin))) in dma_buf_export()
547 return ERR_PTR(-EINVAL); in dma_buf_export()
549 if (WARN_ON(!exp_info->ops->pin != !exp_info->ops->unpin)) in dma_buf_export()
550 return ERR_PTR(-EINVAL); in dma_buf_export()
552 if (!try_module_get(exp_info->owner)) in dma_buf_export()
553 return ERR_PTR(-ENOENT); in dma_buf_export()
557 ret = -ENOMEM; in dma_buf_export()
561 dmabuf->priv = exp_info->priv; in dma_buf_export()
562 dmabuf->ops = exp_info->ops; in dma_buf_export()
563 dmabuf->size = exp_info->size; in dma_buf_export()
564 dmabuf->exp_name = exp_info->exp_name; in dma_buf_export()
565 dmabuf->owner = exp_info->owner; in dma_buf_export()
566 spin_lock_init(&dmabuf->name_lock); in dma_buf_export()
567 init_waitqueue_head(&dmabuf->poll); in dma_buf_export()
568 dmabuf->cb_excl.poll = dmabuf->cb_shared.poll = &dmabuf->poll; in dma_buf_export()
569 dmabuf->cb_excl.active = dmabuf->cb_shared.active = 0; in dma_buf_export()
575 dmabuf->resv = resv; in dma_buf_export()
577 file = dma_buf_getfile(dmabuf, exp_info->flags); in dma_buf_export()
583 file->f_mode |= FMODE_LSEEK; in dma_buf_export()
584 dmabuf->file = file; in dma_buf_export()
590 mutex_init(&dmabuf->lock); in dma_buf_export()
591 INIT_LIST_HEAD(&dmabuf->attachments); in dma_buf_export()
594 list_add(&dmabuf->list_node, &db_list.head); in dma_buf_export()
601 * Set file->f_path.dentry->d_fsdata to NULL so that when in dma_buf_export()
605 file->f_path.dentry->d_fsdata = NULL; in dma_buf_export()
610 module_put(exp_info->owner); in dma_buf_export()
616 * dma_buf_fd - returns a file descriptor for the given struct dma_buf
626 if (!dmabuf || !dmabuf->file) in dma_buf_fd()
627 return -EINVAL; in dma_buf_fd()
633 fd_install(fd, dmabuf->file); in dma_buf_fd()
640 * dma_buf_get - returns the struct dma_buf related to an fd
654 return ERR_PTR(-EBADF); in dma_buf_get()
658 return ERR_PTR(-EINVAL); in dma_buf_get()
661 return file->private_data; in dma_buf_get()
666 * dma_buf_put - decreases refcount of the buffer
677 if (WARN_ON(!dmabuf || !dmabuf->file)) in dma_buf_put()
680 fput(dmabuf->file); in dma_buf_put()
695 sg->page_link ^= ~0xffUL; in mangle_sg_table()
704 sg_table = attach->dmabuf->ops->map_dma_buf(attach, direction); in __map_dma_buf()
713 * dma_buf_dynamic_attach - Add the device to dma_buf's attachments list
722 * Optionally this calls &dma_buf_ops.attach to allow device-specific attach
732 * indicated with the error code -EBUSY.
743 return ERR_PTR(-EINVAL); in dma_buf_dynamic_attach()
745 if (WARN_ON(importer_ops && !importer_ops->move_notify)) in dma_buf_dynamic_attach()
746 return ERR_PTR(-EINVAL); in dma_buf_dynamic_attach()
750 return ERR_PTR(-ENOMEM); in dma_buf_dynamic_attach()
752 attach->dev = dev; in dma_buf_dynamic_attach()
753 attach->dmabuf = dmabuf; in dma_buf_dynamic_attach()
755 attach->peer2peer = importer_ops->allow_peer2peer; in dma_buf_dynamic_attach()
756 attach->importer_ops = importer_ops; in dma_buf_dynamic_attach()
757 attach->importer_priv = importer_priv; in dma_buf_dynamic_attach()
759 if (dmabuf->ops->attach) { in dma_buf_dynamic_attach()
760 ret = dmabuf->ops->attach(dmabuf, attach); in dma_buf_dynamic_attach()
764 dma_resv_lock(dmabuf->resv, NULL); in dma_buf_dynamic_attach()
765 list_add(&attach->node, &dmabuf->attachments); in dma_buf_dynamic_attach()
766 dma_resv_unlock(dmabuf->resv); in dma_buf_dynamic_attach()
776 if (dma_buf_is_dynamic(attach->dmabuf)) { in dma_buf_dynamic_attach()
777 dma_resv_lock(attach->dmabuf->resv, NULL); in dma_buf_dynamic_attach()
778 ret = dmabuf->ops->pin(attach); in dma_buf_dynamic_attach()
785 sgt = ERR_PTR(-ENOMEM); in dma_buf_dynamic_attach()
790 if (dma_buf_is_dynamic(attach->dmabuf)) in dma_buf_dynamic_attach()
791 dma_resv_unlock(attach->dmabuf->resv); in dma_buf_dynamic_attach()
792 attach->sgt = sgt; in dma_buf_dynamic_attach()
793 attach->dir = DMA_BIDIRECTIONAL; in dma_buf_dynamic_attach()
803 if (dma_buf_is_dynamic(attach->dmabuf)) in dma_buf_dynamic_attach()
804 dmabuf->ops->unpin(attach); in dma_buf_dynamic_attach()
807 if (dma_buf_is_dynamic(attach->dmabuf)) in dma_buf_dynamic_attach()
808 dma_resv_unlock(attach->dmabuf->resv); in dma_buf_dynamic_attach()
816 * dma_buf_attach - Wrapper for dma_buf_dynamic_attach
837 attach->dmabuf->ops->unmap_dma_buf(attach, sg_table, direction); in __unmap_dma_buf()
841 * dma_buf_detach - Remove the given attachment from dmabuf's attachments list
847 * Optionally this calls &dma_buf_ops.detach for device-specific detach.
854 if (attach->sgt) { in dma_buf_detach()
855 if (dma_buf_is_dynamic(attach->dmabuf)) in dma_buf_detach()
856 dma_resv_lock(attach->dmabuf->resv, NULL); in dma_buf_detach()
858 __unmap_dma_buf(attach, attach->sgt, attach->dir); in dma_buf_detach()
860 if (dma_buf_is_dynamic(attach->dmabuf)) { in dma_buf_detach()
861 dmabuf->ops->unpin(attach); in dma_buf_detach()
862 dma_resv_unlock(attach->dmabuf->resv); in dma_buf_detach()
866 dma_resv_lock(dmabuf->resv, NULL); in dma_buf_detach()
867 list_del(&attach->node); in dma_buf_detach()
868 dma_resv_unlock(dmabuf->resv); in dma_buf_detach()
869 if (dmabuf->ops->detach) in dma_buf_detach()
870 dmabuf->ops->detach(dmabuf, attach); in dma_buf_detach()
877 * dma_buf_pin - Lock down the DMA-buf
892 struct dma_buf *dmabuf = attach->dmabuf; in dma_buf_pin()
897 dma_resv_assert_held(dmabuf->resv); in dma_buf_pin()
899 if (dmabuf->ops->pin) in dma_buf_pin()
900 ret = dmabuf->ops->pin(attach); in dma_buf_pin()
907 * dma_buf_unpin - Unpin a DMA-buf
916 struct dma_buf *dmabuf = attach->dmabuf; in dma_buf_unpin()
920 dma_resv_assert_held(dmabuf->resv); in dma_buf_unpin()
922 if (dmabuf->ops->unpin) in dma_buf_unpin()
923 dmabuf->ops->unpin(attach); in dma_buf_unpin()
928 * dma_buf_map_attachment - Returns the scatterlist table of the attachment;
935 * on error. May return -EINTR if it is interrupted by a signal.
946 * dma_resv attached to the DMA-BUF first.
956 if (WARN_ON(!attach || !attach->dmabuf)) in dma_buf_map_attachment()
957 return ERR_PTR(-EINVAL); in dma_buf_map_attachment()
960 dma_resv_assert_held(attach->dmabuf->resv); in dma_buf_map_attachment()
962 if (attach->sgt) { in dma_buf_map_attachment()
967 if (attach->dir != direction && in dma_buf_map_attachment()
968 attach->dir != DMA_BIDIRECTIONAL) in dma_buf_map_attachment()
969 return ERR_PTR(-EBUSY); in dma_buf_map_attachment()
971 return attach->sgt; in dma_buf_map_attachment()
974 if (dma_buf_is_dynamic(attach->dmabuf)) { in dma_buf_map_attachment()
975 dma_resv_assert_held(attach->dmabuf->resv); in dma_buf_map_attachment()
977 r = attach->dmabuf->ops->pin(attach); in dma_buf_map_attachment()
985 sg_table = ERR_PTR(-ENOMEM); in dma_buf_map_attachment()
987 if (IS_ERR(sg_table) && dma_buf_is_dynamic(attach->dmabuf) && in dma_buf_map_attachment()
989 attach->dmabuf->ops->unpin(attach); in dma_buf_map_attachment()
991 if (!IS_ERR(sg_table) && attach->dmabuf->ops->cache_sgt_mapping) { in dma_buf_map_attachment()
992 attach->sgt = sg_table; in dma_buf_map_attachment()
993 attach->dir = direction; in dma_buf_map_attachment()
1018 * dma_buf_unmap_attachment - unmaps and decreases usecount of the buffer;might
1033 if (WARN_ON(!attach || !attach->dmabuf || !sg_table)) in dma_buf_unmap_attachment()
1037 dma_resv_assert_held(attach->dmabuf->resv); in dma_buf_unmap_attachment()
1039 if (attach->sgt == sg_table) in dma_buf_unmap_attachment()
1042 if (dma_buf_is_dynamic(attach->dmabuf)) in dma_buf_unmap_attachment()
1043 dma_resv_assert_held(attach->dmabuf->resv); in dma_buf_unmap_attachment()
1047 if (dma_buf_is_dynamic(attach->dmabuf) && in dma_buf_unmap_attachment()
1054 * dma_buf_move_notify - notify attachments that DMA-buf is moving
1065 dma_resv_assert_held(dmabuf->resv); in dma_buf_move_notify()
1067 list_for_each_entry(attach, &dmabuf->attachments, node) in dma_buf_move_notify()
1068 if (attach->importer_ops) in dma_buf_move_notify()
1069 attach->importer_ops->move_notify(attach); in dma_buf_move_notify()
1078 * - Fallback operations in the kernel, for example when a device is connected
1084 * Since for most kernel internal dma-buf accesses need the entire buffer, a
1085 * vmap interface is introduced. Note that on very old 32-bit architectures
1094 * it runs out of vmalloc space. Note that the dma-buf layer keeps a reference
1099 * - For full compatibility on the importer side with existing userspace
1106 * There is no special interfaces, userspace simply calls mmap on the dma-buf
1109 * DMA_BUF_IOCTL_SYNC can fail with -EAGAIN or -EINTR, in which case it must
1113 * CPU and GPU domains are being accessed through dma-buf at the same time.
1115 * forward directly to existing dma-buf device drivers vfunc hooks. Userspace
1119 * - mmap dma-buf fd
1120 * - for each drawing/upload cycle in CPU 1. SYNC_START ioctl, 2. read/write
1124 * - munmap once you don't need the buffer any more
1131 * - And as a CPU fallback in userspace processing pipelines.
1135 * interfaces with a imported dma-buf buffer object as with a native buffer
1140 * The assumption in the current dma-buf interfaces is that redirecting the
1153 * If the importing subsystem simply provides a special-purpose mmap call to
1155 * equally achieve that for a dma-buf object.
1163 struct dma_resv *resv = dmabuf->resv; in __dma_buf_begin_cpu_access()
1175 * dma_buf_begin_cpu_access - Must be called before accessing a dma_buf from the
1176 * cpu in the kernel context. Calls begin_cpu_access to allow exporter-specific
1199 return -EINVAL; in dma_buf_begin_cpu_access()
1201 might_lock(&dmabuf->resv->lock.base); in dma_buf_begin_cpu_access()
1203 if (dmabuf->ops->begin_cpu_access) in dma_buf_begin_cpu_access()
1204 ret = dmabuf->ops->begin_cpu_access(dmabuf, direction); in dma_buf_begin_cpu_access()
1206 /* Ensure that all fences are waited upon - but we first allow in dma_buf_begin_cpu_access()
1208 * chooses. A double invocation here will be reasonably cheap no-op. in dma_buf_begin_cpu_access()
1218 * dma_buf_end_cpu_access - Must be called after accessing a dma_buf from the
1219 * cpu in the kernel context. Calls end_cpu_access to allow exporter-specific
1236 might_lock(&dmabuf->resv->lock.base); in dma_buf_end_cpu_access()
1238 if (dmabuf->ops->end_cpu_access) in dma_buf_end_cpu_access()
1239 ret = dmabuf->ops->end_cpu_access(dmabuf, direction); in dma_buf_end_cpu_access()
1247 * dma_buf_mmap - Setup up a userspace mmap with the given vma
1251 * dma-buf buffer.
1264 return -EINVAL; in dma_buf_mmap()
1267 if (!dmabuf->ops->mmap) in dma_buf_mmap()
1268 return -EINVAL; in dma_buf_mmap()
1272 return -EOVERFLOW; in dma_buf_mmap()
1276 dmabuf->size >> PAGE_SHIFT) in dma_buf_mmap()
1277 return -EINVAL; in dma_buf_mmap()
1280 vma_set_file(vma, dmabuf->file); in dma_buf_mmap()
1281 vma->vm_pgoff = pgoff; in dma_buf_mmap()
1283 return dmabuf->ops->mmap(dmabuf, vma); in dma_buf_mmap()
1288 * dma_buf_vmap - Create virtual mapping for the buffer object into kernel
1311 return -EINVAL; in dma_buf_vmap()
1313 if (!dmabuf->ops->vmap) in dma_buf_vmap()
1314 return -EINVAL; in dma_buf_vmap()
1316 mutex_lock(&dmabuf->lock); in dma_buf_vmap()
1317 if (dmabuf->vmapping_counter) { in dma_buf_vmap()
1318 dmabuf->vmapping_counter++; in dma_buf_vmap()
1319 BUG_ON(dma_buf_map_is_null(&dmabuf->vmap_ptr)); in dma_buf_vmap()
1320 *map = dmabuf->vmap_ptr; in dma_buf_vmap()
1324 BUG_ON(dma_buf_map_is_set(&dmabuf->vmap_ptr)); in dma_buf_vmap()
1326 ret = dmabuf->ops->vmap(dmabuf, &ptr); in dma_buf_vmap()
1330 dmabuf->vmap_ptr = ptr; in dma_buf_vmap()
1331 dmabuf->vmapping_counter = 1; in dma_buf_vmap()
1333 *map = dmabuf->vmap_ptr; in dma_buf_vmap()
1336 mutex_unlock(&dmabuf->lock); in dma_buf_vmap()
1342 * dma_buf_vunmap - Unmap a vmap obtained by dma_buf_vmap.
1351 BUG_ON(dma_buf_map_is_null(&dmabuf->vmap_ptr)); in dma_buf_vunmap()
1352 BUG_ON(dmabuf->vmapping_counter == 0); in dma_buf_vunmap()
1353 BUG_ON(!dma_buf_map_is_equal(&dmabuf->vmap_ptr, map)); in dma_buf_vunmap()
1355 mutex_lock(&dmabuf->lock); in dma_buf_vunmap()
1356 if (--dmabuf->vmapping_counter == 0) { in dma_buf_vunmap()
1357 if (dmabuf->ops->vunmap) in dma_buf_vunmap()
1358 dmabuf->ops->vunmap(dmabuf, map); in dma_buf_vunmap()
1359 dma_buf_map_clear(&dmabuf->vmap_ptr); in dma_buf_vunmap()
1361 mutex_unlock(&dmabuf->lock); in dma_buf_vunmap()
1382 seq_puts(s, "\nDma-buf Objects:\n"); in dma_buf_debug_show()
1383 seq_printf(s, "%-8s\t%-8s\t%-8s\t%-8s\texp_name\t%-8s\n", in dma_buf_debug_show()
1388 ret = dma_resv_lock_interruptible(buf_obj->resv, NULL); in dma_buf_debug_show()
1393 buf_obj->size, in dma_buf_debug_show()
1394 buf_obj->file->f_flags, buf_obj->file->f_mode, in dma_buf_debug_show()
1395 file_count(buf_obj->file), in dma_buf_debug_show()
1396 buf_obj->exp_name, in dma_buf_debug_show()
1397 file_inode(buf_obj->file)->i_ino, in dma_buf_debug_show()
1398 buf_obj->name ?: ""); in dma_buf_debug_show()
1400 robj = buf_obj->resv; in dma_buf_debug_show()
1404 fence->ops->get_driver_name(fence), in dma_buf_debug_show()
1405 fence->ops->get_timeline_name(fence), in dma_buf_debug_show()
1408 fobj = rcu_dereference_protected(robj->fence, in dma_buf_debug_show()
1410 shared_count = fobj ? fobj->shared_count : 0; in dma_buf_debug_show()
1412 fence = rcu_dereference_protected(fobj->shared[i], in dma_buf_debug_show()
1415 fence->ops->get_driver_name(fence), in dma_buf_debug_show()
1416 fence->ops->get_timeline_name(fence), in dma_buf_debug_show()
1423 list_for_each_entry(attach_obj, &buf_obj->attachments, node) { in dma_buf_debug_show()
1424 seq_printf(s, "\t%s\n", dev_name(attach_obj->dev)); in dma_buf_debug_show()
1427 dma_resv_unlock(buf_obj->resv); in dma_buf_debug_show()
1433 size += buf_obj->size; in dma_buf_debug_show()