All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/exynos: Properly release default ARM DMA-IOMMU mapping
       [not found] <CGME20170327080438eucas1p28a1a20c1bfeafc037fe26d94639044a9@eucas1p2.samsung.com>
@ 2017-03-27  8:04 ` Marek Szyprowski
  0 siblings, 0 replies; only message in thread
From: Marek Szyprowski @ 2017-03-27  8:04 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: Bartlomiej Zolnierkiewicz, Seung-Woo Kim, Krzysztof Kozlowski,
	Marek Szyprowski

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@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-03-27  8:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170327080438eucas1p28a1a20c1bfeafc037fe26d94639044a9@eucas1p2.samsung.com>
2017-03-27  8:04 ` [PATCH] drm/exynos: Properly release default ARM DMA-IOMMU mapping Marek Szyprowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.