]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.19.31/arm-8835-1-dma-mapping-clear-dma-ops-on-teardown.patch
Linux 4.19.31
[thirdparty/kernel/stable-queue.git] / releases / 4.19.31 / arm-8835-1-dma-mapping-clear-dma-ops-on-teardown.patch
CommitLineData
36e3f504
SL
1From e2888f86feca5a2050d8181869d2b8287ad10358 Mon Sep 17 00:00:00 2001
2From: Robin Murphy <robin.murphy@arm.com>
3Date: Wed, 6 Feb 2019 18:43:24 +0100
4Subject: ARM: 8835/1: dma-mapping: Clear DMA ops on teardown
5
6[ Upstream commit fc67e6f120a388b611d94cc40baf99a5cc56b283 ]
7
8Installing the appropriate non-IOMMU DMA ops in arm_iommu_detch_device()
9serves the case where IOMMU-aware drivers choose to control their own
10mapping but still make DMA API calls, however it also affects the case
11when the arch code itself tears down the mapping upon driver unbinding,
12where the ops now get left in place and can inhibit arch_setup_dma_ops()
13on subsequent re-probe attempts.
14
15Fix the latter case by making sure that arch_teardown_dma_ops() cleans
16up whenever the ops were automatically installed by its counterpart.
17
18Reported-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
19Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
20Fixes: 1874619a7df4 "ARM: dma-mapping: Set proper DMA ops in arm_iommu_detach_device()"
21Tested-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
22Tested-by: Thierry Reding <treding@nvidia.com>
23Signed-off-by: Robin Murphy <robin.murphy@arm.com>
24Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
25Signed-off-by: Sasha Levin <sashal@kernel.org>
26---
27 arch/arm/mm/dma-mapping.c | 2 ++
28 1 file changed, 2 insertions(+)
29
30diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
31index 1cb9c0f9b5d6..8211cf45ece1 100644
32--- a/arch/arm/mm/dma-mapping.c
33+++ b/arch/arm/mm/dma-mapping.c
34@@ -2400,4 +2400,6 @@ void arch_teardown_dma_ops(struct device *dev)
35 return;
36
37 arm_teardown_iommu_dma_ops(dev);
38+ /* Let arch_setup_dma_ops() start again from scratch upon re-probe */
39+ set_dma_ops(dev, NULL);
40 }
41--
422.19.1
43