1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>seqno_fence_init</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="ch02s03.html" title="Device Drivers DMA Management"><link rel="prev" href="API-to-seqno-fence.html" title="to_seqno_fence"><link rel="next" href="re411.html" title=".//drivers/dma-buf/reservation.c"></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"><span class="phrase">seqno_fence_init</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-to-seqno-fence.html">Prev</a>&#160;</td><th width="60%" align="center">Device Drivers DMA Management</th><td width="20%" align="right">&#160;<a accesskey="n" href="re411.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-seqno-fence-init"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>seqno_fence_init &#8212; 
2     initialize a seqno fence
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <b class="fsfunc">seqno_fence_init </b>(</code></td><td>struct seqno_fence * <var class="pdparam">fence</var>, </td></tr><tr><td>&#160;</td><td>spinlock_t * <var class="pdparam">lock</var>, </td></tr><tr><td>&#160;</td><td>struct dma_buf * <var class="pdparam">sync_buf</var>, </td></tr><tr><td>&#160;</td><td>uint32_t <var class="pdparam">context</var>, </td></tr><tr><td>&#160;</td><td>uint32_t <var class="pdparam">seqno_ofs</var>, </td></tr><tr><td>&#160;</td><td>uint32_t <var class="pdparam">seqno</var>, </td></tr><tr><td>&#160;</td><td>enum seqno_fence_condition <var class="pdparam">cond</var>, </td></tr><tr><td>&#160;</td><td>const struct fence_ops * <var class="pdparam">ops</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div></div><div class="refsect1"><a name="idp1110487540"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>fence</code></em></span></dt><dd><p>
4     seqno_fence to initialize
5    </p></dd><dt><span class="term"><em class="parameter"><code>lock</code></em></span></dt><dd><p>
6     pointer to spinlock to use for fence
7    </p></dd><dt><span class="term"><em class="parameter"><code>sync_buf</code></em></span></dt><dd><p>
8     buffer containing the memory location to signal on
9    </p></dd><dt><span class="term"><em class="parameter"><code>context</code></em></span></dt><dd><p>
10     the execution context this fence is a part of
11    </p></dd><dt><span class="term"><em class="parameter"><code>seqno_ofs</code></em></span></dt><dd><p>
12     the offset within <em class="parameter"><code>sync_buf</code></em>
13    </p></dd><dt><span class="term"><em class="parameter"><code>seqno</code></em></span></dt><dd><p>
14     the sequence # to signal on
15    </p></dd><dt><span class="term"><em class="parameter"><code>cond</code></em></span></dt><dd><p>
16     fence wait condition
17    </p></dd><dt><span class="term"><em class="parameter"><code>ops</code></em></span></dt><dd><p>
18     the fence_ops for operations on this seqno fence
19    </p></dd></dl></div></div><div class="refsect1"><a name="idp1110496756"></a><h2>Description</h2><p>
20   This function initializes a struct seqno_fence with passed parameters,
21   and takes a reference on sync_buf which is released on fence destruction.
22   </p><p>
23
24   A seqno_fence is a dma_fence which can complete in software when
25   enable_signaling is called, but it also completes when
26   (s32)((sync_buf)[seqno_ofs] - seqno) &gt;= 0 is true
27   </p><p>
28
29   The seqno_fence will take a refcount on the sync_buf until it's
30   destroyed, but actual lifetime of sync_buf may be longer if one of the
31   callers take a reference to it.
32   </p><p>
33
34   Certain hardware have instructions to insert this type of wait condition
35   in the command stream, so no intervention from software would be needed.
36   This type of fence can be destroyed before completed, however a reference
37   on the sync_buf dma-buf can be taken. It is encouraged to re-use the same
38   dma-buf for sync_buf, since mapping or unmapping the sync_buf to the
39   device's vm can be expensive.
40   </p><p>
41
42   It is recommended for creators of seqno_fence to call fence_signal
43   before destruction. This will prevent possible issues from wraparound at
44   time of issue vs time of check, since users can check fence_is_signaled
45   before submitting instructions for the hardware to wait on the fence.
46   However, when ops.enable_signaling is not called, it doesn't have to be
47   done as soon as possible, just before there's any real danger of seqno
48   wraparound.
49</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-to-seqno-fence.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="ch02s03.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="re411.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">to_seqno_fence</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;
50   .//drivers/dma-buf/reservation.c
51  </td></tr></table></div></body></html>
52