From owner-svn-src-head@freebsd.org Wed Jul 8 17:51:37 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 035F1996F59; Wed, 8 Jul 2015 17:51:37 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: from mail-la0-x22b.google.com (mail-la0-x22b.google.com [IPv6:2a00:1450:4010:c03::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7B8A41FB7; Wed, 8 Jul 2015 17:51:36 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: by lagc2 with SMTP id c2so227611556lag.3; Wed, 08 Jul 2015 10:51:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=gPEC55qpA2enBy8MTzKFsSnWxZ5gQLMZdnPQqHJNSiI=; b=MAc3DIGtR6vk+/s2kv3kuyo6rhhGoX1hLax8LN+tXR25bq1tiI3aMrXyMgRTXjs9lL FxNPvmAs+glfPX476w1bwYqWWJhJytGo0li/cHmTxnw4s5pav1dNJjOTyWGmUbFXzIIZ Z/dmhuOTyyOEktVOxLcZgZlbLBmcGEvM+PODGMj5TqJsVhaUy6nFBTxFwL0ZBxBST9UP A31cdu/DUrhnu20BGBBB+Zc7c0U4CsR5tcuVHa+k7sKYXeZwJLru1iAsBGpg4vUHvBxj miihwLavKi0t4sfLaWuksd5pbVO+adYDLVPWr/aRfBeBdeOR8DOBefehOV4V4JMFRZ2x 2ovw== MIME-Version: 1.0 X-Received: by 10.112.137.164 with SMTP id qj4mr10616308lbb.105.1436377894522; Wed, 08 Jul 2015 10:51:34 -0700 (PDT) Received: by 10.112.42.162 with HTTP; Wed, 8 Jul 2015 10:51:34 -0700 (PDT) In-Reply-To: References: <201507081353.t68Dr0up028388@repo.freebsd.org> <1436366547.1334.81.camel@freebsd.org> Date: Wed, 8 Jul 2015 12:51:34 -0500 Message-ID: Subject: Re: svn commit: r285270 - head/sys/sys From: Jason Harmening To: Adrian Chadd Cc: Ian Lepore , Zbigniew Bodek , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 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 17:51:37 -0000 +2 This has always bugged me. I'll do it if no one else gets to it first. If the new pmap KPI makes it in, I'll be messing with a bunch of the MD busdma code anyway. On Wed, Jul 8, 2015 at 9:47 AM, Adrian Chadd wrote: > On 8 July 2015 at 07:42, Ian Lepore wrote: > > On Wed, 2015-07-08 at 07:30 -0700, Adrian Chadd wrote: > >> Why is this implemented in sys/sys/bus_dma.h, rather than in a machdep > header? > >> > >> > > > > Indeed, this stuff is a mess that really needs to be cleaned up. The > > pre-existing assumption that MI functions don't need to be called, just > > because one of the parameters of that function has some value that has a > > special meaning on one platform, is purely x86-MD code in an MI header > > file. This change just complicates the existing mess. > > +1 > > (So who's going to do it? I'm already taken.) > > > > -a > > >> -a > >> > >> > >> On 8 July 2015 at 06:53, 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(); > >> > +#elif defined(__aarch64__) > >> > + #define __BUS_DMAMAP_SYNC_DEFAULT dmb(sy); > >> > +#else > >> > + #define __BUS_DMAMAP_SYNC_DEFAULT {} > >> > +#endif > >> > #define bus_dmamap_sync(dmat, dmamap, op) \ > >> > do { \ > >> > if ((dmamap) != NULL) \ > >> > _bus_dmamap_sync(dmat, dmamap, op); \ > >> > + else \ > >> > + __BUS_DMAMAP_SYNC_DEFAULT \ > >> > } while (0) > >> > > >> > /* > >> > > >> > > > > > >