drm/i915/gt: Pull intel_gt_init_hw() into intel_gt_resume()
authorChris Wilson <chris@chris-wilson.co.uk>
Sun, 22 Dec 2019 14:40:44 +0000 (14:40 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Sun, 22 Dec 2019 15:18:04 +0000 (15:18 +0000)
Since intel_gt_resume() is always immediately proceeded by init_hw, pull
the call into intel_gt_resume, where we have the rpm and fw already
held.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Andi Shyti <andi.shyti@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191222144046.1674865-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gem/i915_gem_pm.c
drivers/gpu/drm/i915/gt/intel_gt.c
drivers/gpu/drm/i915/gt/intel_gt_pm.c

index 3671a4e7e1cbb951adb993b3168797a3b7767c8b..c8264eb036bfd8a3f0d694398239eb05aadf5658 100644 (file)
@@ -101,28 +101,10 @@ void i915_gem_resume(struct drm_i915_private *i915)
 {
        GEM_TRACE("%s\n", dev_name(i915->drm.dev));
 
-       intel_uncore_forcewake_get(&i915->uncore, FORCEWAKE_ALL);
-
-       if (intel_gt_init_hw(&i915->gt))
-               goto err_wedged;
-
        /*
         * As we didn't flush the kernel context before suspend, we cannot
         * guarantee that the context image is complete. So let's just reset
         * it and start again.
         */
-       if (intel_gt_resume(&i915->gt))
-               goto err_wedged;
-
-out_unlock:
-       intel_uncore_forcewake_put(&i915->uncore, FORCEWAKE_ALL);
-       return;
-
-err_wedged:
-       if (!intel_gt_is_wedged(&i915->gt)) {
-               dev_err(i915->drm.dev,
-                       "Failed to re-initialize GPU, declaring it wedged!\n");
-               intel_gt_set_wedged(&i915->gt);
-       }
-       goto out_unlock;
+       intel_gt_resume(&i915->gt);
 }
index f29c44bf992f6a8f5f6c7869d071e62c6cbcdf86..4a2d0eb05663546ec2d7a88a9127c5c59b43452c 100644 (file)
@@ -594,14 +594,9 @@ int intel_gt_init(struct intel_gt *gt)
 
        intel_uc_init(&gt->uc);
 
-       err = intel_gt_init_hw(gt);
-       if (err)
-               goto err_uc_init;
-
-       /* Only when the HW is re-initialised, can we replay the requests */
        err = intel_gt_resume(gt);
        if (err)
-               goto err_gt_init_hw;
+               goto err_uc_init;
 
        err = __engines_record_defaults(gt);
        if (err)
@@ -618,7 +613,6 @@ int intel_gt_init(struct intel_gt *gt)
        goto out_fw;
 err_gt:
        __intel_gt_disable(gt);
-err_gt_init_hw:
        intel_uc_fini_hw(&gt->uc);
 err_uc_init:
        intel_uc_fini(&gt->uc);
index 6231fe91a3b15a599610b03dc16e599e6a27905c..45b68a17da4dd7fd6e51ec5a44c1b37353bd70f3 100644 (file)
@@ -187,7 +187,7 @@ int intel_gt_resume(struct intel_gt *gt)
 {
        struct intel_engine_cs *engine;
        enum intel_engine_id id;
-       int err = 0;
+       int err;
 
        GT_TRACE(gt, "\n");
 
@@ -202,6 +202,15 @@ int intel_gt_resume(struct intel_gt *gt)
        intel_uncore_forcewake_get(gt->uncore, FORCEWAKE_ALL);
        intel_rc6_sanitize(&gt->rc6);
 
+       /* Only when the HW is re-initialised, can we replay the requests */
+       err = intel_gt_init_hw(gt);
+       if (err) {
+               dev_err(gt->i915->drm.dev,
+                       "Failed to initialize GPU, declaring it wedged!\n");
+               intel_gt_set_wedged(gt);
+               goto err_fw;
+       }
+
        intel_rps_enable(&gt->rps);
        intel_llc_enable(&gt->llc);
 
@@ -234,6 +243,7 @@ int intel_gt_resume(struct intel_gt *gt)
 
        user_forcewake(gt, false);
 
+err_fw:
        intel_uncore_forcewake_put(gt->uncore, FORCEWAKE_ALL);
        intel_gt_pm_put(gt);