]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[riscv] Serialise MMIO accesses with respect to each other
authorMichael Brown <mcb30@ipxe.org>
Sun, 22 Jun 2025 08:26:36 +0000 (09:26 +0100)
committerMichael Brown <mcb30@ipxe.org>
Sun, 22 Jun 2025 08:45:09 +0000 (09:45 +0100)
commit25fa01822b7864ace7abe792e81662ea291e87fa
tree54d79c022a291c7d43b84c67af197f89373f8678
parent53a3befb692a34ef84047a0fe3320a0ec04d8d9d
[riscv] Serialise MMIO accesses with respect to each other

iPXE drivers have been written with the implicit assumption that MMIO
writes are allowed to be posted but that an MMIO register read or
write after another MMIO register write will always observe the
effects of the first write.

For example: after having written a byte to the transmit holding
register (THR) of a 16550 UART, it is expected that any subsequent
read of the line status register (LSR) will observe a value consistent
with the occurrence of the write.

RISC-V does not seem to provide any ordering guarantees between
accesses to different registers within the same MMIO device.  Add
fences as part of the MMIO accessors to provide the assumed
guarantees.

Use "fence io, io" before each MMIO read or write to enforce full
serialisation of MMIO accesses with respect to each other.  This is
almost certainly more conservative than is strictly necessary.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/arch/riscv/include/ipxe/riscv_io.h