Subject: Re: memory questions
To: Filka Michal <firstname.lastname@example.org>
From: Quentin Garnier <email@example.com>
Date: 04/12/2006 13:12:01
Content-Type: text/plain; charset=us-ascii
On Wed, Apr 12, 2006 at 12:52:49PM +0200, Filka Michal wrote:
> Yes, provided you do it properly.
> ... it means?
> If you want to DMA directly into user memory,
> you have to (a) make sure the relevant pages are locked in memory for
> the duration and (b) do the correct dance to make sure caches and such
> are properly handled - this is part of why bus_dma exists, so the
> driver code can be insulated from the (heavily machine-specific)
> details of this dance..
> ... No I really don't want such thing. I have allocated a buffer for DMA
> access (bus_dmamem_alloc). I need to do some operations above it (namely
> Rx/Tx descriptors are stored there), but sometimes it fails (page
> fault). As I understand DMA in NetBSD, there are two views on same part
> of memory. First view is the "physical" one which is used by device,
> second one is "logical". In logical view is memory for DMA access mapped
> into virtual memory space. I simplified the description a little.
> However, I thought that pages forming logical view cannot be swapped out
> of memory. Is it correct idea?
You're probably mixing one for the other in your code. Accessing the
physical address from the kernel will almost certainly give you a page
fault. Unless you show some code where we could point at the errors,
you'll get little more information here than provided in bus_dma(9) and
source of NetBSD drivers.
Quentin Garnier - firstname.lastname@example.org - cube@NetBSD.org
"When I find the controls, I'll go where I like, I'll know where I want
to be, but maybe for now I'll stay right here on a silent sea."
KT Tunstall, Silent Sea, Eye to the Telescope, 2004.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)
-----END PGP SIGNATURE-----