Skip to contentSkip to conversation

Making PCI Memory Cachable

DISCUSSION John Fusco 2 participants 2 messages Nov 28, 2006 – Dec 6, 2006 Memory management

lore
Share & tools
lore

John Fusco

author
#0 lore raw

I have numerous custom PCI devices that implement SRAM or DRAM on the PCI bus. I would like to explore making this memory cachable in the hopes that writes to memory can be done from user space and will be done in bursts rather than single cycles.

Is this crazy or what? I assumed that the VM_IO flag in remap_pfn_range controls this, but that doesn't appear to be the case.

A simple test from user space is the following:
ptr = mmap(...)
memset(ptr, 'a', size)

The driver gets the pointer with remap_pfn_range, but I always see 64-bit writes to memory (this is x86_64 architecture). If this were cachable and the HW waqs cooperative, I would expect to see cache line bursts (e.g. 128 bytes).

I think one of two things is happening:
a) The kernel is not making this memory cachable
b) The memory is cachable, but the chipset is throttling the bursts

Can someone enlighten me?

Thanks,
John

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw
Quoted 4 lines · John Fusco

I have numerous custom PCI devices that implement SRAM or DRAM on the PCI bus. I would like to explore making this memory cachable in the hopes that writes to memory can be done from user space and will be done in bursts rather than single cycles.

You want write combining, not cacheable. The only way to do this currently is to set a MTRR. See Documentation/mtrr.txt by default.

Quoted 1 line

b) The memory is cachable, but the chipset is throttling the bursts

The normal cache coherency protocol doesn't work over PCI

-Andi

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>