From 1a1bf441c8010d1145d6b08bc85c3aa870304cad Mon Sep 17 00:00:00 2001 From: Jianqun Xu Date: Wed, 13 Apr 2022 19:35:31 +0800 Subject: [PATCH] drm/rockchip: do iommu init after bind all devices During system bootimg, drm probe will fail since failed to bind all devices, currently the iommu init is done before bind all devices, the iommu needs to clean up. This patch moves the iommu init after bind all devices to reduce the iommu clean up. Signed-off-by: Jianqun Xu Change-Id: I74eba09c9c5106a2e67e7a3784e9e373229483ce --- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index 9d7c160b60f5..021af6128b85 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -1286,13 +1286,9 @@ static int rockchip_drm_bind(struct device *dev) goto err_free; } - ret = rockchip_drm_init_iommu(drm_dev); - if (ret) - goto err_free; - ret = drmm_mode_config_init(drm_dev); if (ret) - goto err_iommu_cleanup; + goto err_free; rockchip_drm_mode_config_init(drm_dev); rockchip_drm_create_properties(drm_dev); @@ -1318,6 +1314,10 @@ static int rockchip_drm_bind(struct device *dev) /* init kms poll for handling hpd */ drm_kms_helper_poll_init(drm_dev); + ret = rockchip_drm_init_iommu(drm_dev); + if (ret) + goto err_unbind_all; + rockchip_gem_pool_init(drm_dev); ret = of_reserved_mem_device_init(drm_dev->dev); if (ret) @@ -1327,7 +1327,7 @@ static int rockchip_drm_bind(struct device *dev) ret = rockchip_drm_fbdev_init(drm_dev); if (ret) - goto err_unbind_all; + goto err_iommu_cleanup; drm_dev->mode_config.allow_fb_modifiers = true; @@ -1340,12 +1340,12 @@ err_kms_helper_poll_fini: rockchip_gem_pool_destroy(drm_dev); drm_kms_helper_poll_fini(drm_dev); rockchip_drm_fbdev_fini(drm_dev); +err_iommu_cleanup: + rockchip_iommu_cleanup(drm_dev); err_unbind_all: component_unbind_all(dev, drm_dev); err_mode_config_cleanup: drm_mode_config_cleanup(drm_dev); -err_iommu_cleanup: - rockchip_iommu_cleanup(drm_dev); err_free: drm_dev->dev_private = NULL; dev_set_drvdata(dev, NULL);