All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] drm/i915/guc: Separate GuC doorbell destroy function into doorbell unit and GuC task
@ 2017-11-05 13:39 Sagar Arun Kamble
  2017-11-05 13:39 ` [PATCH 2/5] drm/i915/guc: Release all client doorbells on suspend and acquire on resume Sagar Arun Kamble
                   ` (5 more replies)
  0 siblings, 6 replies; 17+ messages in thread
From: Sagar Arun Kamble @ 2017-11-05 13:39 UTC (permalink / raw)
  To: intel-gfx

Releasing GuC doorbell involves stopping the doorbell unit snooping and
executing doorbell deallocation flow in GuC firmware. When GuC is in sane
state, both steps will be necessary to release doorbell.
If GuC is hung (possibly leading to i915 reset), only doorbell unit
snooping is to be stopped. destroy_doorbell will be called in suspend and
reset flows differently in upcoming patches.

Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michał Winiarski <michal.winiarski@intel.com>
Cc: Michel Thierry <michel.thierry@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_guc_submission.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
index d14c134..b6486dc 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -207,7 +207,7 @@ static int __create_doorbell(struct i915_guc_client *client)
 	return err;
 }
 
-static int __destroy_doorbell(struct i915_guc_client *client)
+static int __destroy_doorbell(struct i915_guc_client *client, bool notify_guc)
 {
 	struct drm_i915_private *dev_priv = guc_to_i915(client->guc);
 	struct guc_doorbell_info *doorbell;
@@ -225,7 +225,10 @@ static int __destroy_doorbell(struct i915_guc_client *client)
 	if (wait_for_us(!(I915_READ(GEN8_DRBREGL(db_id)) & GEN8_DRB_VALID), 10))
 		WARN_ONCE(true, "Doorbell never became invalid after disable\n");
 
-	return __guc_deallocate_doorbell(client->guc, client->stage_id);
+	if (notify_guc)
+		return __guc_deallocate_doorbell(client->guc, client->stage_id);
+
+	return 0;
 }
 
 static int create_doorbell(struct i915_guc_client *client)
@@ -250,7 +253,11 @@ static int create_doorbell(struct i915_guc_client *client)
 	return ret;
 }
 
-static int destroy_doorbell(struct i915_guc_client *client)
+/*
+ * This function deactivates doorbell monitoring through doorbell unit and
+ * optionally notifies GuC to deallocate the doorbell.
+ */
+static int destroy_doorbell(struct i915_guc_client *client, bool notify_guc)
 {
 	int err;
 
@@ -259,7 +266,7 @@ static int destroy_doorbell(struct i915_guc_client *client)
 	/* XXX: wait for any interrupts */
 	/* XXX: wait for workqueue to drain */
 
-	err = __destroy_doorbell(client);
+	err = __destroy_doorbell(client, notify_guc);
 	if (err)
 		return err;
 
@@ -873,7 +880,7 @@ static int __reset_doorbell(struct i915_guc_client* client, u16 db_id)
 	__update_doorbell_desc(client, db_id);
 	err = __create_doorbell(client);
 	if (!err)
-		err = __destroy_doorbell(client);
+		err = __destroy_doorbell(client, true);
 
 	return err;
 }
@@ -899,7 +906,7 @@ static int guc_init_doorbell_hw(struct intel_guc *guc)
 
 		if (has_doorbell(client)) {
 			/* Borrow execbuf_client (we will recreate it later) */
-			destroy_doorbell(client);
+			destroy_doorbell(client, true);
 			recreate_first_client = true;
 		}
 
@@ -925,7 +932,7 @@ static int guc_init_doorbell_hw(struct intel_guc *guc)
 
 	ret = __create_doorbell(guc->preempt_client);
 	if (ret) {
-		__destroy_doorbell(guc->execbuf_client);
+		__destroy_doorbell(guc->execbuf_client, true);
 		return ret;
 	}
 
@@ -1043,7 +1050,7 @@ static void guc_client_free(struct i915_guc_client *client)
 	/* FIXME: in many cases, by the time we get here the GuC has been
 	 * reset, so we cannot destroy the doorbell properly. Ignore the
 	 * error message for now */
-	destroy_doorbell(client);
+	destroy_doorbell(client, true);
 	guc_stage_desc_fini(client->guc, client);
 	i915_gem_object_unpin_map(client->vma->obj);
 	i915_vma_unpin_and_release(&client->vma);
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 17+ messages in thread
* [PATCH 1/5] drm/i915/guc: Remove obsolete comments and remove unused variable
@ 2017-09-14  8:32 Michał Winiarski
  2017-09-14  8:32 ` [PATCH 5/5] HAX Enable GuC Submission for CI Michał Winiarski
  0 siblings, 1 reply; 17+ messages in thread
From: Michał Winiarski @ 2017-09-14  8:32 UTC (permalink / raw)
  To: intel-gfx

Originally removed in:
c1adab970348 ("drm/i915/guc: Remove failed doorbell stat from debugfs")
f1448a62a103 ("drm/i915/guc: Remove last submission result from debugfs")

Were accidentally restored in:
925344ccc91d ("BackMerge tag 'v4.12-rc5' into drm-next")

We can also remove unused variable and replace it with a WARN.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_guc_submission.c | 3 +--
 drivers/gpu/drm/i915/intel_uc.h            | 4 ----
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
index b28677e5a4f2..c180ff1423fd 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -601,7 +601,6 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
 	struct intel_guc *guc = &rq->i915->guc;
 	struct i915_guc_client *client = guc->execbuf_client;
 	unsigned long flags;
-	int b_ret;
 
 	/* WA to flush out the pending GMADR writes to ring buffer. */
 	if (i915_vma_is_map_and_fenceable(rq->ring->vma))
@@ -610,7 +609,7 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
 	spin_lock_irqsave(&client->wq_lock, flags);
 
 	guc_wq_item_append(client, rq);
-	b_ret = guc_ring_doorbell(client);
+	WARN_ON(guc_ring_doorbell(client));
 
 	client->submissions[engine_id] += 1;
 
diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
index 22ae52b17b0f..69daf4c01cd0 100644
--- a/drivers/gpu/drm/i915/intel_uc.h
+++ b/drivers/gpu/drm/i915/intel_uc.h
@@ -59,10 +59,6 @@ struct drm_i915_gem_request;
  *                available in the work queue (note, the queue is shared,
  *                not per-engine). It is OK for this to be nonzero, but
  *                it should not be huge!
- *   b_fail: failed to ring the doorbell. This should never happen, unless
- *           somehow the hardware misbehaves, or maybe if the GuC firmware
- *           crashes? We probably need to reset the GPU to recover.
- *   retcode: errno from last guc_submit()
  */
 struct i915_guc_client {
 	struct i915_vma *vma;
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 17+ messages in thread
* [PATCH 1/5] drm/i915/guc: Remove obsolete comments and remove unused variable
@ 2017-09-12 17:40 Michał Winiarski
  2017-09-12 17:40 ` [PATCH 5/5] HAX Enable GuC Submission for CI Michał Winiarski
  0 siblings, 1 reply; 17+ messages in thread
From: Michał Winiarski @ 2017-09-12 17:40 UTC (permalink / raw)
  To: intel-gfx

Originally removed in:
c1adab970348 ("drm/i915/guc: Remove failed doorbell stat from debugfs")
f1448a62a103 ("drm/i915/guc: Remove last submission result from debugfs")

Were accidentally restored in:
925344ccc91d ("BackMerge tag 'v4.12-rc5' into drm-next")

We can also remove unused variable and replace it with a WARN.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_guc_submission.c | 3 +--
 drivers/gpu/drm/i915/intel_uc.h            | 4 ----
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
index 48a1e9349a2c..8a550785b257 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -602,7 +602,6 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
 	struct intel_guc *guc = &rq->i915->guc;
 	struct i915_guc_client *client = guc->execbuf_client;
 	unsigned long flags;
-	int b_ret;
 
 	/* WA to flush out the pending GMADR writes to ring buffer. */
 	if (i915_vma_is_map_and_fenceable(rq->ring->vma))
@@ -611,7 +610,7 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
 	spin_lock_irqsave(&client->wq_lock, flags);
 
 	guc_wq_item_append(client, rq);
-	b_ret = guc_ring_doorbell(client);
+	WARN_ON(guc_ring_doorbell(client));
 
 	client->submissions[engine_id] += 1;
 
diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
index 22ae52b17b0f..69daf4c01cd0 100644
--- a/drivers/gpu/drm/i915/intel_uc.h
+++ b/drivers/gpu/drm/i915/intel_uc.h
@@ -59,10 +59,6 @@ struct drm_i915_gem_request;
  *                available in the work queue (note, the queue is shared,
  *                not per-engine). It is OK for this to be nonzero, but
  *                it should not be huge!
- *   b_fail: failed to ring the doorbell. This should never happen, unless
- *           somehow the hardware misbehaves, or maybe if the GuC firmware
- *           crashes? We probably need to reset the GPU to recover.
- *   retcode: errno from last guc_submit()
  */
 struct i915_guc_client {
 	struct i915_vma *vma;
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 17+ messages in thread
* [PATCH 1/5] drm/i915/guc: Remove obsolete comments and remove unused variable
@ 2017-09-12 15:37 Chris Wilson
  2017-09-12 15:37 ` [PATCH 5/5] HAX Enable GuC Submission for CI Chris Wilson
  0 siblings, 1 reply; 17+ messages in thread
From: Chris Wilson @ 2017-09-12 15:37 UTC (permalink / raw)
  To: intel-gfx

From: Michał Winiarski <michal.winiarski@intel.com>

Originally removed in:
c1adab970348 ("drm/i915/guc: Remove failed doorbell stat from debugfs")
f1448a62a103 ("drm/i915/guc: Remove last submission result from debugfs")

Were accidentaly restored in:
925344ccc91d ("BackMerge tag 'v4.12-rc5' into drm-next")

We can also remove unused variable and replace it with a WARN.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20170912124726.19689-1-michal.winiarski@intel.com
---
 drivers/gpu/drm/i915/i915_guc_submission.c | 3 +--
 drivers/gpu/drm/i915/intel_uc.h            | 4 ----
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
index 48a1e9349a2c..8a550785b257 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -602,7 +602,6 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
 	struct intel_guc *guc = &rq->i915->guc;
 	struct i915_guc_client *client = guc->execbuf_client;
 	unsigned long flags;
-	int b_ret;
 
 	/* WA to flush out the pending GMADR writes to ring buffer. */
 	if (i915_vma_is_map_and_fenceable(rq->ring->vma))
@@ -611,7 +610,7 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
 	spin_lock_irqsave(&client->wq_lock, flags);
 
 	guc_wq_item_append(client, rq);
-	b_ret = guc_ring_doorbell(client);
+	WARN_ON(guc_ring_doorbell(client));
 
 	client->submissions[engine_id] += 1;
 
diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
index 22ae52b17b0f..69daf4c01cd0 100644
--- a/drivers/gpu/drm/i915/intel_uc.h
+++ b/drivers/gpu/drm/i915/intel_uc.h
@@ -59,10 +59,6 @@ struct drm_i915_gem_request;
  *                available in the work queue (note, the queue is shared,
  *                not per-engine). It is OK for this to be nonzero, but
  *                it should not be huge!
- *   b_fail: failed to ring the doorbell. This should never happen, unless
- *           somehow the hardware misbehaves, or maybe if the GuC firmware
- *           crashes? We probably need to reset the GPU to recover.
- *   retcode: errno from last guc_submit()
  */
 struct i915_guc_client {
 	struct i915_vma *vma;
-- 
2.14.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2017-11-08 12:32 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-05 13:39 [PATCH 1/5] drm/i915/guc: Separate GuC doorbell destroy function into doorbell unit and GuC task Sagar Arun Kamble
2017-11-05 13:39 ` [PATCH 2/5] drm/i915/guc: Release all client doorbells on suspend and acquire on resume Sagar Arun Kamble
2017-11-06 12:13   ` Chris Wilson
2017-11-07  6:05     ` Sagar Arun Kamble
2017-11-07  9:21       ` Chris Wilson
2017-11-07 10:27         ` Michal Wajdeczko
2017-11-07 10:33           ` Sagar Arun Kamble
2017-11-05 13:39 ` [PATCH 3/5] drm/i915/guc: Deactivate all client doorbells before reset Sagar Arun Kamble
2017-11-05 13:39 ` [PATCH 4/5] drm/i915/guc: Increase wait timeout for doorbell release status update Sagar Arun Kamble
2017-11-05 15:55   ` Michal Wajdeczko
2017-11-06  5:43     ` Sagar Arun Kamble
2017-11-05 13:39 ` [PATCH 5/5] HAX enable GuC submission for CI Sagar Arun Kamble
2017-11-05 14:18 ` ✗ Fi.CI.BAT: warning for series starting with [1/5] drm/i915/guc: Separate GuC doorbell destroy function into doorbell unit and GuC task Patchwork
2017-11-08 12:32 ` ✓ Fi.CI.BAT: success " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2017-09-14  8:32 [PATCH 1/5] drm/i915/guc: Remove obsolete comments and remove unused variable Michał Winiarski
2017-09-14  8:32 ` [PATCH 5/5] HAX Enable GuC Submission for CI Michał Winiarski
2017-09-12 17:40 [PATCH 1/5] drm/i915/guc: Remove obsolete comments and remove unused variable Michał Winiarski
2017-09-12 17:40 ` [PATCH 5/5] HAX Enable GuC Submission for CI Michał Winiarski
2017-09-12 15:37 [PATCH 1/5] drm/i915/guc: Remove obsolete comments and remove unused variable Chris Wilson
2017-09-12 15:37 ` [PATCH 5/5] HAX Enable GuC Submission for CI Chris Wilson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.