Message ID | 1490601872-17369-1-git-send-email-m.szyprowski@samsung.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
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); }
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(-)