Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: nirmoy.das@intel.com, farah.kassabri@intel.com,
	michal.wajdeczko@intel.com
Subject: [PATCH v2 05/11] drm/xe: Add xe_gt_tlb_invalidation_done_handler
Date: Sun,  7 Jul 2024 21:03:25 -0700	[thread overview]
Message-ID: <20240708040331.766264-6-matthew.brost@intel.com> (raw)
In-Reply-To: <20240708040331.766264-1-matthew.brost@intel.com>

Decouple GT TLB seqno handling from G2H handler.

v2:
 - Add kernel doc

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c | 47 +++++++++++++--------
 1 file changed, 30 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c b/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
index 9062d9f85ffb..2493ea91b637 100644
--- a/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
+++ b/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
@@ -412,27 +412,18 @@ int xe_gt_tlb_invalidation_vma(struct xe_gt *gt,
 }
 
 /**
- * xe_guc_tlb_invalidation_done_handler - TLB invalidation done handler
- * @guc: guc
- * @msg: message indicating TLB invalidation done
- * @len: length of message
+ * xe_gt_tlb_invalidation_done_handler - GT TLB invalidation done handler
+ * @gt: gt
+ * @seqno: seqno of invalidation that is done
  *
- * 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.
+ * Update recv seqno, signal any GT TLB invalidation fences, and restart TDR
  */
-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,
@@ -449,12 +440,12 @@ int xe_guc_tlb_invalidation_done_handler(struct xe_guc *guc, u32 *msg, u32 len)
 	 * process_g2h_msg().
 	 */
 	spin_lock_irqsave(&gt->tlb_invalidation.pending_lock, flags);
-	if (tlb_invalidation_seqno_past(gt, msg[0])) {
+	if (tlb_invalidation_seqno_past(gt, seqno)) {
 		spin_unlock_irqrestore(&gt->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,
 				 &gt->tlb_invalidation.pending_fences, link) {
@@ -474,6 +465,28 @@ int xe_guc_tlb_invalidation_done_handler(struct xe_guc *guc, u32 *msg, u32 len)
 		cancel_delayed_work(&gt->tlb_invalidation.fence_tdr);
 
 	spin_unlock_irqrestore(&gt->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


  parent reply	other threads:[~2024-07-08  4:02 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-08  4:03 [PATCH v2 00/11] Proper GT TLB invalidation layering and new coalescing feature Matthew Brost
2024-07-08  4:03 ` [PATCH v2 01/11] drm/xe: Add xe_gt_tlb_invalidation_fence_init helper Matthew Brost
2024-07-09 15:56   ` Nirmoy Das
2024-07-08  4:03 ` [PATCH v2 02/11] drm/xe: Drop xe_gt_tlb_invalidation_wait Matthew Brost
2024-07-09 15:57   ` Nirmoy Das
2024-07-08  4:03 ` [PATCH v2 03/11] drm/xe: s/tlb_invalidation.lock/tlb_invalidation.fence_lock Matthew Brost
2024-07-09 15:57   ` Nirmoy Das
2024-07-08  4:03 ` [PATCH v2 04/11] drm/xe: Add tlb_invalidation.seqno_lock Matthew Brost
2024-07-08  4:03 ` Matthew Brost [this message]
2025-07-23 17:22   ` [PATCH v2 05/11] drm/xe: Add xe_gt_tlb_invalidation_done_handler Summers, Stuart
2024-07-08  4:03 ` [PATCH v2 06/11] drm/xe: Add send tlb invalidation helpers Matthew Brost
2024-07-08  4:03 ` [PATCH v2 07/11] drm/xe: Add xe_guc_tlb_invalidation layer Matthew Brost
2024-07-09 21:31   ` Michal Wajdeczko
2024-07-10  4:02     ` Matthew Brost
2024-07-08  4:03 ` [PATCH v2 08/11] drm/xe: Add multi-client support for GT TLB invalidations Matthew Brost
2024-07-08  4:03 ` [PATCH v2 09/11] drm/xe: Add GT TLB invalidation coalescing Matthew Brost
2024-07-08  4:03 ` [PATCH v2 10/11] drm/xe: Add GT TLB invalidation coalesce tracepoints Matthew Brost
2024-07-08  4:03 ` [PATCH v2 11/11] drm/xe: Add GT TLB invalidation watermark debugfs Matthew Brost
2024-07-08  4:08 ` ✓ CI.Patch_applied: success for Proper GT TLB invalidation layering and new coalescing feature. (rev2) Patchwork
2024-07-08  4:09 ` ✗ CI.checkpatch: warning " Patchwork
2024-07-08  4:10 ` ✓ CI.KUnit: success " Patchwork
2024-07-08  4:22 ` ✓ CI.Build: " Patchwork
2024-07-08  4:24 ` ✓ CI.Hooks: " Patchwork
2024-07-08  4:25 ` ✓ CI.checksparse: " Patchwork
2024-07-08  4:51 ` ✓ CI.BAT: " Patchwork
2024-07-08  5:46 ` ✗ CI.FULL: failure " Patchwork
2024-07-09  9:57 ` [PATCH v2 00/11] Proper GT TLB invalidation layering and new coalescing feature Matthew Auld
2024-07-09 16:08   ` Nirmoy Das
2024-07-09 16:35     ` Matthew Brost
2024-07-09 16:42       ` Nirmoy Das
2024-07-09 21:23         ` Matthew Brost
2024-07-09 16:31   ` Matthew Brost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240708040331.766264-6-matthew.brost@intel.com \
    --to=matthew.brost@intel.com \
    --cc=farah.kassabri@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=michal.wajdeczko@intel.com \
    --cc=nirmoy.das@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox