Disable Caching for mmap() address

Jonathan Haws Jonathan.Haws at sdl.usu.edu
Tue Nov 10 10:21:10 EST 2009


All,

I would like to disable caching for an address that was returned from a call to mmap().  I am using this address for DMA operations in user space and want to make sure that the data cache is turned off for that buffer.

The way this works is the driver simply takes an address I provide and begins a DMA operation to that location in RAM (I have ensured that this is a physical address I am passing already).  When the DMA is complete, an interrupt fires and the ISR gives a semaphore that the user space application is pending on (RT_SEM from Xenomai).  I have tried simply calling a cache invalidate routine in the ISR before I give the semaphore, but the kernel crashes when I try to call that routine - my guess it because the kernel does not have direct access to that location in memory (only my application does, according to the MMU).

Anyway, all I want to do is make sure that the buffer is never stored in the cache and that I always fetch it from RAM.  How can I specify that using mmap() on the /dev/mem device, or is there a better way to accomplish this?

Thanks,

Jonathan





More information about the Linuxppc-dev mailing list