Commit 76186a25 authored by Stuart Summers's avatar Stuart Summers Committed by Matthew Brost
Browse files

drm/xe: Cancel pending TLB inval workers on teardown



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: default avatarStuart Summers <stuart.summers@intel.com>
Reviewed-by: default avatarMatthew Brost <matthew.brost@intel.com>
Signed-off-by: default avatarMatthew Brost <matthew.brost@intel.com>
Link: https://lore.kernel.org/r/20250826182911.392550-3-stuart.summers@intel.com
parent ce5059bf
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -603,6 +603,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]);

+12 −0
Original line number Diff line number Diff line
@@ -188,6 +188,18 @@ void xe_gt_tlb_invalidation_reset(struct xe_gt *gt)
	mutex_unlock(&gt->tlb_invalidation.seqno_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);
+1 −0
Original line number Diff line number Diff line
@@ -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);