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
Subject: [PATCH v3 1/7] drm/xe: Add xe_ring_lrc_is_idle() helper
Date: Tue, 12 Nov 2024 14:01:21 -0800	[thread overview]
Message-ID: <20241112220127.1369527-2-matthew.brost@intel.com> (raw)
In-Reply-To: <20241112220127.1369527-1-matthew.brost@intel.com>

Add helper to compare ring head and tail to determine if LRC is idle.

v2:
 - Fix kernel doc (CI, Zhanjun)

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
---
 drivers/gpu/drm/xe/xe_guc_submit.c |  2 +-
 drivers/gpu/drm/xe/xe_lrc.c        | 13 +++++++++++++
 drivers/gpu/drm/xe/xe_lrc.h        |  2 ++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
index c70b75a3eb85..663ad4d97b34 100644
--- a/drivers/gpu/drm/xe/xe_guc_submit.c
+++ b/drivers/gpu/drm/xe/xe_guc_submit.c
@@ -1696,7 +1696,7 @@ static void guc_exec_queue_stop(struct xe_guc *guc, struct xe_exec_queue *q)
 				ban = true;
 			}
 		} else if (xe_exec_queue_is_lr(q) &&
-			   (xe_lrc_ring_head(q->lrc[0]) != xe_lrc_ring_tail(q->lrc[0]))) {
+			   !xe_lrc_ring_is_idle(q->lrc[0])) {
 			ban = true;
 		}
 
diff --git a/drivers/gpu/drm/xe/xe_lrc.c b/drivers/gpu/drm/xe/xe_lrc.c
index 4b65da77c6e0..e0d80e8201eb 100644
--- a/drivers/gpu/drm/xe/xe_lrc.c
+++ b/drivers/gpu/drm/xe/xe_lrc.c
@@ -1763,3 +1763,16 @@ u32 xe_lrc_update_timestamp(struct xe_lrc *lrc, u32 *old_ts)
 
 	return lrc->ctx_timestamp;
 }
+
+/**
+ * xe_lrc_ring_is_idle() - LRC is idle
+ * @lrc: Pointer to the lrc.
+ *
+ * Compare LRC ring head and tail to determine if idle.
+ *
+ * Return: True is ring is idle, False otherwise
+ */
+bool xe_lrc_ring_is_idle(struct xe_lrc *lrc)
+{
+	return xe_lrc_ring_head(lrc) == xe_lrc_ring_tail(lrc);
+}
diff --git a/drivers/gpu/drm/xe/xe_lrc.h b/drivers/gpu/drm/xe/xe_lrc.h
index 40d8f6906d3e..9d64cedc4d14 100644
--- a/drivers/gpu/drm/xe/xe_lrc.h
+++ b/drivers/gpu/drm/xe/xe_lrc.h
@@ -78,6 +78,8 @@ u32 xe_lrc_ring_head(struct xe_lrc *lrc);
 u32 xe_lrc_ring_space(struct xe_lrc *lrc);
 void xe_lrc_write_ring(struct xe_lrc *lrc, const void *data, size_t size);
 
+bool xe_lrc_ring_is_idle(struct xe_lrc *lrc);
+
 u32 xe_lrc_indirect_ring_ggtt_addr(struct xe_lrc *lrc);
 u32 xe_lrc_ggtt_addr(struct xe_lrc *lrc);
 u32 *xe_lrc_regs(struct xe_lrc *lrc);
-- 
2.34.1


  reply	other threads:[~2024-11-12 22:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-12 22:01 [PATCH v3 0/7] Devcoredump Improvements Matthew Brost
2024-11-12 22:01 ` Matthew Brost [this message]
2024-11-12 22:01 ` [PATCH v3 2/7] drm/xe: Add ring address to LRC snapshot Matthew Brost
2024-11-12 22:01 ` [PATCH v3 3/7] drm/xe: Add ring start " Matthew Brost
2024-11-12 22:01 ` [PATCH v3 4/7] drm/xe: Improve schedule disable response failure Matthew Brost
2024-11-14  1:48   ` John Harrison
2024-11-12 22:01 ` [PATCH v3 5/7] drm/xe: Add exec queue param to devcoredump Matthew Brost
2024-11-12 22:01 ` [PATCH v3 6/7] drm/xe: Change xe_engine_snapshot_capture_for_job to be for queue Matthew Brost
2024-11-12 22:01 ` [PATCH v3 7/7] drm/xe: Wire devcoredump to LR TDR Matthew Brost
2024-11-14  2:01   ` John Harrison
2024-11-13 14:25 ` ✓ CI.Patch_applied: success for Devcoredump Improvements (rev4) Patchwork
2024-11-13 14:25 ` ✓ CI.checkpatch: " Patchwork
2024-11-13 14:27 ` ✓ CI.KUnit: " Patchwork
2024-11-13 14:31 ` ✗ CI.Build: failure " Patchwork
2024-11-13 18:16 ` ✓ CI.Patch_applied: success for Devcoredump Improvements (rev5) Patchwork
2024-11-13 18:17 ` ✓ CI.checkpatch: " Patchwork
2024-11-13 18:18 ` ✓ CI.KUnit: " Patchwork
2024-11-13 18:22 ` ✗ CI.Build: failure " Patchwork
2024-11-14  0:47 ` ✓ CI.Patch_applied: success for Devcoredump Improvements (rev6) Patchwork
2024-11-14  0:48 ` ✓ CI.checkpatch: " Patchwork
2024-11-14  0:49 ` ✓ CI.KUnit: " Patchwork
2024-11-14  0:54 ` ✗ CI.Build: failure " Patchwork

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=20241112220127.1369527-2-matthew.brost@intel.com \
    --to=matthew.brost@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    /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