summaryrefslogtreecommitdiffstats
path: root/kernel/drivers/gpu/drm/exynos/exynos_drm_iommu.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/drivers/gpu/drm/exynos/exynos_drm_iommu.c')
-rw-r--r--kernel/drivers/gpu/drm/exynos/exynos_drm_iommu.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/kernel/drivers/gpu/drm/exynos/exynos_drm_iommu.c b/kernel/drivers/gpu/drm/exynos/exynos_drm_iommu.c
index b32b291f8..d73b9ad35 100644
--- a/kernel/drivers/gpu/drm/exynos/exynos_drm_iommu.c
+++ b/kernel/drivers/gpu/drm/exynos/exynos_drm_iommu.c
@@ -87,10 +87,8 @@ int drm_iommu_attach_device(struct drm_device *drm_dev,
struct device *dev = drm_dev->dev;
int ret;
- if (!dev->archdata.mapping) {
- DRM_ERROR("iommu_mapping is null.\n");
- return -EFAULT;
- }
+ if (!dev->archdata.mapping)
+ return 0;
subdrv_dev->dma_parms = devm_kzalloc(subdrv_dev,
sizeof(*subdrv_dev->dma_parms),
@@ -100,6 +98,9 @@ int drm_iommu_attach_device(struct drm_device *drm_dev,
dma_set_max_seg_size(subdrv_dev, 0xffffffffu);
+ if (subdrv_dev->archdata.mapping)
+ arm_iommu_detach_device(subdrv_dev);
+
ret = arm_iommu_attach_device(subdrv_dev, dev->archdata.mapping);
if (ret < 0) {
DRM_DEBUG_KMS("failed iommu attach.\n");
@@ -114,8 +115,8 @@ int drm_iommu_attach_device(struct drm_device *drm_dev,
* If iommu attach succeeded, the sub driver would have dma_ops
* for iommu and also all sub drivers have same dma_ops.
*/
- if (!dev->archdata.dma_ops)
- dev->archdata.dma_ops = subdrv_dev->archdata.dma_ops;
+ if (get_dma_ops(dev) == get_dma_ops(NULL))
+ set_dma_ops(dev, get_dma_ops(subdrv_dev));
return 0;
}
@@ -138,6 +139,5 @@ void drm_iommu_detach_device(struct drm_device *drm_dev,
if (!mapping || !mapping->domain)
return;
- iommu_detach_device(mapping->domain, subdrv_dev);
- drm_release_iommu_mapping(drm_dev);
+ arm_iommu_detach_device(subdrv_dev);
}