PCI MMIO flushing and stuff (was Re: 2.2.15 with eepro100: eth0:
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 5 lines · Alan Cox
Quoted 3 lines
processors which Linux currently supports do external read/write reordering? If so, would this alter the order as seen by the PCI bridge?
PowerPC at least can do this, but see above
Most RISCs have a write buffer which lets reads go ahead of writes.
Quoted 5 lines
Quoted 3 lines
Suppose, for example, that the CPU writes two words to memory. Does the PCI DMA see them in the correct order (non-Pentium), or must some special barriers be used?
This is defined in the PentiumII manuals.
I think most RISCs these days have a weak memory ordering model which basically says that you can't assume anything much about the order in which memory accesses done by one agent (CPU or DMA controller) are seen by another agent, unless you put in some explicit barriers. This lets the hardware reorder accesses to get improved performance. I don't know of any systems that actually reorder writes to non-cacheable memory though.
Quoted 9 lines
Quoted 2 lines
What happens the PCI DMA wants to write to an address which is currently dirty, within a CPU cache?
The PCI write is stalled, the cache line written back and invalidated, then the data is written
Quoted 2 lines
What happens when PCI DMA wants to read an address which is currently dirty, within a CPU cache?
Quoted 6 lines
Pretty much the same.
Quoted 2 lines
What happens when PCI DMA writes to an address which is currently clean within a CPU cache?
It goes dirty
No, it gets invalidated, surely?
Quoted 4 lines
The memory bus stuff is defined in the intel docs not the PCI docs. On a PowerPC for example I believe the answer to most of the above questions is 'you lose'. That is why we have
pci_alloc_consistentand the like to avoid spending all day flushing caches.
No, that's sparc32 you're thinking of IIRC. :-) PCI DMA is coherent with the cpu D-cache on all the PowerPCs I've worked on (the I-cache usually doesn't snoop, though).
Paul.
Signature · 9 lines
Paul Mackerras, Senior Open Source Researcher, Linuxcare, Inc. +61 2 6262 8990 tel, +61 2 6262 8991 fax [email protected], http://www.linuxcare.com.au/ Linuxcare. Support for the revolution. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] Please read the FAQ at http://www.tux.org/lkml/