Commit 1c66c0f3 authored by Daniele Ceraolo Spurio's avatar Daniele Ceraolo Spurio Committed by Rodrigo Vivi
Browse files

drm/xe: fix submissions without vm



Kernel queues can submit privileged batches directly in GGTT, so they
don't always need a vm. The submission front-end already supports
creating and submitting jobs without a vm, but some parts of the
back-end assume the vm is always there. Fix this by handling a lack of
vm in the back-end as well.

v2: s/XE_BUG_ON/XE_WARN_ON, s/engine/exec_queue

Signed-off-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: default avatarMatthew Brost <matthew.brost@intel.com>
Link: https://lore.kernel.org/r/20230822173334.1664332-2-daniele.ceraolospurio@intel.com


Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 486b2ef2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1136,7 +1136,7 @@ static int guc_exec_queue_init(struct xe_exec_queue *q)
	ge->q = q;
	init_waitqueue_head(&ge->suspend_wait);

	timeout = xe_vm_no_dma_fences(q->vm) ? MAX_SCHEDULE_TIMEOUT :
	timeout = (q->vm && xe_vm_no_dma_fences(q->vm)) ? MAX_SCHEDULE_TIMEOUT :
		  q->hwe->eclass->sched_props.job_timeout_ms;
	err = xe_sched_init(&ge->sched, &drm_sched_ops, &xe_sched_ops, NULL,
			     q->lrc[0].ring.size / MAX_JOB_SIZE_BYTES,
+4 −4
Original line number Diff line number Diff line
@@ -213,7 +213,7 @@ static void __emit_job_gen12_simple(struct xe_sched_job *job, struct xe_lrc *lrc
	u32 ppgtt_flag = get_ppgtt_flag(job);
	struct xe_vm *vm = job->q->vm;

	if (vm->batch_invalidate_tlb) {
	if (vm && vm->batch_invalidate_tlb) {
		dw[i++] = preparser_disable(true);
		i = emit_flush_imm_ggtt(xe_lrc_start_seqno_ggtt_addr(lrc),
					seqno, true, dw, i);
@@ -273,13 +273,13 @@ static void __emit_job_gen12_video(struct xe_sched_job *job, struct xe_lrc *lrc,
			i = emit_aux_table_inv(gt, VE0_AUX_INV, dw, i);
	}

	if (vm->batch_invalidate_tlb)
	if (vm && vm->batch_invalidate_tlb)
		i = emit_flush_imm_ggtt(xe_lrc_start_seqno_ggtt_addr(lrc),
					seqno, true, dw, i);

	dw[i++] = preparser_disable(false);

	if (!vm->batch_invalidate_tlb)
	if (!vm || !vm->batch_invalidate_tlb)
		i = emit_store_imm_ggtt(xe_lrc_start_seqno_ggtt_addr(lrc),
					seqno, dw, i);

@@ -318,7 +318,7 @@ static void __emit_job_gen12_render_compute(struct xe_sched_job *job,
		mask_flags = PIPE_CONTROL_3D_ENGINE_FLAGS;

	/* See __xe_pt_bind_vma() for a discussion on TLB invalidations. */
	i = emit_pipe_invalidate(mask_flags, vm->batch_invalidate_tlb, dw, i);
	i = emit_pipe_invalidate(mask_flags, vm && vm->batch_invalidate_tlb, dw, i);

	/* hsdes: 1809175790 */
	if (has_aux_ccs(xe))
+3 −0
Original line number Diff line number Diff line
@@ -87,6 +87,9 @@ struct xe_sched_job *xe_sched_job_create(struct xe_exec_queue *q,
	int i, j;
	u32 width;

	/* only a kernel context can submit a vm-less job */
	XE_WARN_ON(!q->vm && !(q->flags & EXEC_QUEUE_FLAG_KERNEL));

	/* Migration and kernel engines have their own locking */
	if (!(q->flags & (EXEC_QUEUE_FLAG_KERNEL | EXEC_QUEUE_FLAG_VM |
			  EXEC_QUEUE_FLAG_WA))) {