For example if I write to a particular memory location (ex: DMA transfer) how does it get affected in my cache?
+1
A:
The cache is a CPU feature; if you write to memory via the CPU, the cache will be updated and will remain consistent.
If you write to memory some other way (e.g. a DMA transfer, as you suggest) you will need to (possibly) flush the cache beforehand, and then tell the CPU that the cache is invalid. How you do this depends on your system - for example see INVD and WBINVD for x86.
Two good articles to read on cache coherency and DMA are Understanding Caching and Using DMA (both by James Bottomley, published in Linux Journal; "Caching" in issue 117, January 2004 and "DMA" in issue 121, May 2004).
Matt Curtis
2010-09-29 03:29:10
@Matt Curtis Thank you very much for those articles. They look really good. Also is there an another article for memory mapped IO and also on PCI ?
brett
2010-09-29 04:36:24
A:
One thing to note: The INVBD and WBVD instructions are privlidged instructions, so you can't run them directly from user space.
Scott Wisniewski
2010-09-29 17:18:18