From owner-freebsd-current@FreeBSD.ORG Tue Jan 10 21:52:51 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6FE41065785 for ; Tue, 10 Jan 2012 21:52:50 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id 2F0E88FC0C for ; Tue, 10 Jan 2012 21:52:49 +0000 (UTC) Received: by vcbfk1 with SMTP id fk1so62430vcb.13 for ; Tue, 10 Jan 2012 13:52:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=LjW99kdMh1QQy+HKKIJuxyhpJn88CFaURLXNr0uAoEI=; b=mWxHxeLt8z5rY0xcyQNN1QY0J2SCuhiEvrGWoO3XDtsCIG9c3/NK1pMetoqRQQT1g6 jgSbRR7uElQBthDZKlZojTFkNxDHUTt3xQeDZ6Ozuu1PMY9Ulsd0ONgZiPfATdclCJnt SiEszHsYvlU32tzXTfxX+cph073iUJFENIGf8= MIME-Version: 1.0 Received: by 10.220.149.212 with SMTP id u20mr12614122vcv.7.1326232369303; Tue, 10 Jan 2012 13:52:49 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.52.36.5 with HTTP; Tue, 10 Jan 2012 13:52:49 -0800 (PST) In-Reply-To: <20120110213719.GA92799@onelab2.iet.unipi.it> References: <20120110213719.GA92799@onelab2.iet.unipi.it> Date: Tue, 10 Jan 2012 13:52:49 -0800 X-Google-Sender-Auth: s9C1sLVaZOyyMoGsaLmDtP9oyGg Message-ID: From: Adrian Chadd To: Luigi Rizzo Content-Type: text/plain; charset=ISO-8859-1 Cc: FreeBSD current Subject: Re: memory barriers in bus_dmamap_sync() ? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 21:52:51 -0000 On 10 January 2012 13:37, Luigi Rizzo wrote: > I was glancing through manpages and implementations of bus_dma(9) > and i am a bit unclear on what this API (in particular, bus_dmamap_sync() ) > does in terms of memory barriers. > > I see that the x86/amd64 and ia64 code only does the bounce buffers. > The mips seems to do some coherency-related calls. > > How do we guarantee, say, that a recently built packet is > to memory before issuing the tx command to the NIC ? The drivers should be good examples of doing the right thing. You just do pre-map and post-map calls as appropriate. Some devices don't bother with this on register accesses and this is a bug. (eg, ath/ath_hal.) Others (eg iwn) do explicit flushes where needed. Adrian