Re: [PATCH net-next 2/4] net: stmmac: use correct barrier between coherent memory and MMIO

From: David Miller
Date: Fri Mar 02 2018 - 09:54:20 EST


From: Pavel Machek <pavel@xxxxxx>
Date: Fri, 2 Mar 2018 10:20:00 +0100

>> This barrier cannot be a simple dma_wmb(), since a dma_wmb() is only
>> used to guarantee the ordering, with respect to other writes,
>> to cache coherent DMA memory.
>
> Could you explain this a bit more (and perhaps in code comment)?
>
> Ensuring other writes are done before writing the "GO!" bit should be
> enough, no?

Indeed, the chip should never look at the descriptor contents unless
the GO bit is set.

If there are ways that it can, this must be explained and documented
since it is quite unusual compared to other hardware.

> (If it is not, do we need heavier barriers in other places, too?)

Right.