On 21 September 2016 at 23:29, Daniil Egranov daniil.egranov@arm.com wrote:
Hi Ard,
It's not working on Juno correctly.
On Juno, the AllocatePool() returns address of the buffer which according to the MMU translation is the same as a physical address so the address used for DMA should be the same as the buffer address . However, the DmaMap() in ArmDmaLib.c has a check for the cache alignment. The address allocated by AllocatePool() is not cache aligned so DmaMap() is reallocating the buffer with DmaAllocateBuffer() in uncached memory. At this point the buffer allocated by AllocatePool() and DMA buffer allocated by DmaAllocateBuffer() are pointing to two different physical memory addresses. That is keeping the AllocatePool() buffer with no data.
This is a Juno bug, not a driver bug. The PCI on Juno is DMA coherent, which means it should not be using ArmDmaLib for PCI DMA. The result is that the device writes into the shadow buffer using cached accesses, while the CPU's view of the same memory is uncached, which means that, when it copies back the data to the real buffer, it is seeing stale data.
Could you try moving to DmaLibNull?