Skip to contentSkip to conversation

Patch "dmaengine: bcm2835-dma: Use vchan_terminate_vdesc() instead of desc_free" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Mar 16, 2018

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

dmaengine: bcm2835-dma: Use vchan_terminate_vdesc() instead of desc_free

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
dmaengine-bcm2835-dma-use-vchan_terminate_vdesc-instead-of-desc_free.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Fri Mar 16 15:43:17 CET 2018

From: Peter Ujfalusi <[email protected]>
Date: Tue, 14 Nov 2017 16:32:07 +0200
Subject: dmaengine: bcm2835-dma: Use vchan_terminate_vdesc() instead of desc_free

From: Peter Ujfalusi <[email protected]>

[ Upstream commit de92436ac40ffe9933230aa503e24dbb5ede9201 ]

To avoid race with vchan_complete, use the race free way to terminate running transfer.

Implement the device_synchronize callback to make sure that the terminated descriptor is freed.

---
 drivers/dma/bcm2835-dma.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/dma/bcm2835-dma.c +9 -1
@@ -812,7 +812,7 @@ static int bcm2835_dma_terminate_all(str
 	 * c->desc is NULL and exit.)
 	 */
 	if (c->desc) {
-		bcm2835_dma_desc_free(&c->desc->vd);
+		vchan_terminate_vdesc(&c->desc->vd);
 		c->desc = NULL;
 		bcm2835_dma_abort(c->chan_base);
 
@@ -836,6 +836,13 @@ static int bcm2835_dma_terminate_all(str
 	return 0;
 }
 
+static void bcm2835_dma_synchronize(struct dma_chan *chan)
+{
+	struct bcm2835_chan *c = to_bcm2835_dma_chan(chan);
+
+	vchan_synchronize(&c->vc);
+}
+
 static int bcm2835_dma_chan_init(struct bcm2835_dmadev *d, int chan_id,
 				 int irq, unsigned int irq_flags)
 {
@@ -942,6 +949,7 @@ static int bcm2835_dma_probe(struct plat
 	od->ddev.device_prep_dma_memcpy = bcm2835_dma_prep_dma_memcpy;
 	od->ddev.device_config = bcm2835_dma_slave_config;
 	od->ddev.device_terminate_all = bcm2835_dma_terminate_all;
+	od->ddev.device_synchronize = bcm2835_dma_synchronize;
 	od->ddev.src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);
 	od->ddev.dst_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);
 	od->ddev.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV) |

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/dmaengine-bcm2835-dma-use-vchan_terminate_vdesc-instead-of-desc_free.patch queue-4.14/dmaengine-amba-pl08x-use-vchan_terminate_vdesc-instead-of-desc_free.patch