Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stuart Summers <stuart.summers@intel.com>
Cc: stuart.summers@intel.com, niranjana.vishwanathapura@intel.com,
	intel-xe@lists.freedesktop.org
Subject: [PATCH] drm/xe: Refactor exec queue deregister
Date: Thu, 17 Apr 2025 18:06:29 +0000	[thread overview]
Message-ID: <20250417180629.16418-1-stuart.summers@intel.com> (raw)

No functional change here, just combine the two similar
routines we currently have for submitting the context
deregistration to GuC.

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/xe/xe_guc_submit.c | 62 ++++++++++++------------------
 1 file changed, 25 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
index 813c3c0bb250..42c709729352 100644
--- a/drivers/gpu/drm/xe/xe_guc_submit.c
+++ b/drivers/gpu/drm/xe/xe_guc_submit.c
@@ -568,6 +568,30 @@ static void register_exec_queue(struct xe_exec_queue *q)
 	init_policies(guc, q);
 }
 
+static void deregister_exec_queue(struct xe_guc *guc, struct xe_exec_queue *q)
+{
+	u32 action[] = {
+		XE_GUC_ACTION_DEREGISTER_CONTEXT,
+		q->guc->id,
+	};
+
+	xe_gt_assert(guc_to_gt(guc), exec_queue_registered(q));
+	xe_gt_assert(guc_to_gt(guc), !exec_queue_pending_enable(q));
+	xe_gt_assert(guc_to_gt(guc), !exec_queue_pending_disable(q));
+
+	trace_xe_exec_queue_deregister(q);
+
+	if (!exec_queue_destroyed(q)) {
+		set_exec_queue_destroyed(q);
+
+		xe_guc_ct_send(&guc->ct, action, ARRAY_SIZE(action),
+			       G2H_LEN_DW_DEREGISTER_CONTEXT, 1);
+	} else {
+		xe_guc_ct_send_g2h_handler(&guc->ct, action,
+					   ARRAY_SIZE(action));
+	}
+}
+
 static u32 wq_space_until_wrap(struct xe_exec_queue *q)
 {
 	return (WQ_SIZE - q->guc->wqi_tail);
@@ -1026,25 +1050,6 @@ static void disable_scheduling(struct xe_exec_queue *q, bool immediate)
 		       G2H_LEN_DW_SCHED_CONTEXT_MODE_SET, 1);
 }
 
-static void __deregister_exec_queue(struct xe_guc *guc, struct xe_exec_queue *q)
-{
-	u32 action[] = {
-		XE_GUC_ACTION_DEREGISTER_CONTEXT,
-		q->guc->id,
-	};
-
-	xe_gt_assert(guc_to_gt(guc), !exec_queue_destroyed(q));
-	xe_gt_assert(guc_to_gt(guc), exec_queue_registered(q));
-	xe_gt_assert(guc_to_gt(guc), !exec_queue_pending_enable(q));
-	xe_gt_assert(guc_to_gt(guc), !exec_queue_pending_disable(q));
-
-	set_exec_queue_destroyed(q);
-	trace_xe_exec_queue_deregister(q);
-
-	xe_guc_ct_send(&guc->ct, action, ARRAY_SIZE(action),
-		       G2H_LEN_DW_DEREGISTER_CONTEXT, 1);
-}
-
 static enum drm_gpu_sched_stat
 guc_exec_queue_timedout_job(struct drm_sched_job *drm_job)
 {
@@ -1213,7 +1218,7 @@ guc_exec_queue_timedout_job(struct drm_sched_job *drm_job)
 	if (!wedged && exec_queue_registered(q) && !exec_queue_destroyed(q)) {
 		set_exec_queue_extra_ref(q);
 		xe_exec_queue_get(q);
-		__deregister_exec_queue(guc, q);
+		deregister_exec_queue(guc, q);
 	}
 
 	/* Stop fence signaling */
@@ -1857,23 +1862,6 @@ g2h_exec_queue_lookup(struct xe_guc *guc, u32 guc_id)
 	return q;
 }
 
-static void deregister_exec_queue(struct xe_guc *guc, struct xe_exec_queue *q)
-{
-	u32 action[] = {
-		XE_GUC_ACTION_DEREGISTER_CONTEXT,
-		q->guc->id,
-	};
-
-	xe_gt_assert(guc_to_gt(guc), exec_queue_destroyed(q));
-	xe_gt_assert(guc_to_gt(guc), exec_queue_registered(q));
-	xe_gt_assert(guc_to_gt(guc), !exec_queue_pending_disable(q));
-	xe_gt_assert(guc_to_gt(guc), !exec_queue_pending_enable(q));
-
-	trace_xe_exec_queue_deregister(q);
-
-	xe_guc_ct_send_g2h_handler(&guc->ct, action, ARRAY_SIZE(action));
-}
-
 static void handle_sched_done(struct xe_guc *guc, struct xe_exec_queue *q,
 			      u32 runnable_state)
 {
-- 
2.34.1


             reply	other threads:[~2025-04-17 18:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-17 18:06 Stuart Summers [this message]
2025-04-17 18:11 ` ✓ CI.Patch_applied: success for drm/xe: Refactor exec queue deregister Patchwork
2025-04-17 18:11 ` ✓ CI.checkpatch: " Patchwork
2025-04-17 18:12 ` ✓ CI.KUnit: " Patchwork
2025-04-17 18:21 ` ✓ CI.Build: " Patchwork
2025-04-17 18:23 ` ✓ CI.Hooks: " Patchwork
2025-04-17 18:25 ` ✓ CI.checksparse: " Patchwork
2025-04-17 19:21 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-04-18  5:07 ` [PATCH] " Matthew Brost
2025-04-18 12:56 ` ✗ Xe.CI.Full: failure for " 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=20250417180629.16418-1-stuart.summers@intel.com \
    --to=stuart.summers@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=niranjana.vishwanathapura@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