LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 02-23-2009, 09: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
Stéphane
 
Old 02-25-2009, 03:06 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

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

Original Poster
Rep: Reputation: 0
Hi,
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 ( http://lwn.net/Kernel/LDD3/) 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 ??
 
  


Reply



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 01:03 PM
mmap of a file partially present in page cache into huge pages panandsapphire Linux - Kernel 0 10-30-2006 04:31 AM
flushing disk and cache spejbl02 Programming 3 07-08-2004 01:18 AM
Flushing named's cache? WeNdeL Linux - Software 3 09-06-2003 06:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 07:27 AM.

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