drm/xe: Add ULLS migration job support to GuC submission

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
- Skip writing the saved ring tail for ULLS jobs except for the first
  ULLS job - the ring updates both the saved tail and the tail register
  itself
- 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>
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Shuicheng Lin <shuicheng.lin@intel.com>
Reviewed-by: Maarten Lankhorst <dev@lankhorst.se>
Link: https://patch.msgid.link/20260925201526.1355279-22-matthew.brost@intel.com
This commit is contained in:
Matthew Brost 2026-09-25 13:15:23 -07:00
parent 6ec0b87160
commit 40c756bdbb

View File

@ -1190,9 +1190,10 @@ static void submit_exec_queue(struct xe_exec_queue *q, struct xe_sched_job *job)
xe_gt_assert(guc_to_gt(guc), exec_queue_registered(q)); xe_gt_assert(guc_to_gt(guc), exec_queue_registered(q));
if (!job->restore_replay || job->last_replay) { if (!job->restore_replay || job->last_replay) {
/* A ULLS job past the first publishes its own ring tail */
if (xe_exec_queue_is_parallel(q)) if (xe_exec_queue_is_parallel(q))
wq_item_append(q); wq_item_append(q);
else else if (!xe_sched_job_ulls_is_chained(job))
xe_lrc_set_ring_tail(lrc, lrc->ring.tail); xe_lrc_set_ring_tail(lrc, lrc->ring.tail);
job->last_replay = false; job->last_replay = false;
} }
@ -1209,6 +1210,9 @@ static void submit_exec_queue(struct xe_exec_queue *q, struct xe_sched_job *job)
if (exec_queue_suspended(q)) if (exec_queue_suspended(q))
return; return;
if (xe_sched_job_ulls_is_chained(job))
xe_lrc_set_ulls_semaphore(lrc, xe_sched_job_lrc_seqno(job));
if (!exec_queue_enabled(q)) { if (!exec_queue_enabled(q)) {
action[len++] = XE_GUC_ACTION_SCHED_CONTEXT_MODE_SET; action[len++] = XE_GUC_ACTION_SCHED_CONTEXT_MODE_SET;
action[len++] = q->guc->id; action[len++] = q->guc->id;
@ -1222,12 +1226,13 @@ static void submit_exec_queue(struct xe_exec_queue *q, struct xe_sched_job *job)
set_exec_queue_pending_enable(q); set_exec_queue_pending_enable(q);
set_exec_queue_enabled(q); set_exec_queue_enabled(q);
trace_xe_exec_queue_scheduling_enable(q); trace_xe_exec_queue_scheduling_enable(q);
} else { } else if (!xe_sched_job_ulls_is_chained(job)) {
action[len++] = XE_GUC_ACTION_SCHED_CONTEXT; action[len++] = XE_GUC_ACTION_SCHED_CONTEXT;
action[len++] = q->guc->id; action[len++] = q->guc->id;
trace_xe_exec_queue_submit(q); trace_xe_exec_queue_submit(q);
} }
if (!xe_sched_job_ulls_is_chained(job) || num_g2h)
xe_guc_ct_send(&guc->ct, action, len, g2h_len, num_g2h); xe_guc_ct_send(&guc->ct, action, len, g2h_len, num_g2h);
if (extra_submit) { if (extra_submit) {
@ -2100,6 +2105,7 @@ static int guc_exec_queue_init(struct xe_exec_queue *q)
struct xe_guc_exec_queue *ge; struct xe_guc_exec_queue *ge;
long timeout; long timeout;
int err, i; 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))); xe_gt_assert(guc_to_gt(guc), xe_device_uc_enabled(guc_to_xe(guc)));
@ -2139,8 +2145,11 @@ static int guc_exec_queue_init(struct xe_exec_queue *q)
submit_wq = primary->guc->sched.base.submit_wq; submit_wq = primary->guc->sched.base.submit_wq;
} }
if (q->vm && q->vm->flags & XE_VM_FLAG_MIGRATION)
max_jobs = min(max_jobs, LRC_MIGRATION_ULLS_SEMAPHORE_COUNT - 1);
err = xe_sched_init(&ge->sched, &drm_sched_ops, &xe_sched_ops, 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, timeout, guc_to_gt(guc)->ordered_wq, NULL,
ge->name, gt_to_xe(q->gt)->drm.dev); ge->name, gt_to_xe(q->gt)->drm.dev);
if (err) if (err)