memory mapped devices

My question is how linux deals with memory cache . When we have a memory mapped device, for example, at address

0x???????? The only thing I need to do to get the virtual adress is ioremap(0x????????), then we can access the device just like normal memory. If I look the ioremap(0 some case it's just as simple as to add a offset. Then question is what mechanism makes memory cache disabled for this range of memory?

Thanks,

Reply to
Keep Asking
Loading thread data ...

use "ioremap_nocache()". Cheers Janaka

Reply to
Janaka

AFAIK, this depends on the MMU

If you use an MMU (and also if you use one), you can do this only in a device driver and here ioremap()can be used to grant uncached access ioremap() usually is inly called in the initialization phase of the driver and the address obtained us used later.

If you don't use an MMU there are ways to access these ports in user mode.

-Michael

Reply to
Michael Schnell

Janaka wrote in news:6ca6ebcd-f4a7-456c-b3ae- snipped-for-privacy@n1g2000prb.googlegroups.com:

To expand on this a bit: Typically, device drivers map device memory in an uncached way so that each load or store goes directly to the device, bypassing the cpu cache -- ioremap_nocache is typically the way that's done. Its implementation varies from one architecture to another.

However, there is more to it than that. Device drivers should use readl () and writel() and related macros to access memory on the device. You may also want to read about the possible effects of asynchronously posted writes that some buses such as PCI use. All of this is covered (though not too thoroughly) in the kernel internals documentation. See Documentation/DocBook/deviceiobook.XXX in your kernel source tree. I'd also recommend looking at the book "Linux Device Drivers" which is available online at

formatting link

GH

Reply to
Gil Hamilton

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.