Skip to contentSkip to conversation

arm64: Remove pointless WARN_ON in DMA teardown

PATCH New Robin Murphy 4 participants 4 messages Oct 26, 2016 – Oct 30, 2016 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: Remove pointless WARN_ON in DMA teardown

We expect arch_teardown_dma_ops() to be called very late in a device's life, after it has been removed from its bus, and thus after the IOMMU bus notifier has run. As such, even if this funny little check did make sense, it's unlikely to achieve what it thinks it's trying to do anyway. It's a residual trace of an earlier implementation which didn't belong here from the start; belatedly snuff it out.

---
 arch/arm64/mm/dma-mapping.c | 5 -----
 1 file changed, 5 deletions(-)
arch/arm64/mm/dma-mapping.c +0 -5
index 5cd0a383b14b..290a84f3351f 100644
@@ -940,11 +940,6 @@ static void __iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 
 void arch_teardown_dma_ops(struct device *dev)
 {
-	struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
-
-	if (WARN_ON(domain))
-		iommu_detach_device(domain, dev);
-
 	dev->archdata.dma_ops = NULL;
 }
 
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 arm64: Remove pointless WARN_ON in DMA teardown

Quoted 17 lines · Robin Murphy

We expect arch_teardown_dma_ops() to be called very late in a device's life, after it has been removed from its bus, and thus after the IOMMU bus notifier has run. As such, even if this funny little check did make sense, it's unlikely to achieve what it thinks it's trying to do anyway. It's a residual trace of an earlier implementation which didn't belong here from the start; belatedly snuff it out.

---
 arch/arm64/mm/dma-mapping.c | 5 -----
 1 file changed, 5 deletions(-)
arch/arm64/mm/dma-mapping.c +0 -0
index 5cd0a383b14b..290a84f3351f 100644

arch/arm64/mm/dma-mapping.c static void __iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, · line 944

Quoted 10 lines
arch/arm64/mm/dma-mapping.c +0 -5
@@ -940,11 +940,6 @@ static void __iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 
 void arch_teardown_dma_ops(struct device *dev)
 {
-	struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
-
-	if (WARN_ON(domain))
-		iommu_detach_device(domain, dev);
-
 	dev->archdata.dma_ops = NULL;
 }

I guess Catalin will pick this up when he starts queueing things for 4.10.

Will

#2 lore raw

PATCH 1/1 arm64: Remove pointless WARN_ON in DMA teardown

In reply to Robin Murphy

Hi,

Quoted 18 lines

We expect arch_teardown_dma_ops() to be called very late in a device's life, after it has been removed from its bus, and thus after the IOMMU bus notifier has run. As such, even if this funny little check did make sense, it's unlikely to achieve what it thinks it's trying to do anyway. It's a residual trace of an earlier implementation which didn't belong here from the start; belatedly snuff it out.

---
arch/arm64/mm/dma-mapping.c | 5 -----

1 file changed, 5 deletions(-)
arch/arm64/mm/dma-mapping.c +0 -0
index 5cd0a383b14b..290a84f3351f 100644

arch/arm64/mm/dma-mapping.c static void __iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, · line 947

Quoted 8 lines
arch/arm64/mm/dma-mapping.c +0 -5
@@ -940,11 +940,6 @@ static void __iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 
 void arch_teardown_dma_ops(struct device *dev)
 {
-	struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
-
-	if (WARN_ON(domain))
-		iommu_detach_device(domain, dev);
-

Thanks!!, clears my doubt that i had for quite sometime.

Regards,
Sricharan

maintainer Applied
#3 lore raw

PATCH 1/1 arm64: Remove pointless WARN_ON in DMA teardown

In reply to Robin Murphy
Quoted 8 lines · Robin Murphy

We expect arch_teardown_dma_ops() to be called very late in a device's life, after it has been removed from its bus, and thus after the IOMMU bus notifier has run. As such, even if this funny little check did make sense, it's unlikely to achieve what it thinks it's trying to do anyway. It's a residual trace of an earlier implementation which didn't belong here from the start; belatedly snuff it out.

Queued for 4.10. Thanks.

Signature · 1 line
Catalin