drm/exynos: Clean-up IOMMU mapping creation order
authorPawel Osciak <posciak@chromium.org>
Thu, 30 Aug 2012 17:43:24 +0000 (10:43 -0700)
committerGerrit <chrome-bot@google.com>
Mon, 17 Sep 2012 16:34:52 +0000 (09:34 -0700)
The IOMMU mappings are shared across FIMD and HDMI. Due to the
ordering in the Makefile, the FIMD map call is executed first,
thus HDMI uses the parameters from there as well. The mapping size
passed in exynos_mixer.c is thus unused and misleading, so change
it to 0. Also, add sanity checks for that assumption in case
the ordering changes in the future.

BUG=None
TEST=None

Change-Id: Ib9c290ca4cdce72d7823fe3b4d584e0c2a7a9cd8
Signed-off-by: Pawel Osciak <posciak@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/31898
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Ready: Pawel Osciak <posciak@google.com>
Tested-by: Pawel Osciak <posciak@google.com>
drivers/gpu/drm/exynos/exynos_drm_drv.c
drivers/gpu/drm/exynos/exynos_drm_fimd.c
drivers/gpu/drm/exynos/exynos_mixer.c

index b14da8b..f4945eb 100644 (file)
@@ -254,6 +254,12 @@ static int iommu_init(struct platform_device *pdev)
                return -1;
        }
 
+       /*
+        * The ordering in Makefile warrants that this is initialized after
+        * FIMD, so only just ensure that it works as expected and we are
+        * reusing the mapping originally created in exynos_drm_fimd.c.
+        */
+       WARN_ON(!exynos_drm_common_mapping);
        if (!s5p_create_iommu_mapping(&pdev->dev, 0,
                                0, 0, exynos_drm_common_mapping)) {
                printk(KERN_ERR "failed to create IOMMU mapping\n");
index 167d5f0..dc4a549 100644 (file)
@@ -841,6 +841,13 @@ static int iommu_init(struct platform_device *pdev)
        }
 
        platform_set_sysmmu(&pds->dev, &pdev->dev);
+       /*
+        * Due to the ordering in Makefile, this should be called first
+        * (before exynos_drm_drv.c and exynos_mixer.c and actually create
+        * the common mapping instead of reusing it. Ensure this assumption
+        * holds.
+        */
+       WARN_ON(exynos_drm_common_mapping);
        exynos_drm_common_mapping = s5p_create_iommu_mapping(&pdev->dev,
                                        0x20000000, SZ_256M, 4,
                                        exynos_drm_common_mapping);
index 62beac8..20b6c82 100644 (file)
@@ -1011,8 +1011,14 @@ static int iommu_init(struct platform_device *pdev)
        }
 
        platform_set_sysmmu(&pds->dev, &pdev->dev);
+       /*
+        * The ordering in Makefile warrants that this is initialized after
+        * FIMD, so only just ensure that it works as expected and we are
+        * reusing the mapping originally created in exynos_drm_fimd.c.
+        */
+       WARN_ON(!exynos_drm_common_mapping);
        exynos_drm_common_mapping = s5p_create_iommu_mapping(&pdev->dev,
-                       0x20000000, SZ_128M, 4, exynos_drm_common_mapping);
+                                       0, 0, 0, exynos_drm_common_mapping);
        if(exynos_drm_common_mapping == NULL) {
                printk(KERN_ERR"Failed to create iommu mapping for Mixer\n");
                return -EINVAL;