[PATCH 02/10] drm/i915/gt: Avoid using the GPU before initialisation
Chris Wilson
chris at chris-wilson.co.uk
Fri Dec 27 18:40:35 UTC 2019
Mark the GT as wedged so that we are not tempted to use it prior to
initialisation.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Andi Shyti <andi.shyti at intel.com>
---
drivers/gpu/drm/i915/gt/intel_engine_pm.c | 8 ++++----
drivers/gpu/drm/i915/gt/intel_gt.c | 1 +
drivers/gpu/drm/i915/gt/intel_gt_pm.c | 6 +++++-
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/i915/gt/intel_engine_pm.c b/drivers/gpu/drm/i915/gt/intel_engine_pm.c
index 010620b78202..cd82f0baef49 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_pm.c
+++ b/drivers/gpu/drm/i915/gt/intel_engine_pm.c
@@ -123,16 +123,16 @@ static bool switch_to_kernel_context(struct intel_engine_cs *engine)
unsigned long flags;
bool result = true;
+ /* GPU is pointing to the void, as good as in the kernel context. */
+ if (intel_gt_is_wedged(engine->gt))
+ return true;
+
GEM_BUG_ON(!intel_context_is_barrier(ce));
/* Already inside the kernel context, safe to power down. */
if (engine->wakeref_serial == engine->serial)
return true;
- /* GPU is pointing to the void, as good as in the kernel context. */
- if (intel_gt_is_wedged(engine->gt))
- return true;
-
/*
* Note, we do this without taking the timeline->mutex. We cannot
* as we may be called while retiring the kernel context and so
diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
index 8a17abfbb19f..1076362332fd 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt.c
@@ -567,6 +567,7 @@ int intel_gt_init(struct intel_gt *gt)
* just magically go away.
*/
intel_uncore_forcewake_get(gt->uncore, FORCEWAKE_ALL);
+ set_bit(I915_WEDGED, >->reset.flags); /* no GPU until we are ready! */
err = intel_gt_init_scratch(gt, IS_GEN(gt->i915, 2) ? SZ_256K : SZ_4K);
if (err)
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.c b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
index 3cda837d64c9..9b220c930ebc 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_pm.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
@@ -179,7 +179,7 @@ int intel_gt_resume(struct intel_gt *gt)
enum intel_engine_id id;
int err;
- err = intel_gt_terminally_wedged(gt);
+ err = intel_gt_has_init_error(gt);
if (err)
return err;
@@ -196,6 +196,10 @@ int intel_gt_resume(struct intel_gt *gt)
intel_uncore_forcewake_get(gt->uncore, FORCEWAKE_ALL);
intel_rc6_sanitize(>->rc6);
gt_sanitize(gt, true);
+ if (intel_gt_is_wedged(gt)) {
+ err = -EIO;
+ goto out_fw;
+ }
/* Only when the HW is re-initialised, can we replay the requests */
err = intel_gt_init_hw(gt);
--
2.24.1
More information about the Intel-gfx-trybot
mailing list