Skip to content

Commit 76186a2

Browse files
stuartsummersmbrost05
authored andcommitted
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: 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]
1 parent ce5059b commit 76186a2

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
@@ -603,6 +603,8 @@ static void xe_gt_fini(void *arg)
603603
struct xe_gt *gt = arg;
604604
int i;
605605

606+
xe_gt_tlb_invalidation_fini(gt);
607+
606608
for (i = 0; i < XE_ENGINE_CLASS_MAX; ++i)
607609
xe_hw_fence_irq_finish(&gt->fence_irq[i]);
608610

drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,18 @@ void xe_gt_tlb_invalidation_reset(struct xe_gt *gt)
188188
mutex_unlock(&gt->tlb_invalidation.seqno_lock);
189189
}
190190

191+
/**
192+
*
193+
* xe_gt_tlb_invalidation_fini - Clean up GT TLB invalidation state
194+
*
195+
* Cancel pending fence workers and clean up any additional
196+
* GT TLB invalidation state.
197+
*/
198+
void xe_gt_tlb_invalidation_fini(struct xe_gt *gt)
199+
{
200+
xe_gt_tlb_invalidation_reset(gt);
201+
}
202+
191203
static bool tlb_invalidation_seqno_past(struct xe_gt *gt, int seqno)
192204
{
193205
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)