Skip to contentSkip to conversation

drm/i915/gt: Update PMINTRMSK holding fw

PATCH New Prasad Nallani 1 participant 2 messages May 20, 2020 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 2/54 drm/i915/gt: Update PMINTRMSK holding fw

From: Chris Wilson <[email protected]>

If we use a non-forcewaked write to PMINTRMSK, it does not take effect until much later, if at all, causing a loss of RPS interrupts and no GPU reclocking, leaving the GPU running at the wrong frequency for long periods of time.

Fixes 35cc7f32c298 ("drm/i915/gt: Use non-forcewake writes for RPS")
Cc Francisco Jerez <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Andi Shyti <[email protected]>
Cc <[email protected]> # v5.6+
(cherry picked from commit a080bd994c4023042a2b605c65fa10a25933f636)
---
 drivers/gpu/drm/i915/gt/intel_rps.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gt/intel_rps.c +4 -2
index c1a3d360de06..6beaa2b4e8f7 100644
@@ -85,7 +85,8 @@ static void rps_enable_interrupts(struct intel_rps *rps)
 	gen6_gt_pm_enable_irq(gt, rps->pm_events);
 	spin_unlock_irq(&gt->irq_lock);
 
-	set(gt->uncore, GEN6_PMINTRMSK, rps_pm_mask(rps, rps->cur_freq));
+	intel_uncore_write(gt->uncore,
+			   GEN6_PMINTRMSK, rps_pm_mask(rps, rps->last_freq));
 }
 
 static void gen6_rps_reset_interrupts(struct intel_rps *rps)
@@ -119,7 +120,8 @@ static void rps_disable_interrupts(struct intel_rps *rps)
 
 	rps->pm_events = 0;
 
-	set(gt->uncore, GEN6_PMINTRMSK, rps_pm_sanitize_mask(rps, ~0u));
+	intel_uncore_write(gt->uncore,
+			   GEN6_PMINTRMSK, rps_pm_sanitize_mask(rps, ~0u));
 
 	spin_lock_irq(&gt->irq_lock);
 	gen6_gt_pm_disable_irq(gt, GEN6_PM_RPS_EVENTS);
#2 lore raw

PATCH 4/54 drm/i915/gt: Treat idling as a RPS downclock event

In reply to a message not in the archive

From: Chris Wilson <[email protected]>

If we park/unpark faster than we can respond to RPS events, we never will process a downclock event after expiring a waitboost, and thus we will forever restart the GPU at max clocks even if the workload switches and doesn't justify full power.

Fixes 3e7abf814193 ("drm/i915: Extract GT render power state management")
Cc Andi Shyti <[email protected]>
Cc Lyude Paul <[email protected]>
Cc <[email protected]> # v5.5+
(cherry picked from commit 21abf0bf168dffff1192e0f072af1dc74ae1ff0e)
---
 drivers/gpu/drm/i915/gt/intel_rps.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/gpu/drm/i915/gt/intel_rps.c +13 -0
index 6beaa2b4e8f7..32ccb4efb0d9 100644
@@ -768,6 +768,19 @@ void intel_rps_park(struct intel_rps *rps)
 	intel_uncore_forcewake_get(rps_to_uncore(rps), FORCEWAKE_MEDIA);
 	rps_set(rps, rps->idle_freq, false);
 	intel_uncore_forcewake_put(rps_to_uncore(rps), FORCEWAKE_MEDIA);
+
+	/*
+	 * Since we will try and restart from the previously requested
+	 * frequency on unparking, treat this idle point as a downclock
+	 * interrupt and reduce the frequency for resume. If we park/unpark
+	 * more frequently than the rps worker can run, we will not respond
+	 * to any EI and never see a change in frequency.
+	 *
+	 * (Note we accommodate Cherryview's limitation of only using an
+	 * even bin by applying it to all.)
+	 */
+	rps->cur_freq =
+		max_t(int, round_down(rps->cur_freq - 1, 2), rps->min_freq);
 }
 
 void intel_rps_boost(struct i915_request *rq)