Re: [PATCH] alpha: add udelay to io port paths

From: Sinan Kaya (Okaya@xxxxxxxxxx)
Date: Fri Apr 05 2019 - 13:50:26 EST

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.


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.


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