RFC on writel and writel_relaxed
David.Laight at ACULAB.COM
Fri Mar 30 01:58:34 AEDT 2018
From: Jason Gunthorpe
> Sent: 29 March 2018 15:45
> > > When talking about ordering between the devices, the relevant question
> > > is what happens if the writel(DEVICE_BAR) triggers DEVICE_BAR to DMA
> > > from the DEVICE_FOO. 'ordered' means that in this case
> > > writel(DEVICE_FOO) must be presented to FOO before anything generated
> > > by BAR.
> > Yes, and that isn't the case for arm because the writes can still be
> > buffered.
> The statement is not about buffering, or temporal completion order, or
> the order of acks returning to the CPU. It is about pure transaction
> ordering inside the interconnect.
> Can write BAR -> FOO pass write CPU -> FOO?
The first cpu write can almost certainly be 'stalled' at the shared PCIe bridge.
The second cpu write then completes (to a different target).
That target then issues a peer to peer transfer that reaches the shared bridge.
I doubt the order of the transactions is guaranteed when it becomes 'un-stalled'.
Of course, these are peer to peer transfers, and strange ones at that.
Normally you'd not be doing peer to peer transfers that access 'memory'
the cpu has just written to.
Requiring extra barriers in this case, or different functions for WC accesses
shouldn't really be an issue.
Even requiring a barrier between a write to dma coherent memory and a write
that starts dma isn't really onerous.
Even if it is a nop on all current architectures it is a good comment in the code.
It could even have a 'dev' argument.
More information about the Linuxppc-dev