From owner-cvs-src@FreeBSD.ORG Thu Mar 2 07:21:25 2006 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5316616A420; Thu, 2 Mar 2006 07:21:25 +0000 (GMT) (envelope-from ru@ip.net.ua) Received: from tigra.ip.net.ua (tigra.ip.net.ua [82.193.96.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id A983943D45; Thu, 2 Mar 2006 07:21:24 +0000 (GMT) (envelope-from ru@ip.net.ua) Received: from localhost (rocky.ip.net.ua [82.193.96.2]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id k227LMc9003798; Thu, 2 Mar 2006 09:21:22 +0200 (EET) (envelope-from ru@ip.net.ua) Received: from tigra.ip.net.ua ([82.193.96.10]) by localhost (rocky.ip.net.ua [82.193.96.2]) (amavisd-new, port 10024) with LMTP id 88881-05-2; Thu, 2 Mar 2006 09:21:08 +0200 (EET) Received: from heffalump.ip.net.ua (heffalump.ip.net.ua [82.193.96.213]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id k227Ickx003689 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 2 Mar 2006 09:18:38 +0200 (EET) (envelope-from ru@ip.net.ua) Received: (from ru@localhost) by heffalump.ip.net.ua (8.13.4/8.13.4) id k227IoxU023323; Thu, 2 Mar 2006 09:18:50 +0200 (EET) (envelope-from ru) Date: Thu, 2 Mar 2006 09:18:49 +0200 From: Ruslan Ermilov To: Scott Long Message-ID: <20060302071849.GH29183@ip.net.ua> References: <200602281958.k1SJwvGL051504@repoman.freebsd.org> <20060301232621.GF29183@ip.net.ua> <20060301233327.GQ840@funkthat.com> <4406334F.7070205@samsco.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PNpeiK4tTqhYOExY" Content-Disposition: inline In-Reply-To: <4406334F.7070205@samsco.org> User-Agent: Mutt/1.5.11 X-Virus-Scanned: amavisd-new at ip.net.ua Cc: cvs-src@FreeBSD.org, John-Mark Gurney , src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/share/man/man9 bus_dma.9 X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Mar 2006 07:21:25 -0000 --PNpeiK4tTqhYOExY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 01, 2006 at 04:50:39PM -0700, Scott Long wrote: > John-Mark Gurney wrote: > >Ruslan Ermilov wrote this message on Thu, Mar 02, 2006 at 01:26 +0200: > > > >>On Tue, Feb 28, 2006 at 07:58:57PM +0000, John-Mark Gurney wrote: > >> > >>>jmg 2006-02-28 19:58:57 UTC > >>> > >>> FreeBSD src repository > >>> > >>> Modified files: > >>> share/man/man9 bus_dma.9=20 > >>> Log: > >>> update examples to use the correct terms that was never updated when = the > >>> earlier descriptions were gone over... > >>>=20 > >>> MFC after: 3 days > >>>=20 > >>> Revision Changes Path > >>> 1.32 +3 -3 src/share/man/man9/bus_dma.9 > >>> > >> > >>Not enough of fixing: "DMA read" and "DMA write" are also entangled her= e. > > > > > >Nope... WRITE =3D=3D DMA read... Read the descriptions of the flags > >very carefully... If you aren't confused, you don't understand it.. > >The reason you're confused is the reason why everyone gets it wrong, > >and no one ever gets it correct the first time trying to figure out > >which one to use... > > >=20 WRITE =3D=3D DMA write, it's not THAT confusing, please see below. :-) > Think of it from the perspective of the driver doing an operation. If=20 > the driver is reading a block off the disk, then you want to use the ^^^^^^^ > PREREAD/POSTREAD operations. ^^^^^^^^^^^^^^^^ >=20 Correct. So driver tells a device to "read directly into memory", a DMA read operation. Similarly for writes. A CPU "writes directly into device memory", a DMA write operation. > Likewise for writes. It is done this way > for clarity in the driver. I can't imagine how many bugs we'd have if > write =3D=3D read in the driver sources. >=20 Yes, that fits my understanding of how things work, and that's what we have clarified in the manpage not so long ago: : All operations specified below are performed from the host mem- : ory point of view, where a read implies data coming from the ^^^^ ^^^^^^^^ : device to the host memory, and a write implies data going from ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ ^^^^ : the host memory to the device. Alternately, the operations can ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ : be thought of in terms of driver operations, where reading a : network packet or storage sector corresponds to a read operation : in bus_dma. :=20 : BUS_DMASYNC_PREREAD Perform any synchronization required : prior to an update of host memory by the : DMA read operation. :=20 : BUS_DMASYNC_PREWRITE Perform any synchronization required : after an update of host memory by the CPU : and prior to DMA write operations. :=20 : BUS_DMASYNC_POSTREAD Perform any synchronization required : after DMA read operations and prior to : CPU access to host memory. :=20 : BUS_DMASYNC_POSTWRITE Perform any synchronization required : after DMA write operations. However, the text that John-Mark has correctly changed now looks like this: : bus_dmamap_sync() is the method used to ensure that CPU and : device DMA access to shared memory is coherent. For example, : the CPU might be used to setup the contents of a buffer that is : to be DMA'ed into a device. That's DMA write. : To ensure that the data are visible : via the device's mapping of that memory, the buffer must be : loaded and a dma sync operation of BUS_DMASYNC_PREWRITE must be ^^^^^^^^^^^^^^^^^^^^ OK! : performed. Additional sync operations must be performed after : every CPU write to this memory if additional DMA reads are to be ^^^^^^^^^ should be "write" : performed. Conversely, for the DMA write case, the buffer must ^^^^^ should be "read" : be loaded, and a dma sync operation of BUS_DMASYNC_PREREAD must ^^^^^^^^^^^^^^^^^^^ OK! : be performed. The CPU will only be able to see the results of : this DMA write once the DMA has completed and a ^^^^^ should be "read" : BUS_DMASYNC_POSTREAD operation has been performed. ^^^^^^^^^^^^^^^^^^^^ OK! Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --PNpeiK4tTqhYOExY Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (FreeBSD) iD8DBQFEBpxZqRfpzJluFF4RAmK+AJ0f2fHNBFQsnW/JSW1CVTgiUSaFNQCfQ6EU gPa6mtCQcusYeMpaH+aLvtY= =IYXP -----END PGP SIGNATURE----- --PNpeiK4tTqhYOExY--