summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/xe/xe_vm.h
diff options
context:
space:
mode:
authorMatthew Brost <matthew.brost@intel.com>2023-06-22 12:39:48 -0700
committerRodrigo Vivi <rodrigo.vivi@intel.com>2023-12-21 11:35:18 -0500
commit9d858b69b0cfb56dd67943138c10d84eeb73380f (patch)
treeefdc4ca6775a36fed10ec38190a392a52491fa4b /drivers/gpu/drm/xe/xe_vm.h
parent54c9fb7e64fd3f0da1570e3d1c5446605e83210e (diff)
downloadlinux-stable-9d858b69b0cfb56dd67943138c10d84eeb73380f.tar.gz
linux-stable-9d858b69b0cfb56dd67943138c10d84eeb73380f.tar.bz2
linux-stable-9d858b69b0cfb56dd67943138c10d84eeb73380f.zip
drm/xe: Ban a VM if rebind worker hits an error
We cannot recover a VM if a rebind worker hits an error, ban the VM if happens to ensure we do not attempt to place this VM on the hardware again. A follow up will inform the user if this happens. v2: Return -ECANCELED in exec VM closed or banned, check for closed or banned within VM lock. v3: Fix lockdep splat by looking engine outside of vm->lock v4: Fix error path when engine lookup fails v5: Add debug message in rebind worker on error, update comments wrt locking, add xe_vm_close helper Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu/drm/xe/xe_vm.h')
-rw-r--r--drivers/gpu/drm/xe/xe_vm.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/gpu/drm/xe/xe_vm.h b/drivers/gpu/drm/xe/xe_vm.h
index 5edb7771629c..02b409dd77d5 100644
--- a/drivers/gpu/drm/xe/xe_vm.h
+++ b/drivers/gpu/drm/xe/xe_vm.h
@@ -45,10 +45,21 @@ void xe_vm_unlock(struct xe_vm *vm, struct ww_acquire_ctx *ww);
static inline bool xe_vm_is_closed(struct xe_vm *vm)
{
- /* Only guaranteed not to change when vm->resv is held */
+ /* Only guaranteed not to change when vm->lock is held */
return !vm->size;
}
+static inline bool xe_vm_is_banned(struct xe_vm *vm)
+{
+ return vm->flags & XE_VM_FLAG_BANNED;
+}
+
+static inline bool xe_vm_is_closed_or_banned(struct xe_vm *vm)
+{
+ lockdep_assert_held(&vm->lock);
+ return xe_vm_is_closed(vm) || xe_vm_is_banned(vm);
+}
+
struct xe_vma *
xe_vm_find_overlapping_vma(struct xe_vm *vm, const struct xe_vma *vma);