An address range reaches a device

A device can expose registers or dedicated memory in a system address space. Linux drivers obtain resource information and create a suitable mapping, for example through ioremap, rather than treating the resource address as an ordinary dereferenceable pointer.

Port I/O is a different interface, potentially using a separate address space and special instructions. Valid addresses, widths and access forms depend on the device and platform.

References: [1]

Accessors carry width and ordering requirements

Linux supplies device accessors such as readl and writel and I/O-specific copying functions. Ordinary memcpy or arbitrary pointer accesses do not guarantee the device-required sequence, width or byte order.

Relaxed accessors can reduce ordering costs only where the protocol permits. RISC-V FENCE distinguishes device input and output from ordinary memory reads and writes, so address-based operations still have distinct ordering domains.

References: [1] [2]

Issuing a write differs from device receipt

Some buses buffer device writes, as with PCI posted writes. Completing the CPU-side write instruction need not establish device receipt. Linux documentation describes appropriate reads from the same device when a protocol needs to drain such writes.

This completion question differs from synchronizing shared RAM between CPUs. Mapping attributes, register side effects and bus rules matter, so a generic variable or barrier cannot replace the device’s required confirmation protocol.

References: [1] [3]