aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2016-12-12 10:15:17 -0500
committerLucas Stach <l.stach@pengutronix.de>2017-01-11 04:38:45 -0500
commit3546fb0cdac25a79c89d87020566fab52b92867d (patch)
treea2e5b1a5ad04f0fd72e9d7ee4d8a3973565eb449
parent7ce7d89f48834cefece7804d38fc5d85382edf77 (diff)
drm/etnaviv: trick drm_mm into giving out a low IOVA
After rollover of the IOVA space, we want to get a low IOVA address, otherwise the the games we play by remembering the last IOVA are pointless. When we search for a free hole with DRM_MM_SEARCH_DEFAULT, drm_mm will pop the next entry from the free holes stack, which will likely be a high IOVA. By using DRM_MM_SEARCH_BELOW we can trick drm_mm into reversing the search and provide us with a low IOVA. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Wladimir van der Laan <laanwj@gmail.com>
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_mmu.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
index 169ac96e8f08..fe0e85b41310 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
@@ -116,9 +116,14 @@ static int etnaviv_iommu_find_iova(struct etnaviv_iommu *mmu,
116 struct list_head list; 116 struct list_head list;
117 bool found; 117 bool found;
118 118
119 /*
120 * XXX: The DRM_MM_SEARCH_BELOW is really a hack to trick
121 * drm_mm into giving out a low IOVA after address space
122 * rollover. This needs a proper fix.
123 */
119 ret = drm_mm_insert_node_in_range(&mmu->mm, node, 124 ret = drm_mm_insert_node_in_range(&mmu->mm, node,
120 size, 0, mmu->last_iova, ~0UL, 125 size, 0, mmu->last_iova, ~0UL,
121 DRM_MM_SEARCH_DEFAULT); 126 mmu->last_iova ? DRM_MM_SEARCH_DEFAULT : DRM_MM_SEARCH_BELOW);
122 127
123 if (ret != -ENOSPC) 128 if (ret != -ENOSPC)
124 break; 129 break;