kernel driver access application memory
Hi, If my application allocate memory for input and output buffers, and pass the pointer to a kernel driver (via v4l2 queue buffer operation), can the kernel driver access it? Do I need to setup DMA before teh kernel driver can read/write to it? Thank you.
On Wed, Jan 15, 2014 at 11:45 PM, m silverstri < michael.j.silverstri@gmail.com> wrote:
Hi,
If my application allocate memory for input and output buffers, and pass the pointer to a kernel driver (via v4l2 queue buffer operation), can the kernel driver access it? Do I need to setup DMA before teh kernel driver can read/write to it?
You can transfer data to & from kernelspace/userspace by using copy_to/from_user() API. However, for DMA I think you might also want to lock the user pages in memory so that they are not invalidated when the owning process is scheduled out. This is a very high-level gist, but there a lot of resources out there which show how this can be done. HTH, -mandeep
Thank you.
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Hi, On Wed, Jan 15, 2014 at 11:45 PM, m silverstri <michael.j.silverstri@gmail.com> wrote:
Hi,
If my application allocate memory for input and output buffers, and pass the pointer to a kernel driver (via v4l2 queue buffer operation), can the kernel driver access it? Do I need to setup DMA before teh kernel driver can read/write to it?
If your application is allocating memory for v4l2 buffers how are you making sure its contiguous ? What call are you using to allocate memory @application level ? If the application is allocating buffers its USER_PTR buffer. Yes kernel can access the buffer. For reading and writing of buffers you dont need to setup DMA. Regards, --Prabhakar Lad http://in.linkedin.com/in/prabhakarlad
participants (3)
-
m silverstri -
Mandeep Sandhu -
Prabhakar Lad