~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/iio/iio_dmabuf_api.rst

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 .. SPDX-License-Identifier: GPL-2.0
  2 
  3 ===================================
  4 High-speed DMABUF interface for IIO
  5 ===================================
  6 
  7 1. Overview
  8 ===========
  9 
 10 The Industrial I/O subsystem supports access to buffers through a
 11 file-based interface, with read() and write() access calls through the
 12 IIO device's dev node.
 13 
 14 It additionally supports a DMABUF based interface, where the userspace
 15 can attach DMABUF objects (externally created) to an IIO buffer, and
 16 subsequently use them for data transfers.
 17 
 18 A userspace application can then use this interface to share DMABUF
 19 objects between several interfaces, allowing it to transfer data in a
 20 zero-copy fashion, for instance between IIO and the USB stack.
 21 
 22 The userspace application can also memory-map the DMABUF objects, and
 23 access the sample data directly. The advantage of doing this vs. the
 24 read() interface is that it avoids an extra copy of the data between the
 25 kernel and userspace. This is particularly useful for high-speed devices
 26 which produce several megabytes or even gigabytes of data per second.
 27 It does however increase the userspace-kernelspace synchronization
 28 overhead, as the DMA_BUF_SYNC_START and DMA_BUF_SYNC_END IOCTLs have to
 29 be used for data integrity.
 30 
 31 2. User API
 32 ===========
 33 
 34 As part of this interface, three new IOCTLs have been added. These three
 35 IOCTLs have to be performed on the IIO buffer's file descriptor, which
 36 can be obtained using the IIO_BUFFER_GET_FD_IOCTL() ioctl.
 37 
 38   ``IIO_BUFFER_DMABUF_ATTACH_IOCTL(int fd)``
 39     Attach the DMABUF object, identified by its file descriptor, to the
 40     IIO buffer. Returns zero on success, and a negative errno value on
 41     error.
 42 
 43   ``IIO_BUFFER_DMABUF_DETACH_IOCTL(int fd)``
 44     Detach the given DMABUF object, identified by its file descriptor,
 45     from the IIO buffer. Returns zero on success, and a negative errno
 46     value on error.
 47 
 48     Note that closing the IIO buffer's file descriptor will
 49     automatically detach all previously attached DMABUF objects.
 50 
 51   ``IIO_BUFFER_DMABUF_ENQUEUE_IOCTL(struct iio_dmabuf *iio_dmabuf)``
 52     Enqueue a previously attached DMABUF object to the buffer queue.
 53     Enqueued DMABUFs will be read from (if output buffer) or written to
 54     (if input buffer) as long as the buffer is enabled.

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php