Skip to content

Commit 5fe5126

Browse files
stuartsummersgregkh
authored andcommitted
drm/xe: Cancel pending TLB inval workers on teardown
[ Upstream commit 76186a2 ] 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 <[email protected]> Reviewed-by: Matthew Brost <[email protected]> Signed-off-by: Matthew Brost <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sasha Levin <[email protected]>
1 parent 2dc9e2a commit 5fe5126

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

drivers/gpu/drm/xe/xe_gt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,8 @@ static void xe_gt_fini(void *arg)
605605
struct xe_gt *gt = arg;
606606
int i;
607607

608+
xe_gt_tlb_invalidation_fini(gt);
609+
608610
for (i = 0; i < XE_ENGINE_CLASS_MAX; ++i)
609611
xe_hw_fence_irq_finish(&gt->fence_irq[i]);
610612

drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,18 @@ void xe_gt_tlb_invalidation_reset(struct xe_gt *gt)
173173
mutex_unlock(&gt->uc.guc.ct.lock);
174174
}
175175

176+
/**
177+
*
178+
* xe_gt_tlb_invalidation_fini - Clean up GT TLB invalidation state
179+
*
180+
* Cancel pending fence workers and clean up any additional
181+
* GT TLB invalidation state.
182+
*/
183+
void xe_gt_tlb_invalidation_fini(struct xe_gt *gt)
184+
{
185+
xe_gt_tlb_invalidation_reset(gt);
186+
}
187+
176188
static bool tlb_invalidation_seqno_past(struct xe_gt *gt, int seqno)
177189
{
178190
int seqno_recv = READ_ONCE(gt->tlb_invalidation.seqno_recv);

drivers/gpu/drm/xe/xe_gt_tlb_invalidation.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ struct xe_vm;
1616
struct xe_vma;
1717

1818
int xe_gt_tlb_invalidation_init_early(struct xe_gt *gt);
19+
void xe_gt_tlb_invalidation_fini(struct xe_gt *gt);
1920

2021
void xe_gt_tlb_invalidation_reset(struct xe_gt *gt);
2122
int xe_gt_tlb_invalidation_ggtt(struct xe_gt *gt);

0 commit comments

Comments
 (0)