Skip to content

Commit 6d1e452

Browse files
committed
drm/xe: Add xe_gt_tlb_invalidation_done_handler
Decouple GT TLB seqno handling from G2H handler. v2: - Add kernel doc Reviewed-by: Stuart Summers <stuart.summers@intel.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com> Link: https://lore.kernel.org/r/20250826182911.392550-6-stuart.summers@intel.com
1 parent 594bb93 commit 6d1e452

1 file changed

Lines changed: 30 additions & 17 deletions

File tree

drivers/gpu/drm/xe/xe_gt_tlb_inval.c

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -506,27 +506,18 @@ void xe_gt_tlb_inval_vm(struct xe_gt *gt, struct xe_vm *vm)
506506
}
507507

508508
/**
509-
* xe_guc_tlb_inval_done_handler - TLB invalidation done handler
510-
* @guc: guc
511-
* @msg: message indicating TLB invalidation done
512-
* @len: length of message
513-
*
514-
* Parse seqno of TLB invalidation, wake any waiters for seqno, and signal any
515-
* invalidation fences for seqno. Algorithm for this depends on seqno being
516-
* received in-order and asserts this assumption.
509+
* xe_gt_tlb_inval_done_handler - GT TLB invalidation done handler
510+
* @gt: gt
511+
* @seqno: seqno of invalidation that is done
517512
*
518-
* Return: 0 on success, -EPROTO for malformed messages.
513+
* Update recv seqno, signal any GT TLB invalidation fences, and restart TDR
519514
*/
520-
int xe_guc_tlb_inval_done_handler(struct xe_guc *guc, u32 *msg, u32 len)
515+
static void xe_gt_tlb_inval_done_handler(struct xe_gt *gt, int seqno)
521516
{
522-
struct xe_gt *gt = guc_to_gt(guc);
523517
struct xe_device *xe = gt_to_xe(gt);
524518
struct xe_gt_tlb_inval_fence *fence, *next;
525519
unsigned long flags;
526520

527-
if (unlikely(len != 1))
528-
return -EPROTO;
529-
530521
/*
531522
* This can also be run both directly from the IRQ handler and also in
532523
* process_g2h_msg(). Only one may process any individual CT message,
@@ -543,12 +534,12 @@ int xe_guc_tlb_inval_done_handler(struct xe_guc *guc, u32 *msg, u32 len)
543534
* process_g2h_msg().
544535
*/
545536
spin_lock_irqsave(&gt->tlb_inval.pending_lock, flags);
546-
if (tlb_inval_seqno_past(gt, msg[0])) {
537+
if (tlb_inval_seqno_past(gt, seqno)) {
547538
spin_unlock_irqrestore(&gt->tlb_inval.pending_lock, flags);
548-
return 0;
539+
return;
549540
}
550541

551-
WRITE_ONCE(gt->tlb_inval.seqno_recv, msg[0]);
542+
WRITE_ONCE(gt->tlb_inval.seqno_recv, seqno);
552543

553544
list_for_each_entry_safe(fence, next,
554545
&gt->tlb_inval.pending_fences, link) {
@@ -568,6 +559,28 @@ int xe_guc_tlb_inval_done_handler(struct xe_guc *guc, u32 *msg, u32 len)
568559
cancel_delayed_work(&gt->tlb_inval.fence_tdr);
569560

570561
spin_unlock_irqrestore(&gt->tlb_inval.pending_lock, flags);
562+
}
563+
564+
/**
565+
* xe_guc_tlb_inval_done_handler - TLB invalidation done handler
566+
* @guc: guc
567+
* @msg: message indicating TLB invalidation done
568+
* @len: length of message
569+
*
570+
* Parse seqno of TLB invalidation, wake any waiters for seqno, and signal any
571+
* invalidation fences for seqno. Algorithm for this depends on seqno being
572+
* received in-order and asserts this assumption.
573+
*
574+
* Return: 0 on success, -EPROTO for malformed messages.
575+
*/
576+
int xe_guc_tlb_inval_done_handler(struct xe_guc *guc, u32 *msg, u32 len)
577+
{
578+
struct xe_gt *gt = guc_to_gt(guc);
579+
580+
if (unlikely(len != 1))
581+
return -EPROTO;
582+
583+
xe_gt_tlb_inval_done_handler(gt, msg[0]);
571584

572585
return 0;
573586
}

0 commit comments

Comments
 (0)