drm/msm/mdp4: move iommu_domain_alloc() call close to its usage
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Thu, 5 May 2022 13:50:07 +0000 (16:50 +0300)
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Mon, 4 Jul 2022 18:05:31 +0000 (21:05 +0300)
Move iommu_domain_alloc() in front of adress space/IOMMU initialization.
This allows us to drop it from struct mdp4_cfg_platform which
remained from the pre-DT days.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/485049/
Link: https://lore.kernel.org/r/20220505135008.1351533-2-dmitry.baryshkov@linaro.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c
drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.h

index 17cb1fc..b55b4a4 100644 (file)
@@ -390,6 +390,7 @@ static int mdp4_kms_init(struct drm_device *dev)
        struct msm_drm_private *priv = dev->dev_private;
        struct mdp4_kms *mdp4_kms;
        struct msm_kms *kms = NULL;
+       struct iommu_domain *iommu;
        struct msm_gem_address_space *aspace;
        int irq, ret;
        u32 major, minor;
@@ -497,9 +498,9 @@ static int mdp4_kms_init(struct drm_device *dev)
        mdp4_disable(mdp4_kms);
        mdelay(16);
 
-       if (config->iommu) {
-               struct msm_mmu *mmu = msm_iommu_new(&pdev->dev,
-                       config->iommu);
+       iommu = iommu_domain_alloc(pdev->dev.bus);
+       if (iommu) {
+               struct msm_mmu *mmu = msm_iommu_new(&pdev->dev, iommu);
 
                aspace  = msm_gem_address_space_create(mmu,
                        "mdp4", 0x1000, 0x100000000 - 0x1000);
@@ -559,7 +560,6 @@ static struct mdp4_platform_config *mdp4_get_config(struct platform_device *dev)
 
        /* TODO: Chips that aren't apq8064 have a 200 Mhz max_clk */
        config.max_clk = 266667000;
-       config.iommu = iommu_domain_alloc(&platform_bus_type);
 
        return &config;
 }
index e8ee92a..7cc549b 100644 (file)
@@ -44,7 +44,6 @@ struct mdp4_kms {
 
 /* platform config data (ie. from DT, or pdata) */
 struct mdp4_platform_config {
-       struct iommu_domain *iommu;
        uint32_t max_clk;
 };