[PATCH] drm/exynos: Properly release default ARM DMA-IOMMU mapping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Exynos DRM on ARM architecture creates its own DMA-IOMMU mapping, shared
between all devices that builds the Exynos DRM subsystem. Thus, the
default DMA-IOMMU mapping structure created by platform init code can be
released to avoid leaking resources, because after exynos_iommu_attach()
the default mapping is no longer accessible.

Reported-by: Seung-Woo Kim <sw0312.kim@xxxxxxxxxxx>
Signed-off-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
---
 drivers/gpu/drm/exynos/exynos_drm_iommu.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_iommu.h b/drivers/gpu/drm/exynos/exynos_drm_iommu.h
index 87f6b5672e11..7a4528461bba 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_iommu.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_iommu.h
@@ -37,8 +37,13 @@ static inline int __exynos_iommu_create_mapping(struct exynos_drm_private *priv,
 static inline int __exynos_iommu_attach(struct exynos_drm_private *priv,
 					struct device *dev)
 {
-	if (dev->archdata.mapping)
+	struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev);
+
+	/* release device from the default DMA-IOMMU mapping */
+	if (mapping) {
 		arm_iommu_detach_device(dev);
+		arm_iommu_release_mapping(mapping);
+	}
 
 	return arm_iommu_attach_device(dev, priv->mapping);
 }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  Powered by Linux