Add a counter to xe_vm that tracks the number of times an engine reset
has been observed with respect to the VM since creation.

Signed-off-by: Jonathan Cavitt <jonathan.cav...@intel.com>
---
 drivers/gpu/drm/xe/xe_guc_submit.c | 2 ++
 drivers/gpu/drm/xe/xe_vm_types.h   | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c 
b/drivers/gpu/drm/xe/xe_guc_submit.c
index f0bfc9d109cb..e4c2413ed47e 100644
--- a/drivers/gpu/drm/xe/xe_guc_submit.c
+++ b/drivers/gpu/drm/xe/xe_guc_submit.c
@@ -1990,6 +1990,8 @@ int xe_guc_exec_queue_reset_handler(struct xe_guc *guc, 
u32 *msg, u32 len)
 
        trace_xe_exec_queue_reset(q);
 
+       atomic_inc(&q->vm->reset_count);
+
        /*
         * A banned engine is a NOP at this point (came from
         * guc_exec_queue_timedout_job). Otherwise, kick drm scheduler to cancel
diff --git a/drivers/gpu/drm/xe/xe_vm_types.h b/drivers/gpu/drm/xe/xe_vm_types.h
index e7e2d682b1b6..a448402250e5 100644
--- a/drivers/gpu/drm/xe/xe_vm_types.h
+++ b/drivers/gpu/drm/xe/xe_vm_types.h
@@ -305,6 +305,9 @@ struct xe_vm {
                spinlock_t lock;
        } pf;
 
+       /** @reset_count: number of times this VM has seen an engine reset */
+       atomic_t reset_count;
+
        /**
         * @tlb_flush_seqno: Required TLB flush seqno for the next exec.
         * protected by the vm resv.
-- 
2.43.0

Reply via email to