On Wed, 8 Jul 2020 at 11:56, Van Leeuwen, Pascal <pvanleeu...@rambus.com> wrote: > > Hi, > > I have a question on behalf of a customer of ours trying to use the > inside-secure crypto > API driver. They are experiencing issues with result data not arriving in the > result buffer. > This seems to have something to do with not being able to DMA to said buffer, > as they > can workaround the issue by explicitly allocating a DMA buffer on the fly and > copying > data from there to the original destination. > > The problem I have is that I do not have access to their hardware and the > driver seems > to work just fine on any hardware (both x64 and ARM64) I have available > here, so I > have to approach this purely theoretically ... > > For the situation where this problem is occuring, the actual buffers are > stored inside > the ahash_req structure. So my question is: is there any reason why this > structure may > not be DMA-able on some systems? (as I have a hunch that may be the problem > ...) >
If DMA is non-coherent, and the ahash_req structure is also modified by the CPU while it is mapped for DMA, you are likely to get a conflict. It should help if you align the DMA-able fields sufficiently, and make sure you never touch them while they are mapped for writing by the device.