[PATCH 03/11] drm/i915: Avoid rpm helpers in intel_gt_suspend_late

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Removed rpm helpers from intel_gt_suspend_late
and added rpm helpers at below high level functions
-__intel_gt_disable
-live_gt_resume

intel_gt_suspend_late is used in i915_gem_suspend_late
and i915_gem_suspend_late need to avoid rpm helpers
so added rpm helpers at higher level functions
-i915_gem_driver_remove
-i915_drm_suspend_late(already holds rpm wakeref)
-do_suspend (already holds rpm wakeref)

Removed rpm helpers from intel_uc_suspend and
acquired rpm wakref from above high functions.

Signed-off-by: Tilak Tangudu <tilak.tangudu@xxxxxxxxx>
---
 drivers/gpu/drm/i915/gt/intel_gt.c       |  4 +++-
 drivers/gpu/drm/i915/gt/intel_gt_pm.c    | 11 ++++-------
 drivers/gpu/drm/i915/gt/selftest_gt_pm.c |  4 +++-
 drivers/gpu/drm/i915/gt/uc/intel_uc.c    |  9 +++------
 drivers/gpu/drm/i915/i915_gem.c          |  5 ++++-
 5 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
index be9877c4b496..bb04ec32c54f 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt.c
@@ -590,10 +590,12 @@ static int __engines_verify_workarounds(struct intel_gt *gt)
 
 static void __intel_gt_disable(struct intel_gt *gt)
 {
+	intel_wakeref_t wakeref = 0;
 	intel_gt_set_wedged_on_fini(gt);
 
 	intel_gt_suspend_prepare(gt);
-	intel_gt_suspend_late(gt);
+	with_intel_runtime_pm(gt->uncore->rpm, wakeref)
+		intel_gt_suspend_late(gt);
 
 	GEM_BUG_ON(intel_gt_pm_is_awake(gt));
 }
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.c b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
index f553e2173bda..be99b01a0984 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_pm.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
@@ -326,8 +326,6 @@ static suspend_state_t pm_suspend_target(void)
 
 void intel_gt_suspend_late(struct intel_gt *gt)
 {
-	intel_wakeref_t wakeref;
-
 	/* We expect to be idle already; but also want to be independent */
 	wait_for_suspend(gt);
 
@@ -352,11 +350,10 @@ void intel_gt_suspend_late(struct intel_gt *gt)
 	if (pm_suspend_target() == PM_SUSPEND_TO_IDLE)
 		return;
 
-	with_intel_runtime_pm(gt->uncore->rpm, wakeref) {
-		intel_rps_disable(&gt->rps);
-		intel_rc6_disable(&gt->rc6);
-		intel_llc_disable(&gt->llc);
-	}
+	intel_rps_disable(&gt->rps);
+	intel_rc6_disable(&gt->rc6);
+	intel_llc_disable(&gt->llc);
+
 
 	gt_sanitize(gt, false);
 
diff --git a/drivers/gpu/drm/i915/gt/selftest_gt_pm.c b/drivers/gpu/drm/i915/gt/selftest_gt_pm.c
index be94f863bdef..50f30a5295c4 100644
--- a/drivers/gpu/drm/i915/gt/selftest_gt_pm.c
+++ b/drivers/gpu/drm/i915/gt/selftest_gt_pm.c
@@ -142,13 +142,15 @@ static int live_gt_clocks(void *arg)
 static int live_gt_resume(void *arg)
 {
 	struct intel_gt *gt = arg;
+	intel_wakeref_t wakeref = 0;
 	IGT_TIMEOUT(end_time);
 	int err;
 
 	/* Do several suspend/resume cycles to check we don't explode! */
 	do {
 		intel_gt_suspend_prepare(gt);
-		intel_gt_suspend_late(gt);
+		with_intel_runtime_pm(gt->uncore->rpm, wakeref)
+			intel_gt_suspend_late(gt);
 
 		if (gt->rc6.enabled) {
 			pr_err("rc6 still enabled after suspend!\n");
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc.c b/drivers/gpu/drm/i915/gt/uc/intel_uc.c
index f2e7c82985ef..425ad2ef1644 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_uc.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_uc.c
@@ -652,17 +652,14 @@ void intel_uc_runtime_suspend(struct intel_uc *uc)
 void intel_uc_suspend(struct intel_uc *uc)
 {
 	struct intel_guc *guc = &uc->guc;
-	intel_wakeref_t wakeref;
 	int err;
 
 	if (!intel_guc_is_ready(guc))
 		return;
 
-	with_intel_runtime_pm(&uc_to_gt(uc)->i915->runtime_pm, wakeref) {
-		err = intel_guc_suspend(guc);
-		if (err)
-			DRM_DEBUG_DRIVER("Failed to suspend GuC, err=%d", err);
-	}
+	err = intel_guc_suspend(guc);
+	if (err)
+		DRM_DEBUG_DRIVER("Failed to suspend GuC, err=%d", err);
 }
 
 static int __uc_resume(struct intel_uc *uc, bool enable_communication)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 702e5b89be22..bbe1dac2341c 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1173,9 +1173,12 @@ void i915_gem_driver_unregister(struct drm_i915_private *i915)
 
 void i915_gem_driver_remove(struct drm_i915_private *dev_priv)
 {
+	intel_wakeref_t wakeref;
+
 	intel_wakeref_auto_fini(&to_gt(dev_priv)->ggtt->userfault_wakeref);
 
-	i915_gem_suspend_late(dev_priv);
+	with_intel_runtime_pm(&dev_priv->runtime_pm, wakeref)
+		i915_gem_suspend_late(dev_priv);
 	intel_gt_driver_remove(to_gt(dev_priv));
 	dev_priv->uabi_engines = RB_ROOT;
 
-- 
2.25.1




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux