1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Device Drivers DMA Management</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Device Drivers"><link rel="up" href="devdrivers.html" title="Chapter&#160;2.&#160;Device drivers infrastructure"><link rel="prev" href="API-subsys-virtual-register.html" title="subsys_virtual_register"><link rel="next" href="API-dma-buf-export.html" title="dma_buf_export"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Device Drivers DMA Management</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-subsys-virtual-register.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;2.&#160;Device drivers infrastructure</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-dma-buf-export.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp1110137028"></a>Device Drivers DMA Management</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="refentrytitle"><a href="API-dma-buf-export.html"><span class="phrase">dma_buf_export</span></a></span><span class="refpurpose"> &#8212; 
2  Creates a new dma_buf, and associates an anon file with this buffer, so it can be exported. Also connect the allocator specific data and ops to the buffer. Additionally, provide a name string for exporter; useful in debugging.
3 </span></dt><dt><span class="refentrytitle"><a href="API-dma-buf-fd.html"><span class="phrase">dma_buf_fd</span></a></span><span class="refpurpose"> &#8212; 
4     returns a file descriptor for the given dma_buf
5 </span></dt><dt><span class="refentrytitle"><a href="API-dma-buf-get.html"><span class="phrase">dma_buf_get</span></a></span><span class="refpurpose"> &#8212; 
6     returns the dma_buf structure related to an fd
7 </span></dt><dt><span class="refentrytitle"><a href="API-dma-buf-put.html"><span class="phrase">dma_buf_put</span></a></span><span class="refpurpose"> &#8212; 
8     decreases refcount of the buffer
9 </span></dt><dt><span class="refentrytitle"><a href="API-dma-buf-attach.html"><span class="phrase">dma_buf_attach</span></a></span><span class="refpurpose"> &#8212; 
10     Add the device to dma_buf's attachments list; optionally, calls <code class="function">attach</code> of dma_buf_ops to allow device-specific attach functionality
11 </span></dt><dt><span class="refentrytitle"><a href="API-dma-buf-detach.html"><span class="phrase">dma_buf_detach</span></a></span><span class="refpurpose"> &#8212; 
12     Remove the given attachment from dmabuf's attachments list; optionally calls <code class="function">detach</code> of dma_buf_ops for device-specific detach
13 </span></dt><dt><span class="refentrytitle"><a href="API-dma-buf-map-attachment.html"><span class="phrase">dma_buf_map_attachment</span></a></span><span class="refpurpose"> &#8212; 
14     Returns the scatterlist table of the attachment; mapped into _device_ address space. Is a wrapper for <code class="function">map_dma_buf</code> of the dma_buf_ops.
15 </span></dt><dt><span class="refentrytitle"><a href="API-dma-buf-unmap-attachment.html"><span class="phrase">dma_buf_unmap_attachment</span></a></span><span class="refpurpose"> &#8212; 
16     unmaps and decreases usecount of the buffer;might deallocate the scatterlist associated. Is a wrapper for <code class="function">unmap_dma_buf</code> of dma_buf_ops.
17 </span></dt><dt><span class="refentrytitle"><a href="API-dma-buf-begin-cpu-access.html"><span class="phrase">dma_buf_begin_cpu_access</span></a></span><span class="refpurpose"> &#8212; 
18     Must be called before accessing a dma_buf from the cpu in the kernel context. Calls begin_cpu_access to allow exporter-specific preparations. Coherency is only guaranteed in the specified range for the specified access direction.
19 </span></dt><dt><span class="refentrytitle"><a href="API-dma-buf-end-cpu-access.html"><span class="phrase">dma_buf_end_cpu_access</span></a></span><span class="refpurpose"> &#8212; 
20     Must be called after accessing a dma_buf from the cpu in the kernel context. Calls end_cpu_access to allow exporter-specific actions. Coherency is only guaranteed in the specified range for the specified access direction.
21 </span></dt><dt><span class="refentrytitle"><a href="API-dma-buf-kmap-atomic.html"><span class="phrase">dma_buf_kmap_atomic</span></a></span><span class="refpurpose"> &#8212; 
22     Map a page of the buffer object into kernel address space. The same restrictions as for kmap_atomic and friends apply.
23 </span></dt><dt><span class="refentrytitle"><a href="API-dma-buf-kunmap-atomic.html"><span class="phrase">dma_buf_kunmap_atomic</span></a></span><span class="refpurpose"> &#8212; 
24     Unmap a page obtained by dma_buf_kmap_atomic.
25 </span></dt><dt><span class="refentrytitle"><a href="API-dma-buf-kmap.html"><span class="phrase">dma_buf_kmap</span></a></span><span class="refpurpose"> &#8212; 
26     Map a page of the buffer object into kernel address space. The same restrictions as for kmap and friends apply.
27 </span></dt><dt><span class="refentrytitle"><a href="API-dma-buf-kunmap.html"><span class="phrase">dma_buf_kunmap</span></a></span><span class="refpurpose"> &#8212; 
28     Unmap a page obtained by dma_buf_kmap.
29 </span></dt><dt><span class="refentrytitle"><a href="API-dma-buf-mmap.html"><span class="phrase">dma_buf_mmap</span></a></span><span class="refpurpose"> &#8212; 
30     Setup up a userspace mmap with the given vma
31 </span></dt><dt><span class="refentrytitle"><a href="API-dma-buf-vmap.html"><span class="phrase">dma_buf_vmap</span></a></span><span class="refpurpose"> &#8212; 
32     Create virtual mapping for the buffer object into kernel address space. Same restrictions as for vmap and friends apply.
33 </span></dt><dt><span class="refentrytitle"><a href="API-dma-buf-vunmap.html"><span class="phrase">dma_buf_vunmap</span></a></span><span class="refpurpose"> &#8212; 
34     Unmap a vmap obtained by dma_buf_vmap.
35 </span></dt><dt><span class="refentrytitle"><a href="API-fence-context-alloc.html"><span class="phrase">fence_context_alloc</span></a></span><span class="refpurpose"> &#8212; 
36  allocate an array of fence contexts
37 </span></dt><dt><span class="refentrytitle"><a href="API-fence-signal-locked.html"><span class="phrase">fence_signal_locked</span></a></span><span class="refpurpose"> &#8212; 
38     signal completion of a fence
39 </span></dt><dt><span class="refentrytitle"><a href="API-fence-signal.html"><span class="phrase">fence_signal</span></a></span><span class="refpurpose"> &#8212; 
40     signal completion of a fence
41 </span></dt><dt><span class="refentrytitle"><a href="API-fence-wait-timeout.html"><span class="phrase">fence_wait_timeout</span></a></span><span class="refpurpose"> &#8212; 
42     sleep until the fence gets signaled or until timeout elapses
43 </span></dt><dt><span class="refentrytitle"><a href="API-fence-enable-sw-signaling.html"><span class="phrase">fence_enable_sw_signaling</span></a></span><span class="refpurpose"> &#8212; 
44     enable signaling on fence
45 </span></dt><dt><span class="refentrytitle"><a href="API-fence-add-callback.html"><span class="phrase">fence_add_callback</span></a></span><span class="refpurpose"> &#8212; 
46     add a callback to be called when the fence is signaled
47 </span></dt><dt><span class="refentrytitle"><a href="API-fence-remove-callback.html"><span class="phrase">fence_remove_callback</span></a></span><span class="refpurpose"> &#8212; 
48     remove a callback from the signaling list
49 </span></dt><dt><span class="refentrytitle"><a href="API-fence-default-wait.html"><span class="phrase">fence_default_wait</span></a></span><span class="refpurpose"> &#8212; 
50     default sleep until the fence gets signaled or until timeout elapses
51 </span></dt><dt><span class="refentrytitle"><a href="API-fence-init.html"><span class="phrase">fence_init</span></a></span><span class="refpurpose"> &#8212; 
52     Initialize a custom fence.
53 </span></dt><dt><span class="refentrytitle"><a href="re398.html">
54   .//drivers/dma-buf/seqno-fence.c
55  </a></span><span class="refpurpose"> &#8212; 
56   Document generation inconsistency
57  </span></dt><dt><span class="refentrytitle"><a href="API-struct-fence.html"><span class="phrase">struct fence</span></a></span><span class="refpurpose"> &#8212; 
58  software synchronization primitive
59 </span></dt><dt><span class="refentrytitle"><a href="API-struct-fence-cb.html"><span class="phrase">struct fence_cb</span></a></span><span class="refpurpose"> &#8212; 
60     callback for fence_add_callback
61 </span></dt><dt><span class="refentrytitle"><a href="API-struct-fence-ops.html"><span class="phrase">struct fence_ops</span></a></span><span class="refpurpose"> &#8212; 
62     operations implemented for fence
63 </span></dt><dt><span class="refentrytitle"><a href="API-fence-get.html"><span class="phrase">fence_get</span></a></span><span class="refpurpose"> &#8212; 
64     increases refcount of the fence
65 </span></dt><dt><span class="refentrytitle"><a href="API-fence-get-rcu.html"><span class="phrase">fence_get_rcu</span></a></span><span class="refpurpose"> &#8212; 
66     get a fence from a reservation_object_list with rcu read lock
67 </span></dt><dt><span class="refentrytitle"><a href="API-fence-put.html"><span class="phrase">fence_put</span></a></span><span class="refpurpose"> &#8212; 
68     decreases refcount of the fence
69 </span></dt><dt><span class="refentrytitle"><a href="API-fence-is-signaled-locked.html"><span class="phrase">fence_is_signaled_locked</span></a></span><span class="refpurpose"> &#8212; 
70     Return an indication if the fence is signaled yet.
71 </span></dt><dt><span class="refentrytitle"><a href="API-fence-is-signaled.html"><span class="phrase">fence_is_signaled</span></a></span><span class="refpurpose"> &#8212; 
72     Return an indication if the fence is signaled yet.
73 </span></dt><dt><span class="refentrytitle"><a href="API-fence-later.html"><span class="phrase">fence_later</span></a></span><span class="refpurpose"> &#8212; 
74     return the chronologically later fence
75 </span></dt><dt><span class="refentrytitle"><a href="API-fence-wait.html"><span class="phrase">fence_wait</span></a></span><span class="refpurpose"> &#8212; 
76     sleep until the fence gets signaled
77 </span></dt><dt><span class="refentrytitle"><a href="API-to-seqno-fence.html"><span class="phrase">to_seqno_fence</span></a></span><span class="refpurpose"> &#8212; 
78  cast a fence to a seqno_fence
79 </span></dt><dt><span class="refentrytitle"><a href="API-seqno-fence-init.html"><span class="phrase">seqno_fence_init</span></a></span><span class="refpurpose"> &#8212; 
80     initialize a seqno fence
81 </span></dt><dt><span class="refentrytitle"><a href="re411.html">
82   .//drivers/dma-buf/reservation.c
83  </a></span><span class="refpurpose"> &#8212; 
84   Document generation inconsistency
85  </span></dt><dt><span class="refentrytitle"><a href="re412.html">
86   .//include/linux/reservation.h
87  </a></span><span class="refpurpose"> &#8212; 
88   Document generation inconsistency
89  </span></dt><dt><span class="refentrytitle"><a href="API-dma-alloc-from-coherent.html"><span class="phrase">dma_alloc_from_coherent</span></a></span><span class="refpurpose"> &#8212; 
90  try to allocate memory from the per-device coherent area
91 </span></dt><dt><span class="refentrytitle"><a href="API-dma-release-from-coherent.html"><span class="phrase">dma_release_from_coherent</span></a></span><span class="refpurpose"> &#8212; 
92     try to free the memory allocated from per-device coherent memory pool
93 </span></dt><dt><span class="refentrytitle"><a href="API-dma-mmap-from-coherent.html"><span class="phrase">dma_mmap_from_coherent</span></a></span><span class="refpurpose"> &#8212; 
94     try to mmap the memory allocated from per-device coherent memory pool to userspace
95 </span></dt><dt><span class="refentrytitle"><a href="API-dmam-alloc-coherent.html"><span class="phrase">dmam_alloc_coherent</span></a></span><span class="refpurpose"> &#8212; 
96  Managed <code class="function">dma_alloc_coherent</code>
97 </span></dt><dt><span class="refentrytitle"><a href="API-dmam-free-coherent.html"><span class="phrase">dmam_free_coherent</span></a></span><span class="refpurpose"> &#8212; 
98     Managed <code class="function">dma_free_coherent</code>
99 </span></dt><dt><span class="refentrytitle"><a href="API-dmam-alloc-noncoherent.html"><span class="phrase">dmam_alloc_noncoherent</span></a></span><span class="refpurpose"> &#8212; 
100     Managed <code class="function">dma_alloc_non_coherent</code>
101 </span></dt><dt><span class="refentrytitle"><a href="API-dmam-free-noncoherent.html"><span class="phrase">dmam_free_noncoherent</span></a></span><span class="refpurpose"> &#8212; 
102     Managed <code class="function">dma_free_noncoherent</code>
103 </span></dt><dt><span class="refentrytitle"><a href="API-dmam-declare-coherent-memory.html"><span class="phrase">dmam_declare_coherent_memory</span></a></span><span class="refpurpose"> &#8212; 
104     Managed <code class="function">dma_declare_coherent_memory</code>
105 </span></dt><dt><span class="refentrytitle"><a href="API-dmam-release-declared-memory.html"><span class="phrase">dmam_release_declared_memory</span></a></span><span class="refpurpose"> &#8212; 
106     Managed <code class="function">dma_release_declared_memory</code>.
107 </span></dt></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-subsys-virtual-register.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="devdrivers.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-dma-buf-export.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">subsys_virtual_register</span>&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;<span class="phrase">dma_buf_export</span></td></tr></table></div></body></html>
108