[PATCH v3 23/25] drm/xe: Add ULLS migration job support to GuC submission

Matthew Brost
2026-02-28T01:35:33Z

Add ULLS migration job support to GuC submission backend.

Changes required:
- On migration queue, reduce max jobs to the number of ULLS semaphores
minus one
- Directly set the hardware engine tail via a MMIO write for ULLS jobs
except for first ULLS job
- Set ULLS sempahore for current job releasing last job except for first
ULLS job
- Suppress submit H2G for ULLS except for first ULLS job

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

diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
index f7b56a1eaed4..db096bfb640c 100644
--- a/drivers/gpu/drm/xe/xe_guc_submit.c
+++ b/drivers/gpu/drm/xe/xe_guc_submit.c
@@ -1154,6 +1154,11 @@ static void submit_exec_queue(struct xe_exec_queue *q, struct xe_sched_job *job)
*/
q = xe_exec_queue_multi_queue_primary(q);

+ if (job->is_ulls && !job->is_ulls_first) {
+ xe_hw_engine_write_ring_tail(q->hwe, lrc->ring.tail);
+ xe_lrc_set_ulls_semaphore(lrc, xe_sched_job_lrc_seqno(job));
+ }
+
if (!exec_queue_enabled(q) && !exec_queue_suspended(q)) {
action[len++] = XE_GUC_ACTION_SCHED_CONTEXT_MODE_SET;
action[len++] = q->guc->id;
@@ -1167,13 +1172,14 @@ static void submit_exec_queue(struct xe_exec_queue *q, struct xe_sched_job *job)
set_exec_queue_pending_enable(q);
set_exec_queue_enabled(q);
trace_xe_exec_queue_scheduling_enable(q);
- } else {
+ } else if (!job->is_ulls || job->is_ulls_first) {
action[len++] = XE_GUC_ACTION_SCHED_CONTEXT;
action[len++] = q->guc->id;
trace_xe_exec_queue_submit(q);
}

- xe_guc_ct_send(&guc->ct, action, len, g2h_len, num_g2h);
+ if (!job->is_ulls || job->is_ulls_first || num_g2h)
+ xe_guc_ct_send(&guc->ct, action, len, g2h_len, num_g2h);

if (extra_submit) {
len = 0;
@@ -2000,6 +2006,7 @@ static int guc_exec_queue_init(struct xe_exec_queue *q)
struct xe_guc_exec_queue *ge;
long timeout;
int err, i;
+ int max_jobs = (xe_lrc_ring_size() / MAX_JOB_SIZE_BYTES);

xe_gt_assert(guc_to_gt(guc), xe_device_uc_enabled(guc_to_xe(guc)));

@@ -2029,8 +2036,15 @@ static int guc_exec_queue_init(struct xe_exec_queue *q)
submit_wq = primary->guc->sched.base.submit_wq;
}

+ if (q->vm && q->vm->flags & XE_VM_FLAG_MIGRATION) {
+ xe_assert(guc_to_xe(guc),
+ LRC_MIGRATION_ULLS_SEMAPORE_COUNT - 1 < max_jobs);
+
+ max_jobs = LRC_MIGRATION_ULLS_SEMAPORE_COUNT - 1;
+ }
+
err = xe_sched_init(&ge->sched, &drm_sched_ops, &xe_sched_ops,
- submit_wq, xe_lrc_ring_size() / MAX_JOB_SIZE_BYTES, 64,
+ submit_wq, max_jobs, 64,
timeout, guc_to_gt(guc)->ordered_wq, NULL,
q->name, gt_to_xe(q->gt)->drm.dev);
if (err)
--
2.34.1