aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2018-04-23 02:57:45 -0400
committerThierry Reding <treding@nvidia.com>2018-05-17 11:44:48 -0400
commit24cfdc1ac7d4260aa8416505b9cb6316c9e89021 (patch)
tree11304d100d8fa72b8bbf0d09e85450a0510bd520
parent5f43ac8d80e4c768380e86d312a591472d080eeb (diff)
drm/tegra: Acquire a reference to the IOVA cache
The IOVA API uses a memory cache to allocate IOVA nodes from. To make sure that this cache is available, obtain a reference to it and release the reference when the cache is no longer needed. On 64-bit ARM this is hidden by the fact that the DMA mapping API gets that reference and never releases it. On 32-bit ARM, however, the DMA mapping API doesn't do that, so allocation of IOVA nodes fails. Fixes: ad92601521ea ("drm/tegra: Add Tegra DRM allocation API") Reviewed-by: Dmitry Osipenko <digetx@gmail.com> Tested-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r--drivers/gpu/drm/tegra/drm.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 7b9f73bcf155..3cdef659cd39 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -113,6 +113,10 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
113 goto free; 113 goto free;
114 } 114 }
115 115
116 err = iova_cache_get();
117 if (err < 0)
118 goto domain;
119
116 geometry = &tegra->domain->geometry; 120 geometry = &tegra->domain->geometry;
117 gem_start = geometry->aperture_start; 121 gem_start = geometry->aperture_start;
118 gem_end = geometry->aperture_end - CARVEOUT_SZ; 122 gem_end = geometry->aperture_end - CARVEOUT_SZ;
@@ -207,8 +211,11 @@ config:
207 mutex_destroy(&tegra->mm_lock); 211 mutex_destroy(&tegra->mm_lock);
208 drm_mm_takedown(&tegra->mm); 212 drm_mm_takedown(&tegra->mm);
209 put_iova_domain(&tegra->carveout.domain); 213 put_iova_domain(&tegra->carveout.domain);
210 iommu_domain_free(tegra->domain); 214 iova_cache_put();
211 } 215 }
216domain:
217 if (tegra->domain)
218 iommu_domain_free(tegra->domain);
212free: 219free:
213 kfree(tegra); 220 kfree(tegra);
214 return err; 221 return err;
@@ -233,6 +240,7 @@ static void tegra_drm_unload(struct drm_device *drm)
233 mutex_destroy(&tegra->mm_lock); 240 mutex_destroy(&tegra->mm_lock);
234 drm_mm_takedown(&tegra->mm); 241 drm_mm_takedown(&tegra->mm);
235 put_iova_domain(&tegra->carveout.domain); 242 put_iova_domain(&tegra->carveout.domain);
243 iova_cache_put();
236 iommu_domain_free(tegra->domain); 244 iommu_domain_free(tegra->domain);
237 } 245 }
238 246