]> git.baikalelectronics.ru Git - kernel.git/commit
net: stmmac: use correct barrier between coherent memory and MMIO
authorNiklas Cassel <niklas.cassel@axis.com>
Mon, 26 Feb 2018 21:47:07 +0000 (22:47 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 27 Feb 2018 19:28:10 +0000 (14:28 -0500)
commit85618b56743150e36b98fdc233972c8a48821f1b
tree03bf3eaddc93e4baf247ad4938e932d1eff2c888
parentb85557a78fad9b6f52fa74d0ee625df96ad58ff4
net: stmmac: use correct barrier between coherent memory and MMIO

The last memory barrier in stmmac_xmit()/stmmac_tso_xmit() is placed
between a coherent memory write and a MMIO write:

The own bit is written in First Desc (TSO: MSS desc or First Desc).
<barrier>
The DMA engine is started by a write to the tx desc tail pointer/
enable dma transmission register, i.e. a MMIO write.

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.

To guarantee that the cache coherent memory writes have completed
before we attempt to write to the cache incoherent MMIO region,
we need to use the more heavyweight barrier wmb().

Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c