1.\" Copyright (c) 2019 Ian Lepore <ian@FreeBSD.org> 2.\" 3.\" Redistribution and use in source and binary forms, with or without 4.\" modification, are permitted provided that the following conditions 5.\" are met: 6.\" 1. Redistributions of source code must retain the above copyright 7.\" notice, this list of conditions and the following disclaimer. 8.\" 2. Redistributions in binary form must reproduce the above copyright 9.\" notice, this list of conditions and the following disclaimer in the 10.\" documentation and/or other materials provided with the distribution. 11.\" 12.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 13.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 15.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 16.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 17.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 18.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 19.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 20.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 21.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 22.\" SUCH DAMAGE. 23.\" 24.Dd July 10, 2019 25.Dt ARM_DRAIN_WRITEBUF 2 26.Os 27.Sh NAME 28.Nm arm_drain_writebuf 29.Nd drain pending writes from cores and caches 30.Sh LIBRARY 31.Lb libc 32.Sh SYNOPSIS 33.In machine/sysarch.h 34.Ft int 35.Fn arm_drain_writebuf void 36.Sh DESCRIPTION 37The 38.Nm 39system call causes all pending writes from ARM cores and caches to be 40written out to main memory or memory-mapped I/O registers. 41Not all hardware supports buffered writes; on such systems the 42.Nm 43function is a no-op. 44.Pp 45This executes a 46.Dq DSB SY 47synchronization barrier, followed by an L2 cache drain on 48systems where the DSB does not include L2 automatically. 49.Pp 50.Nm 51attempts to wait for the drain operation to complete, but cannot 52guarantee the writes have reached their ultimate destination on all hardware. 53For example, on an ARMv7 system, 54.Nm 55tells the L2 cache controller to drain its buffers, and it waits until 56the controller indicates that operation is complete. 57However, all the L2 controller knows is that the data was accepted for 58delivery by the AXI bus. 59If the ultimate destination of the write is a device on a subordinate 60bus connected to the AXI bus, more buffering or other delays may occur 61on that subordinate bus. 62The only way to be certain a pending write has reached its 63ultimate destination is to issue a read from that destination after 64.Nm 65returns. 66.Sh RETURN VALUES 67The 68.Nm 69system call cannot fail, and always returns 0. 70.Sh AUTHORS 71This man page was written by 72.An Ian Lepore . 73