[Intel-gfx] [PATCH 2/8] drm/i915: Wrap port cancellation into a function
Mika Kuoppala
mika.kuoppala at linux.intel.com
Tue Sep 12 08:36:12 UTC 2017
On reset and wedged path, we want to release the requests
that are tied to ports and then mark the ports to be unset.
Introduce a function for this.
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
---
drivers/gpu/drm/i915/i915_gem.c | 11 ++++-------
drivers/gpu/drm/i915/intel_engine_cs.c | 10 ++++++++++
drivers/gpu/drm/i915/intel_lrc.c | 5 +----
drivers/gpu/drm/i915/intel_ringbuffer.h | 2 ++
4 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 7d0263e9c220..d65f654821cb 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3047,17 +3047,14 @@ static void engine_set_wedged(struct intel_engine_cs *engine)
*/
if (i915.enable_execlists) {
- struct execlist_port *port = engine->execlist.port;
+ struct intel_engine_execlist * const el = &engine->execlist;
unsigned long flags;
- unsigned int n;
spin_lock_irqsave(&engine->timeline->lock, flags);
- for (n = 0; n < ARRAY_SIZE(engine->execlist.port); n++)
- i915_gem_request_put(port_request(&port[n]));
- memset(engine->execlist.port, 0, sizeof(engine->execlist.port));
- engine->execlist.queue = RB_ROOT;
- engine->execlist.first = NULL;
+ execlist_cancel_port_requests(el);
+ el->queue = RB_ROOT;
+ el->first = NULL;
spin_unlock_irqrestore(&engine->timeline->lock, flags);
diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
index 6197df0de3fe..192ecc26f432 100644
--- a/drivers/gpu/drm/i915/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/intel_engine_cs.c
@@ -1407,6 +1407,16 @@ bool intel_engine_can_store_dword(struct intel_engine_cs *engine)
}
}
+void execlist_cancel_port_requests(struct intel_engine_execlist * const el)
+{
+ unsigned int i;
+
+ for (i = 0; i < ARRAY_SIZE(el->port); i++)
+ i915_gem_request_put(port_request(&el->port[i]));
+
+ memset(el->port, 0, sizeof(el->port));
+}
+
#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
#include "selftests/mock_engine.c"
#endif
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 2964e7c0a873..7dc893806b43 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -1331,7 +1331,6 @@ static void reset_common_ring(struct intel_engine_cs *engine,
{
struct execlist_port *port = engine->execlist.port;
struct intel_context *ce;
- unsigned int n;
/*
* Catch up with any missed context-switch interrupts.
@@ -1343,9 +1342,7 @@ static void reset_common_ring(struct intel_engine_cs *engine,
* requests were completed.
*/
if (!request) {
- for (n = 0; n < ARRAY_SIZE(engine->execlist.port); n++)
- i915_gem_request_put(port_request(&port[n]));
- memset(engine->execlist.port, 0, sizeof(engine->execlist.port));
+ execlist_cancel_port_requests(&engine->execlist);
return;
}
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index 326ca1453e91..ae921f916c89 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -493,6 +493,8 @@ struct intel_engine_cs {
u32 (*get_cmd_length_mask)(u32 cmd_header);
};
+void execlist_cancel_port_requests(struct intel_engine_execlist * const el);
+
static inline unsigned int
intel_engine_flag(const struct intel_engine_cs *engine)
{
--
2.11.0
More information about the Intel-gfx
mailing list