drm/i915: Cancel reset preparations on failed resets
authorMika Kuoppala <mika.kuoppala@linux.intel.com>
Tue, 5 Jun 2018 16:03:56 +0000 (19:03 +0300)
committerMika Kuoppala <mika.kuoppala@linux.intel.com>
Fri, 8 Jun 2018 09:16:19 +0000 (12:16 +0300)
Our reset handling has a retry layer further up in the
chain. As we have told the engine to prepare for reset,
and failed it, make sure to remove that preparation so
that the next attempted reset has a clean slate by triggering
another full prepare cycle for the engines.

v2: ret as int, simplified cleanup (Chris)

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20180605160357.32591-1-mika.kuoppala@linux.intel.com
drivers/gpu/drm/i915/intel_uncore.c

index b36a3b5736a0e1952cfd1ccdc6c2e2d93ec51420..bb03f6d8b3d16f103df70ea504573283f5812e20 100644 (file)
@@ -2093,21 +2093,25 @@ static int gen8_reset_engines(struct drm_i915_private *dev_priv,
 {
        struct intel_engine_cs *engine;
        unsigned int tmp;
+       int ret;
 
-       for_each_engine_masked(engine, dev_priv, engine_mask, tmp)
-               if (gen8_reset_engine_start(engine))
+       for_each_engine_masked(engine, dev_priv, engine_mask, tmp) {
+               if (gen8_reset_engine_start(engine)) {
+                       ret = -EIO;
                        goto not_ready;
+               }
+       }
 
        if (INTEL_GEN(dev_priv) >= 11)
-               return gen11_reset_engines(dev_priv, engine_mask);
+               ret = gen11_reset_engines(dev_priv, engine_mask);
        else
-               return gen6_reset_engines(dev_priv, engine_mask);
+               ret = gen6_reset_engines(dev_priv, engine_mask);
 
 not_ready:
        for_each_engine_masked(engine, dev_priv, engine_mask, tmp)
                gen8_reset_engine_cancel(engine);
 
-       return -EIO;
+       return ret;
 }
 
 typedef int (*reset_func)(struct drm_i915_private *, unsigned engine_mask);