'\" t .\" Title: struct fence_ops .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: January 2017 .\" Manual: Device drivers infrastructure .\" Source: Kernel Hackers Manual 4.8.15 .\" Language: English .\" .TH "STRUCT FENCE_OPS" "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" struct_fence_ops \- operations implemented for fence .SH "SYNOPSIS" .sp .nf struct fence_ops { const char * (* get_driver_name) (struct fence *fence); const char * (* get_timeline_name) (struct fence *fence); bool (* enable_signaling) (struct fence *fence); bool (* signaled) (struct fence *fence); signed long (* wait) (struct fence *fence, bool intr, signed long timeout); void (* release) (struct fence *fence); int (* fill_driver_data) (struct fence *fence, void *data, int size); void (* fence_value_str) (struct fence *fence, char *str, int size); void (* timeline_value_str) (struct fence *fence, char *str, int size); }; .fi .SH "MEMBERS" .PP get_driver_name .RS 4 returns the driver name\&. .RE .PP get_timeline_name .RS 4 return the name of the context this fence belongs to\&. .RE .PP enable_signaling .RS 4 enable software signaling of fence\&. .RE .PP signaled .RS 4 [optional] peek whether the fence is signaled, can be null\&. .RE .PP wait .RS 4 custom wait implementation, or fence_default_wait\&. .RE .PP release .RS 4 [optional] called on destruction of fence, can be null .RE .PP fill_driver_data .RS 4 [optional] callback to fill in free\-form debug info Returns amount of bytes filled, or \-errno\&. .RE .PP fence_value_str .RS 4 [optional] fills in the value of the fence as a string .RE .PP timeline_value_str .RS 4 [optional] fills in the current value of the timeline as a string .RE .SH "DESCRIPTION" .PP Notes on enable_signaling: For fence implementations that have the capability for hw\->hw signaling, they can implement this op to enable the necessary irqs, or insert commands into cmdstream, etc\&. This is called in the first \fBwait\fR or \fBadd_callback\fR path to let the fence implementation know that there is another driver waiting on the signal (ie\&. hw\->sw case)\&. .PP This function can be called called from atomic context, but not from irq context, so normal spinlocks can be used\&. .PP A return value of false indicates the fence already passed, or some failure occurred that made it impossible to enable signaling\&. True indicates successful enabling\&. .PP fence\->status may be set in enable_signaling, but only when false is returned\&. .PP Calling fence_signal before enable_signaling is called allows for a tiny race window in which enable_signaling is called during, before, or after fence_signal\&. To fight this, it is recommended that before enable_signaling returns true an extra reference is taken on the fence, to be released when the fence is signaled\&. This will mean fence_signal will still be called twice, but the second time will be a noop since it was already signaled\&. .PP Notes on signaled: May set fence\->status if returning true\&. .PP Notes on wait: Must not be NULL, set to fence_default_wait for default implementation\&. the fence_default_wait implementation should work for any fence, as long as enable_signaling works correctly\&. .PP Must return \-ERESTARTSYS if the wait is intr = true and the wait was interrupted, and remaining jiffies if fence has signaled, or 0 if wait timed out\&. Can also return other error values on custom implementations, which should be treated as if the fence is signaled\&. For example a hardware lockup could be reported like that\&. .PP Notes on release: Can be NULL, this function allows additional commands to run on destruction of the fence\&. Can be called from irq context\&. If pointer is set to NULL, kfree will get called instead\&. .SH "COPYRIGHT" .br