From owner-svn-src-head@freebsd.org Wed Jul 8 13:58:54 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89C7B995DFE; Wed, 8 Jul 2015 13:58:54 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from kif.fubar.geek.nz (kif.fubar.geek.nz [178.62.119.249]) by mx1.freebsd.org (Postfix) with ESMTP id 5786B1CAE; Wed, 8 Jul 2015 13:58:54 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from bender (bender.sec.cl.cam.ac.uk [IPv6:2001:630:212:2a8:4e72:b9ff:fe93:61bf]) by kif.fubar.geek.nz (Postfix) with ESMTPSA id 2BD7FD7907; Wed, 8 Jul 2015 13:58:24 +0000 (UTC) Date: Wed, 8 Jul 2015 14:58:23 +0100 From: Andrew Turner To: Zbigniew Bodek Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r285270 - head/sys/sys Message-ID: <20150708145823.50ae6395@bender> In-Reply-To: <201507081353.t68Dr0up028388@repo.freebsd.org> References: <201507081353.t68Dr0up028388@repo.freebsd.org> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.27; amd64-portbld-freebsd10.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jul 2015 13:58:54 -0000 On Wed, 8 Jul 2015 13:53:00 +0000 (UTC) Zbigniew Bodek wrote: > Author: zbb > Date: Wed Jul 8 13:52:59 2015 > New Revision: 285270 > URL: https://svnweb.freebsd.org/changeset/base/285270 > > Log: > Add memory barrier to bus_dmamap_sync() > > On platforms which are fully IO-coherent, the map might be null. > We need to guarantee that all data is observable after the > sync operation is called. Add a memory barrier to ensure that on > ARM. > Reviewed by: andrew, kib > Obtained from: Semihalf > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D3012 > > Modified: > head/sys/sys/bus_dma.h > > Modified: head/sys/sys/bus_dma.h > ============================================================================== > --- head/sys/sys/bus_dma.h Wed Jul 8 13:19:13 2015 > (r285269) +++ head/sys/sys/bus_dma.h Wed Jul 8 13:52:59 > 2015 (r285270) @@ -282,13 +282,25 @@ int > bus_dmamem_alloc(bus_dma_tag_t dmat, void > bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map); > /* > - * Perform a synchronization operation on the given map. > + * Perform a synchronization operation on the given map. If the map > + * is NULL we have a fully IO-coherent system. On every ARM > architecture > + * there must be a memory barrier placed to ensure that all data > + * accesses are visible before going any further. > */ > void _bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_dmasync_op_t); > +#if defined(__arm__) > + #define __BUS_DMAMAP_SYNC_DEFAULT mb(); Should this be a dmb or dsb? mb() is implemented as the former on ARMv7, and as the equivalent using mcr on ARMv6. Only on ARMv4 and ARMv5 is it a dsb. Andrew