[PATCH 64/75] drm/i915: Pass engine to i915_request_submit()

Chris Wilson chris at chris-wilson.co.uk
Tue Feb 2 11:38:21 UTC 2021


Pass the physical engine to the request submit interface so that we may
pass the real engine to the engine->emit vfuncs.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 .../gpu/drm/i915/gt/intel_execlists_submission.c  |  9 ++++-----
 drivers/gpu/drm/i915/gt/intel_reset.c             |  6 ++++--
 drivers/gpu/drm/i915/gt/intel_ring_scheduler.c    | 15 ++++++++-------
 drivers/gpu/drm/i915/gt/intel_ring_submission.c   |  6 ++++--
 drivers/gpu/drm/i915/gt/mock_engine.c             |  4 ++--
 drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c |  4 ++--
 drivers/gpu/drm/i915/i915_request.c               |  9 +++++----
 drivers/gpu/drm/i915/i915_request.h               |  6 ++++--
 8 files changed, 33 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
index 26b514596343..6debb3c50d70 100644
--- a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
+++ b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
@@ -1483,7 +1483,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
 				merge = false;
 			}
 
-			if (__i915_request_submit(rq)) {
+			if (__i915_request_submit(rq, engine)) {
 				if (!merge) {
 					*port++ = i915_request_get(last);
 					last = NULL;
@@ -2737,7 +2737,7 @@ static void execlists_reset_cancel(struct intel_engine_cs *engine)
 	for_each_priolist(pl, &se->queue) {
 		priolist_for_each_request_safe(rq, rn, pl) {
 			if (i915_request_mark_eio(rq)) {
-				__i915_request_submit(rq);
+				__i915_request_submit(rq, engine);
 				i915_request_put(rq);
 			}
 		}
@@ -2761,8 +2761,7 @@ static void execlists_reset_cancel(struct intel_engine_cs *engine)
 		for_each_priolist(pl, &ve->base.sched.queue) {
 			priolist_for_each_request_safe(rq, rn, pl) {
 				if (i915_request_mark_eio(rq)) {
-					rq->engine = engine;
-					__i915_request_submit(rq);
+					__i915_request_submit(rq, engine);
 					i915_request_put(rq);
 				}
 			}
@@ -3149,7 +3148,7 @@ static void rcu_virtual_context_destroy(struct work_struct *wrk)
 		spin_lock_irq(&se->lock);
 		for_each_priolist(pl, &se->queue) {
 			priolist_for_each_request_safe(rq, rn, pl)
-				__i915_request_submit(rq);
+				__i915_request_submit(rq, &ve->base);
 			i915_priolist_advance(&se->queue, pl);
 		}
 		spin_unlock_irq(&se->lock);
diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/gt/intel_reset.c
index 149bfd9dd7c8..477b948da1f4 100644
--- a/drivers/gpu/drm/i915/gt/intel_reset.c
+++ b/drivers/gpu/drm/i915/gt/intel_reset.c
@@ -790,8 +790,10 @@ static void nop_submit_request(struct i915_request *request)
 
 	request = i915_request_mark_eio(request);
 	if (request) {
-		i915_request_submit(request);
-		intel_engine_signal_breadcrumbs(request->engine);
+		struct intel_engine_cs *engine = request->engine;
+
+		i915_request_submit(request, engine);
+		intel_engine_signal_breadcrumbs(engine);
 
 		i915_request_put(request);
 	}
diff --git a/drivers/gpu/drm/i915/gt/intel_ring_scheduler.c b/drivers/gpu/drm/i915/gt/intel_ring_scheduler.c
index bc44cebbf7c2..e5fa9a929e4a 100644
--- a/drivers/gpu/drm/i915/gt/intel_ring_scheduler.c
+++ b/drivers/gpu/drm/i915/gt/intel_ring_scheduler.c
@@ -453,15 +453,16 @@ static void switch_context(struct intel_ring *ring, struct i915_request *rq)
 	remap_l3(ring, engine, ce);
 }
 
-static struct i915_request *ring_submit(struct i915_request *rq)
+static struct i915_request *
+ring_submit(struct intel_engine_cs *engine, struct i915_request *rq)
 {
-	struct intel_ring *ring = rq->engine->legacy.ring;
+	struct intel_ring *ring = engine->legacy.ring;
 
-	__i915_request_submit(rq);
+	__i915_request_submit(rq, engine);
 
-	if (rq->engine->legacy.context != rq->context) {
+	if (engine->legacy.context != rq->context) {
 		switch_context(ring, rq);
-		set_current_context(&rq->engine->legacy.context, rq->context);
+		set_current_context(&engine->legacy.context, rq->context);
 	}
 
 	ring_copy(ring, rq->ring, rq->head, rq->tail);
@@ -557,7 +558,7 @@ static void dequeue(struct i915_sched *se, struct intel_engine_cs *engine)
 				*port++ = i915_request_get(last);
 			}
 
-			last = ring_submit(rq);
+			last = ring_submit(engine, rq);
 		}
 
 		i915_priolist_advance(&se->queue, p);
@@ -732,7 +733,7 @@ static void ring_reset_cancel(struct intel_engine_cs *engine)
 	for_each_priolist(p, &se->queue) {
 		priolist_for_each_request_safe(rq, rn, p) {
 			i915_request_mark_eio(rq);
-			__i915_request_submit(rq);
+			__i915_request_submit(rq, engine);
 		}
 		i915_priolist_advance(&se->queue, p);
 	}
diff --git a/drivers/gpu/drm/i915/gt/intel_ring_submission.c b/drivers/gpu/drm/i915/gt/intel_ring_submission.c
index e7947652108e..de2d86e0dd07 100644
--- a/drivers/gpu/drm/i915/gt/intel_ring_submission.c
+++ b/drivers/gpu/drm/i915/gt/intel_ring_submission.c
@@ -413,10 +413,12 @@ static void reset_cancel(struct intel_engine_cs *engine)
 
 static void i9xx_submit_request(struct i915_request *request)
 {
-	i915_request_submit(request);
+	struct intel_engine_cs *engine = request->engine;
+
+	i915_request_submit(request, engine);
 	wmb(); /* paranoid flush writes out of the WCB before mmio */
 
-	ENGINE_WRITE(request->engine, RING_TAIL,
+	ENGINE_WRITE(engine, RING_TAIL,
 		     intel_ring_set_tail(request->ring, request->tail));
 }
 
diff --git a/drivers/gpu/drm/i915/gt/mock_engine.c b/drivers/gpu/drm/i915/gt/mock_engine.c
index 8c66c1e9fa09..cb5c5721623a 100644
--- a/drivers/gpu/drm/i915/gt/mock_engine.c
+++ b/drivers/gpu/drm/i915/gt/mock_engine.c
@@ -208,7 +208,7 @@ static void mock_submit_request(struct i915_request *request)
 		container_of(request->engine, typeof(*engine), base);
 	unsigned long flags;
 
-	i915_request_submit(request);
+	i915_request_submit(request, &engine->base);
 
 	spin_lock_irqsave(&engine->hw_lock, flags);
 	list_add_tail(&request->mock.link, &engine->hw_queue);
@@ -251,7 +251,7 @@ static void mock_reset_cancel(struct intel_engine_cs *engine)
 	/* Cancel and submit all pending requests. */
 	list_for_each_entry(rq, &mock->hw_queue, mock.link) {
 		if (i915_request_mark_eio(rq)) {
-			__i915_request_submit(rq);
+			__i915_request_submit(rq, engine);
 			i915_request_put(rq);
 		}
 	}
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
index 91564182e371..1278b282346b 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
@@ -213,7 +213,7 @@ static void __guc_dequeue(struct intel_engine_cs *engine)
 			}
 
 			list_del_init(&rq->sched.link);
-			__i915_request_submit(rq);
+			__i915_request_submit(rq, engine);
 			submit = true;
 			last = rq;
 		}
@@ -359,7 +359,7 @@ static void guc_reset_cancel(struct intel_engine_cs *engine)
 	for_each_priolist(p, &se->queue) {
 		priolist_for_each_request_safe(rq, rn, p) {
 			list_del_init(&rq->sched.link);
-			__i915_request_submit(rq);
+			__i915_request_submit(rq, engine);
 			dma_fence_set_error(&rq->fence, -EIO);
 			i915_request_mark_complete(rq);
 		}
diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c
index e0ebdefd35ee..46ae475c84f2 100644
--- a/drivers/gpu/drm/i915/i915_request.c
+++ b/drivers/gpu/drm/i915/i915_request.c
@@ -461,9 +461,9 @@ struct i915_request *i915_request_mark_eio(struct i915_request *rq)
 	return rq;
 }
 
-bool __i915_request_submit(struct i915_request *request)
+bool __i915_request_submit(struct i915_request *request,
+			   struct intel_engine_cs *engine)
 {
-	struct intel_engine_cs *engine = request->engine;
 	struct i915_sched *se = intel_engine_get_scheduler(engine);
 	bool result = false;
 
@@ -550,7 +550,8 @@ bool __i915_request_submit(struct i915_request *request)
 	return result;
 }
 
-void i915_request_submit(struct i915_request *request)
+void i915_request_submit(struct i915_request *request,
+			 struct intel_engine_cs *engine)
 {
 	struct i915_sched *se = i915_request_get_scheduler(request);
 	unsigned long flags;
@@ -558,7 +559,7 @@ void i915_request_submit(struct i915_request *request)
 	/* Will be called from irq-context when using foreign fences. */
 	spin_lock_irqsave(&se->lock, flags);
 
-	__i915_request_submit(request);
+	__i915_request_submit(request, engine);
 
 	spin_unlock_irqrestore(&se->lock, flags);
 }
diff --git a/drivers/gpu/drm/i915/i915_request.h b/drivers/gpu/drm/i915/i915_request.h
index 62840206e3dd..45c494035cdd 100644
--- a/drivers/gpu/drm/i915/i915_request.h
+++ b/drivers/gpu/drm/i915/i915_request.h
@@ -362,8 +362,10 @@ int i915_request_await_execution(struct i915_request *rq,
 
 void i915_request_add(struct i915_request *rq);
 
-bool __i915_request_submit(struct i915_request *request);
-void i915_request_submit(struct i915_request *request);
+bool __i915_request_submit(struct i915_request *request,
+			   struct intel_engine_cs *engine);
+void i915_request_submit(struct i915_request *request,
+			 struct intel_engine_cs *engine);
 
 void __i915_request_unsubmit(struct i915_request *request);
 void i915_request_unsubmit(struct i915_request *request);
-- 
2.20.1



More information about the Intel-gfx-trybot mailing list