memory barriers in bus_dmamap_sync() ?
freebsd at damnhippie.dyndns.org
Tue Jan 10 21:40:02 UTC 2012
On Tue, 2012-01-10 at 22:37 +0100, Luigi Rizzo wrote:
> I was glancing through manpages and implementations of bus_dma(9)
> and i am a bit unclear on what this API (in particular, bus_dmamap_sync() )
> does in terms of memory barriers.
> I see that the x86/amd64 and ia64 code only does the bounce buffers.
> The mips seems to do some coherency-related calls.
> How do we guarantee, say, that a recently built packet is
> to memory before issuing the tx command to the NIC ?
I've always assumed that when the concept of a memory barrier means
anything for a given architecture, it's implied that the
bus_dmamap_sync() call has to invoke it as needed to ensure the DMA
operation picks up the right data. Maybe it would be good if the
manpage said that straight out.
The ARM implementations do use the memory barrier operations, in the
form of a call to cpu_drain_writebuf() in the busdma_machdep code. The
ARM specification says that the CPU is stopped until all buffered data
is written to memory for that operation.
More information about the freebsd-current