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