Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 02-23-2009, 10:22 AM   #1
Stephane Mancini
LQ Newbie
Registered: Feb 2009
Posts: 3

Rep: Reputation: 0
mmap and DMA cache flushing

Hi all,
I'm designing a multi-frame/multi-component video grabber and I need to DMA some data.
The hardware puts the data on some DRAM memory not used by the kernel.
To read the data from user space, I map a data chunk to a virtual user space address thanks to mmap.
Then I may modify the data from software and output it with again the hardware thanks to a DMA.
I'm wondering about cache coherency issues.
I've read the ldd3 but I don't understand to mix mmap and DMA cache management.
Do I have also to map the data chunks in a kernel virtual address space ?
Is it possible to flush/trash the CPU cache from user space ?
Thanks a lot for your help
Old 02-25-2009, 04:06 PM   #2
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,575

Rep: Reputation: 181Reputation: 181
It looks to me that you need to have the space as non-cacheable. Or I'm wrong?
Old 02-26-2009, 03:54 AM   #3
Stephane Mancini
LQ Newbie
Registered: Feb 2009
Posts: 3

Original Poster
Rep: Reputation: 0
To be more precise : I need the data to be cached for software processing of the data.
My problem is that the data is updated by hardware DMA. So I need the CPU cache to be updated when the DMA puts new data.
The Linux Device Driver 3 deals whit that problem on chapter 15 ( but I don't understand how to pratically implement it.
Indeed, I wrote a user space application that uses the data.
But the LDD3 provides kernel space functions to do that. For example, the kernel provides the function

void dma_sync_single_for_cpu(struct device *dev, dma_handle_t bus_addr,
size_t size, enum dma_data_direction direction);

But the arguments are not available from the user space (when using mmap). My question how to do that ?
Should I address this issue from the kernel (in a driver) before the user mmap the data ??


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
mmap cache can't open foo.php - Too many open files guarriman Linux - Software 3 12-16-2013 02:03 PM
mmap of a file partially present in page cache into huge pages panandsapphire Linux - Kernel 0 10-30-2006 05:31 AM
flushing disk and cache spejbl02 Programming 3 07-08-2004 02:18 AM
Flushing named's cache? WeNdeL Linux - Software 3 09-06-2003 07:29 PM > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 03:42 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration