[Intel-gfx] [PATCH 10/11] drm/i915: Guard rpm helpers at gt_park/unpark

Tilak Tangudu tilak.tangudu at intel.com
Tue Jun 21 12:35:15 UTC 2022


Guard rpm helpers at gt_park/unpark with is_intel_rpm_allowed
to guard (gt/engine)_pm_(get/put)

Signed-off-by: Tilak Tangudu <tilak.tangudu at intel.com>
---
 drivers/gpu/drm/i915/gt/intel_engine_cs.c |  9 ++++++---
 drivers/gpu/drm/i915/gt/intel_gt_pm.c     | 10 ++++++----
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
index 136cc44c3deb..e353aa0c649b 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
@@ -1600,9 +1600,12 @@ bool intel_engines_are_idle(struct intel_gt *gt)
 	if (intel_gt_is_wedged(gt))
 		return true;
 
-	/* Already parked (and passed an idleness test); must still be idle */
-	if (!READ_ONCE(gt->awake))
-		return true;
+	/* Ignore gt->awake when rpm is not allowed as wakeref is not held at gt_unpark */
+	if (is_intel_rpm_allowed(gt->uncore->rpm)) {
+		/* Already parked (and passed an idleness test); must still be idle */
+		if (!READ_ONCE(gt->awake))
+			return true;
+	}
 
 	for_each_engine(engine, gt, id) {
 		if (!intel_engine_is_idle(engine))
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.c b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
index 9857b91194b7..12117cf7eb94 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_pm.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
@@ -81,8 +81,10 @@ static int __gt_unpark(struct intel_wakeref *wf)
 	 * Work around it by grabbing a GT IRQ power domain whilst there is any
 	 * GT activity, preventing any DC state transitions.
 	 */
-	gt->awake = intel_display_power_get(i915, POWER_DOMAIN_GT_IRQ);
-	GEM_BUG_ON(!gt->awake);
+	if (is_intel_rpm_allowed(gt->uncore->rpm)) {
+		gt->awake = intel_display_power_get(i915, POWER_DOMAIN_GT_IRQ);
+		GEM_BUG_ON(!gt->awake);
+	}
 
 	intel_rc6_unpark(&gt->rc6);
 	intel_rps_unpark(&gt->rps);
@@ -116,8 +118,8 @@ static int __gt_park(struct intel_wakeref *wf)
 	intel_synchronize_irq(i915);
 
 	/* Defer dropping the display power well for 100ms, it's slow! */
-	GEM_BUG_ON(!wakeref);
-	intel_display_power_put_async(i915, POWER_DOMAIN_GT_IRQ, wakeref);
+	if (wakeref)
+		intel_display_power_put_async(i915, POWER_DOMAIN_GT_IRQ, wakeref);
 
 	return 0;
 }
-- 
2.25.1



More information about the Intel-gfx mailing list