ARM_DRAIN_WRITEBUF(2)

NAME
arm_drain_writebuf - drain pending writes from cores and caches

LIBRARY
libc

SYNOPSIS
#include <machine/sysarch.h>
int
arm_drain_writebuf(void);

DESCRIPTION
The arm_drain_writebuf system call causes all pending writes from ARM cores and caches to be written out to main memory or memory-mapped I/O registers. Not all hardware supports buffered writes; on such systems the arm_drain_writebuf function is a no-op.

On ARMv5 systems, this executes a cp15 coprocessor “drain write buffer” operation. On ARMv6 and ARMv7 systems, this executes a “DSB SY” synchronization barrier, followed by an L2 cache drain on systems where the DSB does not include L2 automatically.

arm_drain_writebuf attempts to wait for the drain operation to complete, but cannot guarantee the writes have reached their ultimate destination on all hardware. For example, on an ARMv7 system, arm_drain_writebuf tells the L2 cache controller to drain its buffers, and it waits until the controller indicates that operation is complete. However, all the L2 controller knows is that the data was accepted for delivery by the AXI bus. If the ultimate destination of the write is a device on a subordinate bus connected to the AXI bus, more buffering or other delays may occur on that subordinate bus. The only way to be certain a pending write has reached its ultimate destination is to issue a read from that destination after arm_drain_writebuf returns.

RETURN VALUES
The arm_drain_writebuf system call cannot fail, and always returns 0.

AUTHORS
This man page was written by Ian Lepore.