dmaengine: xilinx: Introduce synchronize() callback
authorLars-Peter Clausen <lars@metafoo.de>
Sat, 13 Mar 2021 12:53:11 +0000 (13:53 +0100)
committerVinod Koul <vkoul@kernel.org>
Tue, 16 Mar 2021 10:45:32 +0000 (16:15 +0530)
commit50db2050faf854cbaf4b6557a7a8ca21bff302ae
tree54651f10b63e5068c3a1b3a9b453efb4195a9a48
parenta38fd8748464831584a19438cbb3082b5a2dab15
dmaengine: xilinx: Introduce synchronize() callback

The Xilinx dmaengine driver uses a tasklet to process completed
descriptors and execute their callbacks.

Currently consumers of the DMA channel have to no method of synchronization
against this tasklet when using the Xilinx dmaengine drivers. This can lead
to race conditions when the consumer frees resources that are accessed in
the callback before the tasklet has finished running.

It is not enough to just call dmaengine_terminal_all() since on a
multi-processor system the tasklet can run concurrently to it and might
call the callback after dmaengine_terminate_all() has already finished.

To mitigate this issue implement the synchronize() callback for the driver,
which will wait until the tasklet has finished.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20210313125311.4823-1-lars@metafoo.de
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/xilinx/xilinx_dma.c