]> git.baikalelectronics.ru Git - kernel.git/commit
alpha: fix memory barriers so that they conform to the specification
authorMikulas Patocka <mpatocka@redhat.com>
Tue, 26 May 2020 14:47:49 +0000 (10:47 -0400)
committerMatt Turner <mattst88@gmail.com>
Sat, 13 Jun 2020 00:43:18 +0000 (17:43 -0700)
commitc99ace6c57293ae82678e0218c76e4509e09a408
tree6eb979f701f2ce4aaf7bcd4c95f64596d70fcb18
parente1e8a0538d3c4194f4335e9ed8a64dbcb025a4b3
alpha: fix memory barriers so that they conform to the specification

The commits b01850ba70a7 and 21c9c24e950c broke boot on the Alpha Avanti
platform. The patches move memory barriers after a write before the write.
The result is that if there's iowrite followed by ioread, there is no
barrier between them.

The Alpha architecture allows reordering of the accesses to the I/O space,
and the missing barrier between write and read causes hang with serial
port and real time clock.

This patch makes barriers confiorm to the specification.

1. We add mb() before readX_relaxed and writeX_relaxed -
   memory-barriers.txt claims that these functions must be ordered w.r.t.
   each other. Alpha doesn't order them, so we need an explicit barrier.
2. We add mb() before reads from the I/O space - so that if there's a
   write followed by a read, there should be a barrier between them.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: b01850ba70a7 ("alpha: io: reorder barriers to guarantee writeX() and iowriteX() ordering")
Fixes: 21c9c24e950c ("alpha: io: reorder barriers to guarantee writeX() and iowriteX() ordering #2")
Cc: stable@vger.kernel.org # v4.17+
Acked-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Reviewed-by: Maciej W. Rozycki <macro@linux-mips.org>
Signed-off-by: Matt Turner <mattst88@gmail.com>
arch/alpha/include/asm/io.h
arch/alpha/kernel/io.c