DMA to/from user buffers
Hi,
two questions about using an user-supplied buffer (e.g. malloced in user space) for DMA transfers:
1. Is it possible ?
2. What restrictions/requirements apply for the buffer (alignment...) ?
Documentation/DMA-mapping.txt only talks about buffers allocated in kernel space.
thanks,
_sh_
Quoted 11 lines · Sebastian Heidl
Hi,
two questions about using an user-supplied buffer (e.g. malloced in user space) for DMA transfers:
1. Is it possible ?
2. What restrictions/requirements apply for the buffer (alignment...) ?
Documentation/DMA-mapping.txtonly talks about buffers allocated in kernel space.
Lock down the user pages using kiobufs (see include/linux/iobufs.h), then feed these pages to the pci_* functions.
Gerd
Signature · 1 line
Damn lot people confuse usability and eye-candy.
Quoted 8 lines · Sebastian Heidl
Hi,
two questions about using an user-supplied buffer (e.g. malloced in user space) for DMA transfers:
1. Is it possible ?
2. What restrictions/requirements apply for the buffer (alignment...) ?
There are some obvious problems with this. First, a malloc'ed buffer might not be in memory. It might not be created yet if you haven't touched it, and it might be on swap if you have.
The recommended way is to allocate in the kernel, (probably by the driver that want to do DMA), and mmap this buffer into userspace.
Helge Hafting