From owner-svn-src-all@freebsd.org Wed Jul 8 14:36:16 2015 Return-Path: Delivered-To: svn-src-all@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 A8D639966FF for ; Wed, 8 Jul 2015 14:36:16 +0000 (UTC) (envelope-from zbb@semihalf.com) Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com [209.85.212.171]) (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 4D91A160C for ; Wed, 8 Jul 2015 14:36:16 +0000 (UTC) (envelope-from zbb@semihalf.com) Received: by wifm2 with SMTP id m2so91606514wif.1 for ; Wed, 08 Jul 2015 07:36:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=jsneosZf5cX0ZthTgY0BDFsoK4MEjamjLrVRgmLmP7w=; b=UV80z2qwE6QzgzcH3qbPAs8o53LRTGDD+/LV5bKXAGF75qSoN5jPzTXGk4d+/EeEPC 2MIe3gHr8fgDmTyJSZneObHOib5JaHkFc5C8GdOMhXS0cRBEk7XQJTLIkoVkFFDwtoKs IJLv1sck4szZfrODOUJm/0+CXOyeUObZHqJQBH7OwzuumRxVTPALGTTBxxbGxksTcmlW kKwUwIos8YKgc7Wx4B2N4AYSmUxp869G6cn1nMcDgIkZplIuodmQ/I8An6nr4Qu1kgia OovuQuIxOAsxODCg7MFvOLfKwIs59xYXR2/hhFdIkbFyPx/8EyQ6ikar5fOoxkq7d/dK n90Q== X-Gm-Message-State: ALoCoQnhemGLwI84dVFaGL/aoK5rUkJWyyW+73m+yFkXJ/6/o9yLuopujW2yHoA8VoC/jfy4dMoQ X-Received: by 10.194.59.98 with SMTP id y2mr20687134wjq.42.1436366169518; Wed, 08 Jul 2015 07:36:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.180.75.12 with HTTP; Wed, 8 Jul 2015 07:35:50 -0700 (PDT) In-Reply-To: References: <201507081353.t68Dr0up028388@repo.freebsd.org> From: Zbigniew Bodek Date: Wed, 8 Jul 2015 16:35:50 +0200 Message-ID: Subject: Re: svn commit: r285270 - head/sys/sys To: Adrian Chadd Cc: Zbigniew Bodek , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jul 2015 14:36:16 -0000 Because machdep header includes this file (not the other way). Best regards zbb 2015-07-08 16:30 GMT+02:00 Adrian Chadd : > Why is this implemented in sys/sys/bus_dma.h, rather than in a machdep header? > > > -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) >> >> /* >> > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"