'\" t .\" Title: struct dma_buf_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 DMA_BUF_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_dma_buf_ops \- operations possible on struct dma_buf .SH "SYNOPSIS" .sp .nf struct dma_buf_ops { int (* attach) (struct dma_buf *, struct device *,struct dma_buf_attachment *); void (* detach) (struct dma_buf *, struct dma_buf_attachment *); struct sg_table * (* map_dma_buf) (struct dma_buf_attachment *,enum dma_data_direction); void (* unmap_dma_buf) (struct dma_buf_attachment *,struct sg_table *,enum dma_data_direction); void (* release) (struct dma_buf *); int (* begin_cpu_access) (struct dma_buf *, enum dma_data_direction); int (* end_cpu_access) (struct dma_buf *, enum dma_data_direction); void *(* kmap_atomic) (struct dma_buf *, unsigned long); void (* kunmap_atomic) (struct dma_buf *, unsigned long, void *); void *(* kmap) (struct dma_buf *, unsigned long); void (* kunmap) (struct dma_buf *, unsigned long, void *); int (* mmap) (struct dma_buf *, struct vm_area_struct *vma); void *(* vmap) (struct dma_buf *); void (* vunmap) (struct dma_buf *, void *vaddr); }; .fi .SH "MEMBERS" .PP attach .RS 4 [optional] allows different devices to \*(Aqattach\*(Aq themselves to the given buffer\&. It might return \-EBUSY to signal that backing storage is already allocated and incompatible with the requirements of requesting device\&. .RE .PP detach .RS 4 [optional] detach a given device from this buffer\&. .RE .PP map_dma_buf .RS 4 returns list of scatter pages allocated, increases usecount of the buffer\&. Requires atleast one attach to be called before\&. Returned sg list should already be mapped into _device_ address space\&. This call may sleep\&. May also return \-EINTR\&. Should return \-EINVAL if attach hasn\*(Aqt been called yet\&. .RE .PP unmap_dma_buf .RS 4 decreases usecount of buffer, might deallocate scatter pages\&. .RE .PP release .RS 4 release this buffer; to be called after the last dma_buf_put\&. .RE .PP begin_cpu_access .RS 4 [optional] called before cpu access to invalidate cpu caches and allocate backing storage (if not yet done) respectively pin the object into memory\&. .RE .PP end_cpu_access .RS 4 [optional] called after cpu access to flush caches\&. .RE .PP kmap_atomic .RS 4 maps a page from the buffer into kernel address space, users may not block until the subsequent unmap call\&. This callback must not sleep\&. .RE .PP kunmap_atomic .RS 4 [optional] unmaps a atomically mapped page from the buffer\&. This Callback must not sleep\&. .RE .PP kmap .RS 4 maps a page from the buffer into kernel address space\&. .RE .PP kunmap .RS 4 [optional] unmaps a page from the buffer\&. .RE .PP mmap .RS 4 used to expose the backing storage to userspace\&. Note that the mapping needs to be coherent \- if the exporter doesn\*(Aqt directly support this, it needs to fake coherency by shooting down any ptes when transitioning away from the cpu domain\&. .RE .PP vmap .RS 4 [optional] creates a virtual mapping for the buffer into kernel address space\&. Same restrictions as for vmap and friends apply\&. .RE .PP vunmap .RS 4 [optional] unmaps a vmap from the buffer .RE .SH "COPYRIGHT" .br