From owner-freebsd-hackers@FreeBSD.ORG Fri Jan 8 13:47:21 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6ED951065679 for ; Fri, 8 Jan 2010 13:47:21 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 4233F8FC0C for ; Fri, 8 Jan 2010 13:47:21 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id EB1C046B23; Fri, 8 Jan 2010 08:47:20 -0500 (EST) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 223658A027; Fri, 8 Jan 2010 08:47:20 -0500 (EST) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Fri, 8 Jan 2010 08:33:49 -0500 User-Agent: KMail/1.12.1 (FreeBSD/7.2-CBSD-20091103; KDE/4.3.1; amd64; ; ) References: <201001072117.o07LHq7o015571@casselton.net> In-Reply-To: <201001072117.o07LHq7o015571@casselton.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201001080833.49246.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Fri, 08 Jan 2010 08:47:20 -0500 (EST) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Mark Tinguely Subject: Re: bus_dmamap_load_uio() and user data X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2010 13:47:21 -0000 On Thursday 07 January 2010 4:17:52 pm Mark Tinguely wrote: > > In the user space case of bus_dmamap_load_uio(), the calling thread is > stored in uio->uio_td, in which the user's pmap can be determined. > > The ARM processor, with the possible exception of the ARMv7 MPcore > with snoop control unit, needs to make the caches consistent before > DMA. I noticed that the routine, _bus_dmamap_sync(), copies data into > the bounce buffer using current pmap. > > Can/should we assume the uio sent from to bus_dmamap_load_uio() is > always in the same address space as thread that is executing > the _bus_dmamap_sync()? You should use the pmap from the thread in the uio structure. Similar to this from the x86 bus_dma code: if (uio->uio_segflg == UIO_USERSPACE) { KASSERT(uio->uio_td != NULL, ("bus_dmamap_load_uio: USERSPACE but no proc")); pmap = vmspace_pmap(uio->uio_td->td_proc->p_vmspace); } else pmap = NULL; Later when doing VA -> PA conversions the code does this: if (pmap) paddr = pmap_extract(pmap, vaddr); else paddr = pmap_kextract(vaddr); -- John Baldwin