]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/panthor: Make panthor_vm_[un]map_pages() more robust
authorBoris Brezillon <boris.brezillon@collabora.com>
Fri, 28 Nov 2025 08:48:39 +0000 (09:48 +0100)
committerBoris Brezillon <boris.brezillon@collabora.com>
Fri, 28 Nov 2025 09:17:44 +0000 (10:17 +0100)
commit19e8bc9456055e594d0f1c9677ea8a3a9983ec3e
tree1a020f8280adc852e504e334e971800bd94a5d17
parent6e2d3b3e858942de4dbffffe3a617e80b1262f74
drm/panthor: Make panthor_vm_[un]map_pages() more robust

There's no reason for panthor_vm_[un]map_pages() to fail unless the
drm_gpuvm state and the page table are out of sync, so let's reflect that
by making panthor_vm_unmap_pages() a void function and adding
WARN_ON()s in various places. We also try to recover from those
unexpected mismatch by checking for already unmapped ranges and skipping
them. But there's only so much we can do to try and cope with such
SW bugs, so when we see a mismatch, we flag the VM unusable and disable
the AS to avoid further GPU accesses to the memory.

It could be that the as_disable() call fails because the MMU unit is
stuck, in which case the whole GPU is frozen, and only a GPU reset can
unblock things. Ater the reset, the VM will be seen as unusable and
any attempt to re-use it will fail, so we should be covered for any
use-after-unmap issues.

v2:
- Fix double unlock

v3:
- Collect R-b

v4:
- No changes

Reviewed-by: Steven Price <steven.price@arm.com>
Link: https://patch.msgid.link/20251128084841.3804658-6-boris.brezillon@collabora.com
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
drivers/gpu/drm/panthor/panthor_mmu.c