Trouble with DMA on PPC linux question

Benjamin Herrenschmidt benh at au1.ibm.com
Tue Apr 19 18:45:40 AEST 2016


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.



More information about the Linuxppc-dev mailing list