[Intel-gfx] [PATCH 2/8] drm/i915: Guard rc6 helpers with is_intel_rpm_allowed

tilak.tangudu at intel.com tilak.tangudu at intel.com
Thu Jul 21 09:59:49 UTC 2022


From: Tilak Tangudu <tilak.tangudu at intel.com>

Guard intel_rc6_sanitize/intel_rc6_enable/intel_rc6_disable
rc6 helpers with is_intel_rpm_allowed as these
are called in intel_gt_resume/intel_gt_suspend_late.

Signed-off-by: Tilak Tangudu <tilak.tangudu at intel.com>
---
 drivers/gpu/drm/i915/gt/intel_rc6.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_rc6.c b/drivers/gpu/drm/i915/gt/intel_rc6.c
index f8d0523f4c18..73e2fb9420a2 100644
--- a/drivers/gpu/drm/i915/gt/intel_rc6.c
+++ b/drivers/gpu/drm/i915/gt/intel_rc6.c
@@ -507,9 +507,14 @@ static bool rc6_supported(struct intel_rc6 *rc6)
 
 static void rpm_get(struct intel_rc6 *rc6)
 {
+	struct drm_i915_private *i915 = rc6_to_i915(rc6);
+
 	GEM_BUG_ON(rc6->wakeref);
-	pm_runtime_get_sync(rc6_to_i915(rc6)->drm.dev);
-	rc6->wakeref = true;
+
+	if (is_intel_rpm_allowed(&i915->runtime_pm)) {
+		pm_runtime_get_sync(i915->drm.dev);
+		rc6->wakeref = true;
+	}
 }
 
 static void rpm_put(struct intel_rc6 *rc6)
@@ -623,7 +628,9 @@ void intel_rc6_enable(struct intel_rc6 *rc6)
 		return;
 
 	/* rc6 is ready, runtime-pm is go! */
-	rpm_put(rc6);
+	if (rc6->wakeref)
+		rpm_put(rc6);
+
 	rc6->enabled = true;
 }
 
-- 
2.25.1



More information about the Intel-gfx mailing list