Skip to contentSkip to conversation

Patch "dmaengine: rcar-dmac: unmap slave resource when channel is freed" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Jan 23, 2017

Subsystems (3)
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: rcar-dmac: unmap slave resource when channel is freed

to the 4.9-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-rcar-dmac-unmap-slave-resource-when-channel-is-freed.patch
and it can be found in the queue-4.9 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 3139dc8ded6f27552a248d23fe9f086e3027fa12 Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= <[email protected]>
Date: Wed, 11 Jan 2017 15:39:31 +0100
Subject: dmaengine: rcar-dmac: unmap slave resource when channel is freed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From: Niklas Söderlund <[email protected]>

commit 3139dc8ded6f27552a248d23fe9f086e3027fa12 upstream.

The slave mapping should be removed together with other channel resources when the channel is freed. If it's not unmapped it will hang around forever after the channel is freed.

Fixes 9f878603dbdb7db3 ("dmaengine: rcar-dmac: add iommu support for slave transfers")
---
 drivers/dma/sh/rcar-dmac.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/dma/sh/rcar-dmac.c +8 -0
@@ -986,6 +986,7 @@ static void rcar_dmac_free_chan_resource
 {
 	struct rcar_dmac_chan *rchan = to_rcar_dmac_chan(chan);
 	struct rcar_dmac *dmac = to_rcar_dmac(chan->device);
+	struct rcar_dmac_chan_map *map = &rchan->map;
 	struct rcar_dmac_desc_page *page, *_page;
 	struct rcar_dmac_desc *desc;
 	LIST_HEAD(list);
@@ -1019,6 +1020,13 @@ static void rcar_dmac_free_chan_resource
 		free_page((unsigned long)page);
 	}
 
+	/* Remove slave mapping if present. */
+	if (map->slave.xfer_size) {
+		dma_unmap_resource(chan->device->dev, map->addr,
+				   map->slave.xfer_size, map->dir, 0);
+		map->slave.xfer_size = 0;
+	}
+
 	pm_runtime_put(chan->device->dev);
 }
 

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

queue-4.9/dmaengine-rcar-dmac-unmap-slave-resource-when-channel-is-freed.patch