On 4/5/2019 1:29 PM, Maciej W. Rozycki wrote:
  Obviously you do need that `mb' before `__ioread' in the second case,
just like in the first one, because otherwise the read bus access issued
by `__ioread' can be reordered ahead of the write bus access issued by the
preceding `__iowrite'.

Please also not that you also need a mb() after read to prevent stale
from being read from memory.

write_to_memory_for_dma()

mb();  <---- DMA ordering requirement.Prefer wmb() if possible.
__iowrite(123, INDEX);

mb(); <---- alpha arch requirement due to instruction reordering.

x = __ioread(DATA);
mb();  <---- DMA ordering requirement. Prefer rmb() if possible.

read_from_dma_memory()

You basically can't remove the mb() after __ioread() and before
__iowrite() unless your architecture guarantees IO vs. memory ordering.

Reply via email to