From patchwork Thu Sep 28 15:35:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Submit on user exec_q From: Ashutosh Dixit X-Patchwork-Id: 560112 Message-Id: <20230928153554.3833949-1-ashutosh.dixit@intel.com> To: intel-gfx-trybot@lists.freedesktop.org Date: Thu, 28 Sep 2023 08:35:54 -0700 Signed-off-by: Ashutosh Dixit --- drivers/gpu/drm/xe/xe_oa.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c index 73558c3cb2c8b..7d7668cd5a98c 100644 --- a/drivers/gpu/drm/xe/xe_oa.c +++ b/drivers/gpu/drm/xe/xe_oa.c @@ -660,20 +660,27 @@ static __poll_t xe_oa_poll(struct file *file, poll_table *wait) static int xe_oa_submit_bb(struct xe_oa_stream *stream, struct xe_bb *bb) { + struct xe_exec_queue *q = stream->exec_q; struct xe_hw_engine *hwe = stream->hwe; struct xe_sched_job *job; - struct xe_exec_queue *q; struct dma_fence *fence; + struct xe_vm *vm; long timeout; int err = 0; - q = xe_exec_queue_create(hwe->gt->tile->xe, NULL, BIT(hwe->logical_instance), 1, - hwe, EXEC_QUEUE_FLAG_KERNEL); - if (IS_ERR(q)) { - err = PTR_ERR(q); - drm_err(&stream->oa->xe->drm, "gt%d, hwe %s, xe_exec_queue_create failed=%d", - stream->gt->info.id, hwe->name, err); - goto exit; + if (!stream->exec_q) { + q = xe_exec_queue_create(hwe->gt->tile->xe, NULL, BIT(hwe->logical_instance), 1, + hwe, EXEC_QUEUE_FLAG_KERNEL); + if (IS_ERR(q)) { + err = PTR_ERR(q); + drm_err(&stream->oa->xe->drm, "gt%d, hwe %s, xe_exec_queue_create failed=%d", + stream->gt->info.id, hwe->name, err); + goto exit; + } + } else { + q->flags |= EXEC_QUEUE_FLAG_KERNEL; + vm = q->vm; + q->vm = NULL; } /* Will add MI_BATCH_BUFFER_END */ @@ -694,7 +701,13 @@ static int xe_oa_submit_bb(struct xe_oa_stream *stream, struct xe_bb *bb) else if (!timeout) err = -ETIME; put_exec_q: - xe_exec_queue_put(q); + if (!stream->exec_q) { + xe_exec_queue_put(q); + } else { + /* Restore exec_q state */ + q->flags &= ~EXEC_QUEUE_FLAG_KERNEL; + q->vm = vm; + } exit: return err; }