]> git.ipfire.org Git - thirdparty/linux.git/blobdiff - drivers/gpu/drm/msm/msm_gpu.c
Merge tag 'drm-misc-next-2020-06-19' of git://anongit.freedesktop.org/drm/drm-misc...
[thirdparty/linux.git] / drivers / gpu / drm / msm / msm_gpu.c
index 86a68f96c48d1fefca4d6723ec8032671b08da33..86a13864147795ffb2193f17addaa634dc7fb7ce 100644 (file)
@@ -821,51 +821,6 @@ static int get_clocks(struct platform_device *pdev, struct msm_gpu *gpu)
        return 0;
 }
 
-static struct msm_gem_address_space *
-msm_gpu_create_address_space(struct msm_gpu *gpu, struct platform_device *pdev,
-               uint64_t va_start, uint64_t va_end)
-{
-       struct msm_gem_address_space *aspace;
-       int ret;
-
-       /*
-        * Setup IOMMU.. eventually we will (I think) do this once per context
-        * and have separate page tables per context.  For now, to keep things
-        * simple and to get something working, just use a single address space:
-        */
-       if (!adreno_is_a2xx(to_adreno_gpu(gpu))) {
-               struct iommu_domain *iommu = iommu_domain_alloc(&platform_bus_type);
-               if (!iommu)
-                       return NULL;
-
-               iommu->geometry.aperture_start = va_start;
-               iommu->geometry.aperture_end = va_end;
-
-               DRM_DEV_INFO(gpu->dev->dev, "%s: using IOMMU\n", gpu->name);
-
-               aspace = msm_gem_address_space_create(&pdev->dev, iommu, "gpu");
-               if (IS_ERR(aspace))
-                       iommu_domain_free(iommu);
-       } else {
-               aspace = msm_gem_address_space_create_a2xx(&pdev->dev, gpu, "gpu",
-                       va_start, va_end);
-       }
-
-       if (IS_ERR(aspace)) {
-               DRM_DEV_ERROR(gpu->dev->dev, "failed to init mmu: %ld\n",
-                       PTR_ERR(aspace));
-               return ERR_CAST(aspace);
-       }
-
-       ret = aspace->mmu->funcs->attach(aspace->mmu);
-       if (ret) {
-               msm_gem_address_space_put(aspace);
-               return ERR_PTR(ret);
-       }
-
-       return aspace;
-}
-
 int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev,
                struct msm_gpu *gpu, const struct msm_gpu_funcs *funcs,
                const char *name, struct msm_gpu_config *config)
@@ -938,8 +893,8 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev,
 
        msm_devfreq_init(gpu);
 
-       gpu->aspace = msm_gpu_create_address_space(gpu, pdev,
-               config->va_start, config->va_end);
+
+       gpu->aspace = gpu->funcs->create_address_space(gpu, pdev);
 
        if (gpu->aspace == NULL)
                DRM_DEV_INFO(drm->dev, "%s: no IOMMU, fallback to VRAM carveout!\n", name);