On Sat, 2024-06-15 at 13:07 +0200, Paul Cercueil wrote:
Le dimanche 09 juin 2024 à 10:53 +0100, Jonathan Cameron a écrit :
On Wed, 5 Jun 2024 13:08:42 +0200 Paul Cercueil paul@crapouillou.net wrote:
Add the necessary infrastructure to the IIO core to support a new optional DMABUF based interface.
With this new interface, DMABUF objects (externally created) can be attached to a IIO buffer, and subsequently used for data transfer.
A userspace application can then use this interface to share DMABUF objects between several interfaces, allowing it to transfer data in a zero-copy fashion, for instance between IIO and the USB stack.
The userspace application can also memory-map the DMABUF objects, and access the sample data directly. The advantage of doing this vs. the read() interface is that it avoids an extra copy of the data between the kernel and userspace. This is particularly userful for high-speed devices which produce several megabytes or even gigabytes of data per second.
As part of the interface, 3 new IOCTLs have been added:
IIO_BUFFER_DMABUF_ATTACH_IOCTL(int fd): Attach the DMABUF object identified by the given file descriptor to the buffer.
IIO_BUFFER_DMABUF_DETACH_IOCTL(int fd): Detach the DMABUF object identified by the given file descriptor from the buffer. Note that closing the IIO buffer's file descriptor will automatically detach all previously attached DMABUF objects.
IIO_BUFFER_DMABUF_ENQUEUE_IOCTL(struct iio_dmabuf *): Request a data transfer to/from the given DMABUF object. Its file descriptor, as well as the transfer size and flags are provided in the "iio_dmabuf" structure.
These three IOCTLs have to be performed on the IIO buffer's file descriptor, obtained using the IIO_BUFFER_GET_FD_IOCTL() ioctl.
Signed-off-by: Paul Cercueil paul@crapouillou.net Signed-off-by: Nuno Sa nuno.sa@analog.com
Need a brief note on the sign off chain. What is Nuno's role in this series as he's not sending the emails and not marked with Co-developed-by
That's a good question. I think he sent one revision of the patchset (v7 or something like that) so he added his SoB.
(Nuno: you confirm?)
exactly...
I'll add his Co-developed-by then.
Not sure if that is really deserved :)... Maybe just remove my tag.
- Nuno Sá