[PATCH 05/11] drm/xe: Add xe_gt_tlb_invalidation_done_handler
Matthew Brost
matthew.brost at intel.com
Sat Jul 6 00:02:46 UTC 2024
Decouple GT TLB seqno handling from G2H handler.
Signed-off-by: Matthew Brost <matthew.brost at intel.com>
---
drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c | 46 ++++++++++++---------
1 file changed, 26 insertions(+), 20 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c b/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
index e37436c140df..3eca77eb3211 100644
--- a/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
+++ b/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
@@ -413,28 +413,12 @@ int xe_gt_tlb_invalidation_vma(struct xe_gt *gt,
xe_vma_vm(vma)->usm.asid);
}
-/**
- * xe_guc_tlb_invalidation_done_handler - TLB invalidation done handler
- * @guc: guc
- * @msg: message indicating TLB invalidation done
- * @len: length of message
- *
- * Parse seqno of TLB invalidation, wake any waiters for seqno, and signal any
- * invalidation fences for seqno. Algorithm for this depends on seqno being
- * received in-order and asserts this assumption.
- *
- * Return: 0 on success, -EPROTO for malformed messages.
- */
-int xe_guc_tlb_invalidation_done_handler(struct xe_guc *guc, u32 *msg, u32 len)
+static void xe_gt_tlb_invalidation_done_handler(struct xe_gt *gt, int seqno)
{
- struct xe_gt *gt = guc_to_gt(guc);
struct xe_device *xe = gt_to_xe(gt);
struct xe_gt_tlb_invalidation_fence *fence, *next;
unsigned long flags;
- if (unlikely(len != 1))
- return -EPROTO;
-
/*
* This can also be run both directly from the IRQ handler and also in
* process_g2h_msg(). Only one may process any individual CT message,
@@ -451,12 +435,12 @@ int xe_guc_tlb_invalidation_done_handler(struct xe_guc *guc, u32 *msg, u32 len)
* process_g2h_msg().
*/
spin_lock_irqsave(>->tlb_invalidation.pending_lock, flags);
- if (tlb_invalidation_seqno_past(gt, msg[0])) {
+ if (tlb_invalidation_seqno_past(gt, seqno)) {
spin_unlock_irqrestore(>->tlb_invalidation.pending_lock, flags);
- return 0;
+ return;
}
- WRITE_ONCE(gt->tlb_invalidation.seqno_recv, msg[0]);
+ WRITE_ONCE(gt->tlb_invalidation.seqno_recv, seqno);
list_for_each_entry_safe(fence, next,
>->tlb_invalidation.pending_fences, link) {
@@ -476,6 +460,28 @@ int xe_guc_tlb_invalidation_done_handler(struct xe_guc *guc, u32 *msg, u32 len)
cancel_delayed_work(>->tlb_invalidation.fence_tdr);
spin_unlock_irqrestore(>->tlb_invalidation.pending_lock, flags);
+}
+
+/**
+ * xe_guc_tlb_invalidation_done_handler - TLB invalidation done handler
+ * @guc: guc
+ * @msg: message indicating TLB invalidation done
+ * @len: length of message
+ *
+ * Parse seqno of TLB invalidation, wake any waiters for seqno, and signal any
+ * invalidation fences for seqno. Algorithm for this depends on seqno being
+ * received in-order and asserts this assumption.
+ *
+ * Return: 0 on success, -EPROTO for malformed messages.
+ */
+int xe_guc_tlb_invalidation_done_handler(struct xe_guc *guc, u32 *msg, u32 len)
+{
+ struct xe_gt *gt = guc_to_gt(guc);
+
+ if (unlikely(len != 1))
+ return -EPROTO;
+
+ xe_gt_tlb_invalidation_done_handler(gt, msg[0]);
return 0;
}
--
2.34.1
More information about the Intel-xe
mailing list