'\" t .\" Title: seqno_fence_init .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: January 2017 .\" Manual: Device drivers infrastructure .\" Source: Kernel Hackers Manual 4.8.15 .\" Language: English .\" .TH "SEQNO_FENCE_INIT" "9" "January 2017" "Kernel Hackers Manual 4\&.8\&." "Device drivers infrastructure" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" seqno_fence_init \- initialize a seqno fence .SH "SYNOPSIS" .HP \w'void\ seqno_fence_init('u .BI "void seqno_fence_init(struct\ seqno_fence\ *\ " "fence" ", spinlock_t\ *\ " "lock" ", struct\ dma_buf\ *\ " "sync_buf" ", uint32_t\ " "context" ", uint32_t\ " "seqno_ofs" ", uint32_t\ " "seqno" ", enum\ seqno_fence_condition\ " "cond" ", const\ struct\ fence_ops\ *\ " "ops" ");" .SH "ARGUMENTS" .PP \fIfence\fR .RS 4 seqno_fence to initialize .RE .PP \fIlock\fR .RS 4 pointer to spinlock to use for fence .RE .PP \fIsync_buf\fR .RS 4 buffer containing the memory location to signal on .RE .PP \fIcontext\fR .RS 4 the execution context this fence is a part of .RE .PP \fIseqno_ofs\fR .RS 4 the offset within \fIsync_buf\fR .RE .PP \fIseqno\fR .RS 4 the sequence # to signal on .RE .PP \fIcond\fR .RS 4 fence wait condition .RE .PP \fIops\fR .RS 4 the fence_ops for operations on this seqno fence .RE .SH "DESCRIPTION" .PP This function initializes a struct seqno_fence with passed parameters, and takes a reference on sync_buf which is released on fence destruction\&. .PP A seqno_fence is a dma_fence which can complete in software when enable_signaling is called, but it also completes when (s32)((sync_buf)[seqno_ofs] \- seqno) >= 0 is true .PP The seqno_fence will take a refcount on the sync_buf until it\*(Aqs destroyed, but actual lifetime of sync_buf may be longer if one of the callers take a reference to it\&. .PP Certain hardware have instructions to insert this type of wait condition in the command stream, so no intervention from software would be needed\&. This type of fence can be destroyed before completed, however a reference on the sync_buf dma\-buf can be taken\&. It is encouraged to re\-use the same dma\-buf for sync_buf, since mapping or unmapping the sync_buf to the device\*(Aqs vm can be expensive\&. .PP It is recommended for creators of seqno_fence to call fence_signal before destruction\&. This will prevent possible issues from wraparound at time of issue vs time of check, since users can check fence_is_signaled before submitting instructions for the hardware to wait on the fence\&. However, when ops\&.enable_signaling is not called, it doesn\*(Aqt have to be done as soon as possible, just before there\*(Aqs any real danger of seqno wraparound\&. .SH "COPYRIGHT" .br