Skip to content

Commit 332f847

Browse files
committed
drm/etnaviv: reap idle mapping if it doesn't match the softpin address
When a idle BO, which is held open by another process, gets freed by userspace and subsequently referenced again by e.g. importing it again, userspace may assign a different softpin VA than the last time around. As the kernel GEM object still exists, we likely have a idle mapping with the old VA still cached, if it hasn't been reaped in the meantime. As the context matches, we then simply try to resurrect this mapping by increasing the refcount. As the VA in this mapping does not match the new softpin address, we consequently fail the otherwise valid submit. Instead of failing, reap the idle mapping. Cc: [email protected] # 5.19 Signed-off-by: Lucas Stach <[email protected]> Reviewed-by: Guido Günther <[email protected]>
1 parent 5a40837 commit 332f847

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/gpu/drm/etnaviv/etnaviv_gem.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,12 @@ struct etnaviv_vram_mapping *etnaviv_gem_mapping_get(
258258
if (mapping->use == 0) {
259259
mutex_lock(&mmu_context->lock);
260260
if (mapping->context == mmu_context)
261-
mapping->use += 1;
261+
if (va && mapping->iova != va) {
262+
etnaviv_iommu_reap_mapping(mapping);
263+
mapping = NULL;
264+
} else {
265+
mapping->use += 1;
266+
}
262267
else
263268
mapping = NULL;
264269
mutex_unlock(&mmu_context->lock);

0 commit comments

Comments
 (0)