drm/xe: Rework eviction rejection of bound external bos
authorThomas Hellström <thomas.hellstrom@linux.intel.com>
Wed, 28 May 2025 16:41:05 +0000 (18:41 +0200)
committerThomas Hellström <thomas.hellstrom@linux.intel.com>
Thu, 5 Jun 2025 16:07:07 +0000 (18:07 +0200)
commit5cc3325584c425069c1c3355c775314d64bf8770
tree7c337eee280cfc92ca13cc0a6474bdab91e2a9a3
parent2182f358fb138f81a586ffdddd510f2a4fc61702
drm/xe: Rework eviction rejection of bound external bos

For preempt_fence mode VM's we're rejecting eviction of
shared bos during VM_BIND. However, since we do this in the
move() callback, we're getting an eviction failure warning from
TTM. The TTM callback intended for these things is
eviction_valuable().

However, the latter doesn't pass in the struct ttm_operation_ctx
needed to determine whether the caller needs this.

Instead, attach the needed information to the vm under the
vm->resv, until we've been able to update TTM to provide the
needed information. And add sufficient lockdep checks to prevent
misuse and races.

v2:
- Fix a copy-paste error in xe_vm_clear_validating()
v3:
- Fix kerneldoc errors.

Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Fixes: 0af944f0e308 ("drm/xe: Reject BO eviction if BO is bound to current VM")
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://lore.kernel.org/r/20250528164105.234718-1-thomas.hellstrom@linux.intel.com
(cherry picked from commit 9d5558649f68e2e84a87a909631b30e15ca0f8ec)
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
drivers/gpu/drm/xe/xe_bo.c
drivers/gpu/drm/xe/xe_vm.h
drivers/gpu/drm/xe/xe_vm_types.h