aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2018-03-09 06:53:34 -0500
committerLucas Stach <l.stach@pengutronix.de>2018-05-18 09:27:56 -0400
commitccae45928fc43d78d6ba7d0c6965b142c922a446 (patch)
tree5321f3c3cc806e21faeb42660cceddc81a3828c7 /drivers
parentd066b246d482f69553e58d52f746377ce3966b66 (diff)
drm/etnaviv: remove cycling through MMU address space
This was useful on MMUv1 GPUs, which don't generate proper faults, when the GPU write caches weren't fully understood and not properly handled by the kernel driver. As this has been fixed for quite some time, the cycling though the MMU address space needlessly spreads out the MMU mappings. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_mmu.c16
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_mmu.h1
2 files changed, 1 insertions, 16 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
index 49e049713a52..e8e8c4fe3242 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
@@ -162,22 +162,10 @@ static int etnaviv_iommu_find_iova(struct etnaviv_iommu *mmu,
162 bool found; 162 bool found;
163 163
164 ret = drm_mm_insert_node_in_range(&mmu->mm, node, 164 ret = drm_mm_insert_node_in_range(&mmu->mm, node,
165 size, 0, 0, 165 size, 0, 0, 0, U64_MAX, mode);
166 mmu->last_iova, U64_MAX,
167 mode);
168 if (ret != -ENOSPC) 166 if (ret != -ENOSPC)
169 break; 167 break;
170 168
171 /*
172 * If we did not search from the start of the MMU region,
173 * try again in case there are free slots.
174 */
175 if (mmu->last_iova) {
176 mmu->last_iova = 0;
177 mmu->need_flush = true;
178 continue;
179 }
180
181 /* Try to retire some entries */ 169 /* Try to retire some entries */
182 drm_mm_scan_init(&scan, &mmu->mm, size, 0, 0, mode); 170 drm_mm_scan_init(&scan, &mmu->mm, size, 0, 0, mode);
183 171
@@ -274,7 +262,6 @@ int etnaviv_iommu_map_gem(struct etnaviv_iommu *mmu,
274 if (ret < 0) 262 if (ret < 0)
275 goto unlock; 263 goto unlock;
276 264
277 mmu->last_iova = node->start + etnaviv_obj->base.size;
278 mapping->iova = node->start; 265 mapping->iova = node->start;
279 ret = etnaviv_iommu_map(mmu, node->start, sgt, etnaviv_obj->base.size, 266 ret = etnaviv_iommu_map(mmu, node->start, sgt, etnaviv_obj->base.size,
280 ETNAVIV_PROT_READ | ETNAVIV_PROT_WRITE); 267 ETNAVIV_PROT_READ | ETNAVIV_PROT_WRITE);
@@ -381,7 +368,6 @@ int etnaviv_iommu_get_suballoc_va(struct etnaviv_gpu *gpu, dma_addr_t paddr,
381 mutex_unlock(&mmu->lock); 368 mutex_unlock(&mmu->lock);
382 return ret; 369 return ret;
383 } 370 }
384 mmu->last_iova = vram_node->start + size;
385 gpu->mmu->need_flush = true; 371 gpu->mmu->need_flush = true;
386 mutex_unlock(&mmu->lock); 372 mutex_unlock(&mmu->lock);
387 373
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.h b/drivers/gpu/drm/etnaviv/etnaviv_mmu.h
index ab603f5166b1..a339ec5798ff 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.h
+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.h
@@ -59,7 +59,6 @@ struct etnaviv_iommu {
59 struct mutex lock; 59 struct mutex lock;
60 struct list_head mappings; 60 struct list_head mappings;
61 struct drm_mm mm; 61 struct drm_mm mm;
62 u32 last_iova;
63 bool need_flush; 62 bool need_flush;
64}; 63};
65 64