Trouble with DMA on PPC linux question

Bruce_Leonard at selinc.com Bruce_Leonard at selinc.com
Wed Apr 20 03:11:45 AEST 2016


Ben,

Benjamin Herrenschmidt <benh at au1.ibm.com> wrote on 04/19/2016 01:45:40 AM:

> From: Benjamin Herrenschmidt <benh at au1.ibm.com>
> To: Bruce_Leonard at selinc.com, linuxppc-dev at lists.ozlabs.org
> Date: 04/19/2016 01:46 AM
> Subject: Re: Trouble with DMA on PPC linux question
> 
> On Mon, 2016-04-18 at 14:54 -0700, Bruce_Leonard at selinc.com wrote:
> > 
> > On the DMA transactions that work, the virtual address I hand to 
> > dma_map_single() is something like 0xe0840000 and the dma_addr_t 
result is 
> > 0x10840000 which is less than my 512Mb limit.  On the transactions 
that 
> > don't work, the virtual address is 0xd5390000 with the mapped result 
being 
> > 0x25390000, which is past my upper bound on my RAM.  In fact it's not 
even 
> > in my memory map, there's a hole there. 
> 
> Where does this virtual address come from ?
> 
> The kernel has two types of virtual addresses. Those coming from the
> linear mapping (the stuff you get from kmalloc() for example, or
> get_pages()) which can be translated using that simple substraction.
> 
> The other is the vmalloc space, and that is a non-linear mapping of
> random pages.
> 
> If your vaddr comes from the latter it can't be passed to
> dma_map_single as-is, you need to get to the underlying pages first.
> 
> Ben.
> 

That's a good question.  I'm not sure where the addresses come from right 
now (they're handed to me from the MTD layer), but I'll certainly dig into 
that and see.

Thanks for the help!  I appreciate the pointer.

Bruce


More information about the Linuxppc-dev mailing list