i.MX 6 and PCIe DMA issues

michael.moese at men.de michael.moese at men.de
Thu Jul 13 03:00:31 PDT 2017


On Thu, Jul 13, 2017 at 10:04:23AM +0100, Russell King - ARM Linux wrote:
> On Thu, Jul 13, 2017 at 09:07:19AM +0200, michael.moese at men.de wrote:
> > Ok, I hope I am correct. I alloc my memory using dma_alloc_coherent()
> > once, the dma_handle is passed to the device, with no other dma_map*()
> > or dma_sync_*() calls needed?
> 
> Correct.
Great. Thanks for the clarification. I will make sure the usage is done
the right way.

> You must always use the two addresses returned from dma_alloc_coherent()
> and never try to translate them - the DMA address is for programming
> into the hardware, and the virtual address for CPU accesses.  If you do
> try to pass these to the various translators (like virt_to_phys()) the
> result is undefined.

I was trying to just print some addresses for debugging. I removed this
again. I'm just confused, because the DMA device address seems to be the
physical one. At least the memory contains my data. The virtual memory
contains different data. 

Could it be possible this mapping on my board is going wrong?

Michael




More information about the linux-arm-kernel mailing list