diff mbox series

[RFC,14/28] drm/i915: Move intel_engines_resume into common init

Message ID 20190613133539.12620-15-tvrtko.ursulin@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series Implicit dev_priv removal and GT compartmentalization | expand

Commit Message

Tvrtko Ursulin June 13, 2019, 1:35 p.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Since this part still operates on i915 and not intel_gt, move it to the
common (top-level) function.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

Comments

Chris Wilson June 13, 2019, 2:01 p.m. UTC | #1
Quoting Tvrtko Ursulin (2019-06-13 14:35:25)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Since this part still operates on i915 and not intel_gt, move it to the
> common (top-level) function.

Whilst I do agree with the splitting, I will note that
intel_engines_resume() operates within gt :) You just haven't moved the
engine list over to intel_gt yet :)

> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

It's an improvement, just leaves me wanting more
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index b6f450e782e7..77d9d092b2f4 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1290,17 +1290,10 @@  static int init_hw(struct intel_gt *gt)
 
 	intel_mocs_init_l3cc_table(gt);
 
-	/* Only when the HW is re-initialised, can we replay the requests */
-	ret = intel_engines_resume(i915);
-	if (ret)
-		goto cleanup_uc;
-
 	intel_uncore_forcewake_put(uncore, FORCEWAKE_ALL);
 
 	return 0;
 
-cleanup_uc:
-	intel_uc_fini_hw(i915);
 out:
 	intel_uncore_forcewake_put(uncore, FORCEWAKE_ALL);
 
@@ -1309,6 +1302,7 @@  static int init_hw(struct intel_gt *gt)
 
 int i915_gem_init_hw(struct drm_i915_private *i915)
 {
+	struct intel_uncore *uncore = &i915->uncore;
 	int ret;
 
 	BUG_ON(!i915->kernel_context);
@@ -1316,7 +1310,28 @@  int i915_gem_init_hw(struct drm_i915_private *i915)
 	if (ret)
 		return ret;
 
+	/* Double layer security blanket, see i915_gem_init() */
+	intel_uncore_forcewake_get(uncore, FORCEWAKE_ALL);
+
 	ret = init_hw(&i915->gt);
+	if (ret)
+		goto err_init;
+
+	/* Only when the HW is re-initialised, can we replay the requests */
+	ret = intel_engines_resume(i915);
+	if (ret)
+		goto err_engines;
+
+	intel_uncore_forcewake_put(uncore, FORCEWAKE_ALL);
+
+	intel_engines_set_scheduler_caps(i915);
+
+	return 0;
+
+err_engines:
+	intel_uc_fini_hw(i915);
+err_init:
+	intel_uncore_forcewake_put(uncore, FORCEWAKE_ALL);
 
 	intel_engines_set_scheduler_caps(i915);