Date: Fri, 8 Jan 2010 08:33:49 -0500 From: John Baldwin <jhb@freebsd.org> To: freebsd-hackers@freebsd.org Cc: Mark Tinguely <tinguely@casselton.net> Subject: Re: bus_dmamap_load_uio() and user data Message-ID: <201001080833.49246.jhb@freebsd.org> In-Reply-To: <201001072117.o07LHq7o015571@casselton.net> References: <201001072117.o07LHq7o015571@casselton.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001080833.49246.jhb>
