On Tue, Jan 28, 2014 at 12:37:43PM +0000, Mark Brown wrote:
On Tue, Jan 28, 2014 at 01:06:29PM +0100, Lars-Peter Clausen wrote:
The virt_dma helper functions already take care of some of the cyclic specific details. And more can probably be added. E.g. what comes to mind is the tracking of whether a descriptor is cyclic and which segment of the descriptor to submit next. All users of virt_dma already implement these in almost the same fashion. So this would not only to allow to factor out the handling for the cyclic case, but also for the non cyclic case. And for all users of those helpers cyclic support would essentially be free.
OK, I had a brief look and that does seem like the way forwards - I had been remembering the last time this was discussed when the DMA guys were pretty uncomfortable with the idea of doing things there but it seems things are different now.
I don't want virt_dma to do any tracking of which part of the descriptor is to be submitted next, because that needlessly makes virt_dma harder to use on hardware which you can generate the scatterlist in memory and have the hardware walk it, only notifying when it reaches the end of the list.
I also want to leave the door open for DMA implementations that decide to extend such a list when the next descriptor(s) is/are issued, thereby allowing hardware to move on to the next DMA task with the software only taking care of the status update and callback notification.