On 2 November 2016 at 20:02, Jan Dąbroś jsd@semihalf.com wrote:
Hi Ard,
I have a question regarding DmaLib implementation. We took a deeper look at AHCI controller and it will be coherent on newer SoC version - as for now, we have non-coherent one and it's not working with NullDmaLib, whereas everything is ok when ArmDmaLib is used. In the same time, tests show that XHCI works fine both with NullDmaLib and ArmDmaLib. My question is, what are the contraindications for using ArmDmaLib for coherent devices if it is working good on them also? This solution seems to be covering for every case (contrary to NullDmaLib).
No, ArmDmaLib is fundamentally incompatible with coherent devices. The code performs a cache invalidate for data written by the bus master, since on non-coherent systems, this may be necessary to get rid of stale cachelines that shadow the incoming data. On coherent devices, the device will write to the cache, not to main memory, and so this cache invalidation will discard the data coming from the device.