]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/xe: Cancel pending TLB inval workers on teardown
authorStuart Summers <stuart.summers@intel.com>
Tue, 26 Aug 2025 18:29:04 +0000 (18:29 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Nov 2025 20:37:08 +0000 (15:37 -0500)
[ Upstream commit 76186a253a4b9eb41c5a83224c14efdf30960a71 ]

Add a new _fini() routine on the GT TLB invalidation
side to handle this worker cleanup on driver teardown.

v2: Move the TLB teardown to the gt fini() routine called during
    gt_init rather than in gt_alloc. This way the GT structure stays
    alive for while we reset the TLB state.

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Link: https://lore.kernel.org/r/20250826182911.392550-3-stuart.summers@intel.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/xe/xe_gt.c
drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
drivers/gpu/drm/xe/xe_gt_tlb_invalidation.h

index 4d74a4983fd0736a60b750a7d1813be7c5db05ca..2f4c52716e75bcc2cb5fda78b372fa96ffa4a6d2 100644 (file)
@@ -605,6 +605,8 @@ static void xe_gt_fini(void *arg)
        struct xe_gt *gt = arg;
        int i;
 
+       xe_gt_tlb_invalidation_fini(gt);
+
        for (i = 0; i < XE_ENGINE_CLASS_MAX; ++i)
                xe_hw_fence_irq_finish(&gt->fence_irq[i]);
 
index 086c12ee3d9de08e0b4a84f3c2120ab119ea1eab..64cd6cf0ab8df345738f564977b204f199cb0400 100644 (file)
@@ -173,6 +173,18 @@ void xe_gt_tlb_invalidation_reset(struct xe_gt *gt)
        mutex_unlock(&gt->uc.guc.ct.lock);
 }
 
+/**
+ *
+ * xe_gt_tlb_invalidation_fini - Clean up GT TLB invalidation state
+ *
+ * Cancel pending fence workers and clean up any additional
+ * GT TLB invalidation state.
+ */
+void xe_gt_tlb_invalidation_fini(struct xe_gt *gt)
+{
+       xe_gt_tlb_invalidation_reset(gt);
+}
+
 static bool tlb_invalidation_seqno_past(struct xe_gt *gt, int seqno)
 {
        int seqno_recv = READ_ONCE(gt->tlb_invalidation.seqno_recv);
index f7f0f2eaf4b59ab776543bf35a98e488bc982901..3e4cff3922d6fa73e5b89715faf27cec5765f8c2 100644 (file)
@@ -16,6 +16,7 @@ struct xe_vm;
 struct xe_vma;
 
 int xe_gt_tlb_invalidation_init_early(struct xe_gt *gt);
+void xe_gt_tlb_invalidation_fini(struct xe_gt *gt);
 
 void xe_gt_tlb_invalidation_reset(struct xe_gt *gt);
 int xe_gt_tlb_invalidation_ggtt(struct xe_gt *gt);