Skip to contentSkip to conversation

drm/i915: VLV rps stuff

PATCH In review [email protected] 3 participants 19 messages Jun 25, 2013 – Jul 2, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover drm/i915: VLV rps stuff

Here's a bunch of stuff for VLV rps code.

My initial goal was to just get rid of the spurious Punit freq override messages, but I ended up improving performance by accident as well.

IIRC Jesse was a bit scared of eliminating GEN6_RP_INTERRUPT_LIMITS, but so far I haven't seen any ill effects from it.

#1 lore raw

PATCH 1/6 drm/i915: Clean up VLV rps code a bit

From: Ville Syrjälä <[email protected]>

Always print both the MHz value and raw register value for rps stuff.

Also kill a somewhat pointless local 'rpe' variable and just use dev_priv->rps.rpe_delay.

While at it clean up the caps in "GPU" and "Punit" debug messages.

---
 drivers/gpu/drm/i915/intel_pm.c | 50 ++++++++++++++++++++++++-----------------
 1 file changed, 30 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +30 -20
index 3705203..48a3162 100644
@@ -3077,10 +3077,11 @@ void valleyview_set_rps(struct drm_device *dev, u8 val)
 	WARN_ON(val > dev_priv->rps.max_delay);
 	WARN_ON(val < dev_priv->rps.min_delay);
 
-	DRM_DEBUG_DRIVER("gpu freq request from %d to %d\n",
+	DRM_DEBUG_DRIVER("GPU freq request from %d MHz (%u) to %d MHz (%u)\n",
 			 vlv_gpu_freq(dev_priv->mem_freq,
 				      dev_priv->rps.cur_delay),
-			 vlv_gpu_freq(dev_priv->mem_freq, val));
+			 dev_priv->rps.cur_delay,
+			 vlv_gpu_freq(dev_priv->mem_freq, val), val);
 
 	if (val == dev_priv->rps.cur_delay)
 		return;
@@ -3098,8 +3099,9 @@ void valleyview_set_rps(struct drm_device *dev, u8 val)
 
 	pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
 	if ((pval >> 8) != val)
-		DRM_DEBUG_DRIVER("punit overrode freq: %d requested, but got %d\n",
-			  val, pval >> 8);
+		DRM_DEBUG_DRIVER("Punit overrode GPU freq: %d MHz (%u) requested, but got %d Mhz (%u)\n",
+				 vlv_gpu_freq(dev_priv->mem_freq, val), val,
+				 vlv_gpu_freq(dev_priv->mem_freq, pval >> 8), pval >> 8);
 
 	/* Make sure we continue to get interrupts
 	 * until we hit the minimum or maximum frequencies.
@@ -3493,7 +3495,7 @@ static void valleyview_enable_rps(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_ring_buffer *ring;
-	u32 gtfifodbg, val, rpe;
+	u32 gtfifodbg, val;
 	int i;
 
 	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
@@ -3554,31 +3556,39 @@ static void valleyview_enable_rps(struct drm_device *dev)
 	DRM_DEBUG_DRIVER("GPLL enabled? %s\n", val & 0x10 ? "yes" : "no");
 	DRM_DEBUG_DRIVER("GPU status: 0x%08x\n", val);
 
-	DRM_DEBUG_DRIVER("current GPU freq: %d\n",
-			 vlv_gpu_freq(dev_priv->mem_freq, (val >> 8) & 0xff));
 	dev_priv->rps.cur_delay = (val >> 8) & 0xff;
+	DRM_DEBUG_DRIVER("current GPU freq: %d MHz (%u)\n",
+			 vlv_gpu_freq(dev_priv->mem_freq,
+				      dev_priv->rps.cur_delay),
+			 dev_priv->rps.cur_delay);
 
 	dev_priv->rps.max_delay = valleyview_rps_max_freq(dev_priv);
 	dev_priv->rps.hw_max = dev_priv->rps.max_delay;
-	DRM_DEBUG_DRIVER("max GPU freq: %d\n", vlv_gpu_freq(dev_priv->mem_freq,
-						     dev_priv->rps.max_delay));
+	DRM_DEBUG_DRIVER("max GPU freq: %d MHz (%u)\n",
+			 vlv_gpu_freq(dev_priv->mem_freq,
+				      dev_priv->rps.max_delay),
+			 dev_priv->rps.max_delay);
 
-	rpe = valleyview_rps_rpe_freq(dev_priv);
-	DRM_DEBUG_DRIVER("RPe GPU freq: %d\n",
-			 vlv_gpu_freq(dev_priv->mem_freq, rpe));
-	dev_priv->rps.rpe_delay = rpe;
+	dev_priv->rps.rpe_delay = valleyview_rps_rpe_freq(dev_priv);
+	DRM_DEBUG_DRIVER("RPe GPU freq: %d MHz (%u)\n",
+			 vlv_gpu_freq(dev_priv->mem_freq,
+				      dev_priv->rps.rpe_delay),
+			 dev_priv->rps.rpe_delay);
 
-	val = valleyview_rps_min_freq(dev_priv);
-	DRM_DEBUG_DRIVER("min GPU freq: %d\n", vlv_gpu_freq(dev_priv->mem_freq,
-							    val));
-	dev_priv->rps.min_delay = val;
+	dev_priv->rps.min_delay = valleyview_rps_min_freq(dev_priv);
+	DRM_DEBUG_DRIVER("min GPU freq: %d MHz (%u)\n",
+			 vlv_gpu_freq(dev_priv->mem_freq,
+				      dev_priv->rps.min_delay),
+			 dev_priv->rps.min_delay);
 
-	DRM_DEBUG_DRIVER("setting GPU freq to %d\n",
-			 vlv_gpu_freq(dev_priv->mem_freq, rpe));
+	DRM_DEBUG_DRIVER("setting GPU freq to %d MHz (%u)\n",
+			 vlv_gpu_freq(dev_priv->mem_freq,
+				      dev_priv->rps.rpe_delay),
+			 dev_priv->rps.rpe_delay);
 
 	INIT_DELAYED_WORK(&dev_priv->rps.vlv_work, vlv_rps_timer_work);
 
-	valleyview_set_rps(dev_priv->dev, rpe);
+	valleyview_set_rps(dev_priv->dev, dev_priv->rps.rpe_delay);
 
 	/* requires MSI enabled */
 	I915_WRITE(GEN6_PMIER, GEN6_PM_RPS_EVENTS);
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/6
#2 lore raw

Re: [PATCH 1/6] drm/i915: Clean up VLV rps code a bit

Quoted 98 lines · On Tue, 25 Jun 2013 19:21:01 +0300 [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Always print both the MHz value and raw register value for rps stuff.

Also kill a somewhat pointless local 'rpe' variable and just use dev_priv->rps.rpe_delay.

While at it clean up the caps in "GPU" and "Punit" debug messages.

---
 drivers/gpu/drm/i915/intel_pm.c | 50 ++++++++++++++++++++++++-----------------
 1 file changed, 30 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +27 -19
index 3705203..48a3162 100644
@@ -3077,10 +3077,11 @@ void valleyview_set_rps(struct drm_device *dev, u8 val)
 	WARN_ON(val > dev_priv->rps.max_delay);
 	WARN_ON(val < dev_priv->rps.min_delay);
 
-	DRM_DEBUG_DRIVER("gpu freq request from %d to %d\n",
+	DRM_DEBUG_DRIVER("GPU freq request from %d MHz (%u) to %d MHz (%u)\n",
 			 vlv_gpu_freq(dev_priv->mem_freq,
 				      dev_priv->rps.cur_delay),
-			 vlv_gpu_freq(dev_priv->mem_freq, val));
+			 dev_priv->rps.cur_delay,
+			 vlv_gpu_freq(dev_priv->mem_freq, val), val);
 
 	if (val == dev_priv->rps.cur_delay)
 		return;
@@ -3098,8 +3099,9 @@ void valleyview_set_rps(struct drm_device *dev, u8 val)
 
 	pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
 	if ((pval >> 8) != val)
-		DRM_DEBUG_DRIVER("punit overrode freq: %d requested, but got %d\n",
-			  val, pval >> 8);
+		DRM_DEBUG_DRIVER("Punit overrode GPU freq: %d MHz (%u) requested, but got %d Mhz (%u)\n",
+				 vlv_gpu_freq(dev_priv->mem_freq, val), val,
+				 vlv_gpu_freq(dev_priv->mem_freq, pval >> 8), pval >> 8);
 
 	/* Make sure we continue to get interrupts
 	 * until we hit the minimum or maximum frequencies.
@@ -3493,7 +3495,7 @@ static void valleyview_enable_rps(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_ring_buffer *ring;
-	u32 gtfifodbg, val, rpe;
+	u32 gtfifodbg, val;
 	int i;
 
 	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
@@ -3554,31 +3556,39 @@ static void valleyview_enable_rps(struct drm_device *dev)
 	DRM_DEBUG_DRIVER("GPLL enabled? %s\n", val & 0x10 ? "yes" : "no");
 	DRM_DEBUG_DRIVER("GPU status: 0x%08x\n", val);
 
-	DRM_DEBUG_DRIVER("current GPU freq: %d\n",
-			 vlv_gpu_freq(dev_priv->mem_freq, (val >> 8) & 0xff));
 	dev_priv->rps.cur_delay = (val >> 8) & 0xff;
+	DRM_DEBUG_DRIVER("current GPU freq: %d MHz (%u)\n",
+			 vlv_gpu_freq(dev_priv->mem_freq,
+				      dev_priv->rps.cur_delay),
+			 dev_priv->rps.cur_delay);
 
 	dev_priv->rps.max_delay = valleyview_rps_max_freq(dev_priv);
 	dev_priv->rps.hw_max = dev_priv->rps.max_delay;
-	DRM_DEBUG_DRIVER("max GPU freq: %d\n", vlv_gpu_freq(dev_priv->mem_freq,
-						     dev_priv->rps.max_delay));
+	DRM_DEBUG_DRIVER("max GPU freq: %d MHz (%u)\n",
+			 vlv_gpu_freq(dev_priv->mem_freq,
+				      dev_priv->rps.max_delay),
+			 dev_priv->rps.max_delay);
 
-	rpe = valleyview_rps_rpe_freq(dev_priv);
-	DRM_DEBUG_DRIVER("RPe GPU freq: %d\n",
-			 vlv_gpu_freq(dev_priv->mem_freq, rpe));
-	dev_priv->rps.rpe_delay = rpe;
+	dev_priv->rps.rpe_delay = valleyview_rps_rpe_freq(dev_priv);
+	DRM_DEBUG_DRIVER("RPe GPU freq: %d MHz (%u)\n",
+			 vlv_gpu_freq(dev_priv->mem_freq,
+				      dev_priv->rps.rpe_delay),
+			 dev_priv->rps.rpe_delay);
 
-	val = valleyview_rps_min_freq(dev_priv);
-	DRM_DEBUG_DRIVER("min GPU freq: %d\n", vlv_gpu_freq(dev_priv->mem_freq,
-							    val));
-	dev_priv->rps.min_delay = val;
+	dev_priv->rps.min_delay = valleyview_rps_min_freq(dev_priv);
+	DRM_DEBUG_DRIVER("min GPU freq: %d MHz (%u)\n",
+			 vlv_gpu_freq(dev_priv->mem_freq,
+				      dev_priv->rps.min_delay),
+			 dev_priv->rps.min_delay);
 
-	DRM_DEBUG_DRIVER("setting GPU freq to %d\n",
-			 vlv_gpu_freq(dev_priv->mem_freq, rpe));
+	DRM_DEBUG_DRIVER("setting GPU freq to %d MHz (%u)\n",
+			 vlv_gpu_freq(dev_priv->mem_freq,

drivers/gpu/drm/i915/intel_pm.c static void valleyview_enable_rps(struct drm_device *dev) · line 3594

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +3 -1
+				      dev_priv->rps.rpe_delay),
+			 dev_priv->rps.rpe_delay);
 
 	INIT_DELAYED_WORK(&dev_priv->rps.vlv_work, vlv_rps_timer_work);
 
-	valleyview_set_rps(dev_priv->dev, rpe);
+	valleyview_set_rps(dev_priv->dev, dev_priv->rps.rpe_delay);
 
 	/* requires MSI enabled */
 	I915_WRITE(GEN6_PMIER, GEN6_PM_RPS_EVENTS);
Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

PATCH 2/6 drm/i915: Don't wait for Punit after each freq change on VLV

In reply to [email protected]

From: Ville Syrjälä <[email protected]>

It seems that even though Punit reports the frequency change to have been completed, it still reports the old frequency in the status register for some time.

So rather than polling for Punit to complete the frequency change after each request, poll before. This gets rid of the spurious "Punit overrode GPU freq" messages.

This also lets us continue working while Punit is performing the actual frequency change. As a result, openarena demo088-test1 timedemo average fps is increased by ~5 fps, and the slowest frame duration is reduced by ~25%.

The sysfs cur_freq file always reads the current frequency from Punit anyway, so having rps.cur_delay be slightly off at times doesn't matter.

---
 drivers/gpu/drm/i915/intel_pm.c | 53 +++++++++++++++++++++++++++--------------
 1 file changed, 35 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +35 -18
index 48a3162..6dbcad7 100644
@@ -3066,17 +3066,49 @@ void gen6_set_rps(struct drm_device *dev, u8 val)
 	trace_intel_gpu_freq_change(val * 50);
 }
 
+/*
+ * Wait until the previous freq change has completed,
+ * or the timeout elapsed, and then update our notion
+ * of the current GPU frequency.
+ */
+static void vlv_update_rps_cur_delay(struct drm_i915_private *dev_priv)
+{
+	unsigned long timeout = jiffies + msecs_to_jiffies(10);
+	u32 pval;
+
+	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
+
+	do {
+		pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
+		if (time_after(jiffies, timeout)) {
+			DRM_DEBUG_DRIVER("timed out waiting for Punit\n");
+			break;
+		}
+		udelay(10);
+	} while (pval & 1);
+
+	pval >>= 8;
+
+	if (pval != dev_priv->rps.cur_delay)
+		DRM_DEBUG_DRIVER("Punit overrode GPU freq: %d MHz (%u) requested, but got %d Mhz (%u)\n",
+				 vlv_gpu_freq(dev_priv->mem_freq, dev_priv->rps.cur_delay),
+				 dev_priv->rps.cur_delay,
+				 vlv_gpu_freq(dev_priv->mem_freq, pval), pval);
+
+	dev_priv->rps.cur_delay = pval;
+}
+
 void valleyview_set_rps(struct drm_device *dev, u8 val)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	unsigned long timeout = jiffies + msecs_to_jiffies(10);
 	u32 limits = gen6_rps_limits(dev_priv, &val);
-	u32 pval;
 
 	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
 	WARN_ON(val > dev_priv->rps.max_delay);
 	WARN_ON(val < dev_priv->rps.min_delay);
 
+	vlv_update_rps_cur_delay(dev_priv);
+
 	DRM_DEBUG_DRIVER("GPU freq request from %d MHz (%u) to %d MHz (%u)\n",
 			 vlv_gpu_freq(dev_priv->mem_freq,
 				      dev_priv->rps.cur_delay),
@@ -3088,27 +3120,12 @@ void valleyview_set_rps(struct drm_device *dev, u8 val)
 
 	vlv_punit_write(dev_priv, PUNIT_REG_GPU_FREQ_REQ, val);
 
-	do {
-		pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
-		if (time_after(jiffies, timeout)) {
-			DRM_DEBUG_DRIVER("timed out waiting for Punit\n");
-			break;
-		}
-		udelay(10);
-	} while (pval & 1);
-
-	pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
-	if ((pval >> 8) != val)
-		DRM_DEBUG_DRIVER("Punit overrode GPU freq: %d MHz (%u) requested, but got %d Mhz (%u)\n",
-				 vlv_gpu_freq(dev_priv->mem_freq, val), val,
-				 vlv_gpu_freq(dev_priv->mem_freq, pval >> 8), pval >> 8);
-
 	/* Make sure we continue to get interrupts
 	 * until we hit the minimum or maximum frequencies.
 	 */
 	I915_WRITE(GEN6_RP_INTERRUPT_LIMITS, limits);
 
-	dev_priv->rps.cur_delay = pval >> 8;
+	dev_priv->rps.cur_delay = val;
 
 	trace_intel_gpu_freq_change(vlv_gpu_freq(dev_priv->mem_freq, val));
 }
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 2/6
#4 lore raw

Re: [PATCH 2/6] drm/i915: Don't wait for Punit after each freq change on VLV

Quoted 98 lines · On Tue, 25 Jun 2013 19:21:02 +0300 [email protected] wrote:

From: Ville Syrjälä <[email protected]>

It seems that even though Punit reports the frequency change to have been completed, it still reports the old frequency in the status register for some time.

So rather than polling for Punit to complete the frequency change after each request, poll before. This gets rid of the spurious "Punit overrode GPU freq" messages.

This also lets us continue working while Punit is performing the actual frequency change. As a result, openarena demo088-test1 timedemo average fps is increased by ~5 fps, and the slowest frame duration is reduced by ~25%.

The sysfs cur_freq file always reads the current frequency from Punit anyway, so having rps.cur_delay be slightly off at times doesn't matter.

---
 drivers/gpu/drm/i915/intel_pm.c | 53 +++++++++++++++++++++++++++--------------
 1 file changed, 35 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +34 -17
index 48a3162..6dbcad7 100644
@@ -3066,17 +3066,49 @@ void gen6_set_rps(struct drm_device *dev, u8 val)
 	trace_intel_gpu_freq_change(val * 50);
 }
 
+/*
+ * Wait until the previous freq change has completed,
+ * or the timeout elapsed, and then update our notion
+ * of the current GPU frequency.
+ */
+static void vlv_update_rps_cur_delay(struct drm_i915_private *dev_priv)
+{
+	unsigned long timeout = jiffies + msecs_to_jiffies(10);
+	u32 pval;
+
+	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
+
+	do {
+		pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
+		if (time_after(jiffies, timeout)) {
+			DRM_DEBUG_DRIVER("timed out waiting for Punit\n");
+			break;
+		}
+		udelay(10);
+	} while (pval & 1);
+
+	pval >>= 8;
+
+	if (pval != dev_priv->rps.cur_delay)
+		DRM_DEBUG_DRIVER("Punit overrode GPU freq: %d MHz (%u) requested, but got %d Mhz (%u)\n",
+				 vlv_gpu_freq(dev_priv->mem_freq, dev_priv->rps.cur_delay),
+				 dev_priv->rps.cur_delay,
+				 vlv_gpu_freq(dev_priv->mem_freq, pval), pval);
+
+	dev_priv->rps.cur_delay = pval;
+}
+
 void valleyview_set_rps(struct drm_device *dev, u8 val)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	unsigned long timeout = jiffies + msecs_to_jiffies(10);
 	u32 limits = gen6_rps_limits(dev_priv, &val);
-	u32 pval;
 
 	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
 	WARN_ON(val > dev_priv->rps.max_delay);
 	WARN_ON(val < dev_priv->rps.min_delay);
 
+	vlv_update_rps_cur_delay(dev_priv);
+
 	DRM_DEBUG_DRIVER("GPU freq request from %d MHz (%u) to %d MHz (%u)\n",
 			 vlv_gpu_freq(dev_priv->mem_freq,
 				      dev_priv->rps.cur_delay),
@@ -3088,27 +3120,12 @@ void valleyview_set_rps(struct drm_device *dev, u8 val)
 
 	vlv_punit_write(dev_priv, PUNIT_REG_GPU_FREQ_REQ, val);
 
-	do {
-		pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
-		if (time_after(jiffies, timeout)) {
-			DRM_DEBUG_DRIVER("timed out waiting for Punit\n");
-			break;
-		}
-		udelay(10);
-	} while (pval & 1);
-
-	pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
-	if ((pval >> 8) != val)
-		DRM_DEBUG_DRIVER("Punit overrode GPU freq: %d MHz (%u) requested, but got %d Mhz (%u)\n",
-				 vlv_gpu_freq(dev_priv->mem_freq, val), val,
-				 vlv_gpu_freq(dev_priv->mem_freq, pval >> 8), pval >> 8);
-

drivers/gpu/drm/i915/intel_pm.c void valleyview_set_rps(struct drm_device *dev, u8 val) · line 3131

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +1 -1
 	/* Make sure we continue to get interrupts
 	 * until we hit the minimum or maximum frequencies.
 	 */
 	I915_WRITE(GEN6_RP_INTERRUPT_LIMITS, limits);
 
-	dev_priv->rps.cur_delay = pval >> 8;
+	dev_priv->rps.cur_delay = val;
 
 	trace_intel_gpu_freq_change(vlv_gpu_freq(dev_priv->mem_freq, val));
 }

Hiding some of the Punit latency is nice...

Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

PATCH 3/6 drm/i915: Optimize the VLV Punit wait a bit

In reply to [email protected]

From: Ville Syrjälä <[email protected]>

Don't do needless udelay() calls if the Punit already completed the frequency change.

Also double check things after the timeout to make sure the timeout wasn't just caused by some scheduling delays.

---
 drivers/gpu/drm/i915/intel_pm.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +10 -4
index 6dbcad7..6b98d45 100644
@@ -3078,14 +3078,20 @@ static void vlv_update_rps_cur_delay(struct drm_i915_private *dev_priv)
 
 	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
 
-	do {
-		pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
+	pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
+
+	while (pval & 1) {
 		if (time_after(jiffies, timeout)) {
-			DRM_DEBUG_DRIVER("timed out waiting for Punit\n");
+			pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
 			break;
 		}
+
 		udelay(10);
-	} while (pval & 1);
+		pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
+	}
+
+	if (pval & 1)
+		DRM_DEBUG_DRIVER("timed out waiting for Punit\n");
 
 	pval >>= 8;
 
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 3/6
#6 lore raw

Re: [PATCH 3/6] drm/i915: Optimize the VLV Punit wait a bit

Quoted 32 lines · On Tue, 25 Jun 2013 19:21:03 +0300 [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Don't do needless udelay() calls if the Punit already completed the frequency change.

Also double check things after the timeout to make sure the timeout wasn't just caused by some scheduling delays.

---
 drivers/gpu/drm/i915/intel_pm.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +5 -3
index 6dbcad7..6b98d45 100644
@@ -3078,14 +3078,20 @@ static void vlv_update_rps_cur_delay(struct drm_i915_private *dev_priv)
 
 	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
 
-	do {
-		pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
+	pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
+
+	while (pval & 1) {
 		if (time_after(jiffies, timeout)) {
-			DRM_DEBUG_DRIVER("timed out waiting for Punit\n");
+			pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
 			break;
 		}
+

drivers/gpu/drm/i915/intel_pm.c static void vlv_update_rps_cur_delay(struct drm_i915_private *dev_priv) · line 3097

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +5 -1
 		udelay(10);
-	} while (pval & 1);
+		pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
+	}
+
+	if (pval & 1)
+		DRM_DEBUG_DRIVER("timed out waiting for Punit\n");
 
 	pval >>= 8;
 
Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

Re: [PATCH 3/6] drm/i915: Optimize the VLV Punit wait a bit

In reply to [email protected]
Quoted 29 lines · On Tue, Jun 25, 2013 at 07:21:03PM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Don't do needless udelay() calls if the Punit already completed the frequency change.

Also double check things after the timeout to make sure the timeout wasn't just caused by some scheduling delays.

---
 drivers/gpu/drm/i915/intel_pm.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +4 -3
index 6dbcad7..6b98d45 100644
@@ -3078,14 +3078,20 @@ static void vlv_update_rps_cur_delay(struct drm_i915_private *dev_priv)
 
 	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
 
-	do {
-		pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
+	pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
+
+	while (pval & 1) {
 		if (time_after(jiffies, timeout)) {
-			DRM_DEBUG_DRIVER("timed out waiting for Punit\n");
+			pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);

drivers/gpu/drm/i915/intel_pm.c static void vlv_update_rps_cur_delay(struct drm_i915_private *dev_priv) · line 3094

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +6 -1
 			break;
 		}
+
 		udelay(10);
-	} while (pval & 1);
+		pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
+	}
+
+	if (pval & 1)
+		DRM_DEBUG_DRIVER("timed out waiting for Punit\n");

Since we notoriously get these suckers wrong and this check isn't really in the critical path any more (the punit should have complete the last change already) and furthermore in a work item: Can we just use one of our bog-standard wait_for macros here now?
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#8 lore raw

PATCH 1/1 drm/i915: Use wait_for() to wait for Punit to change GPU freq on VLV

From: Ville Syrjälä <[email protected]>

Use wait_for() instead of the open coded loop to avoid spreading the same old timeout related bugs.

This changes the loop to use msleep(1) instead of udelay(10) when the Punit had not yet completed the frequency change. In practice that doesn't seem to hurt performance as the Punit appears to be ready pretty much always.

Also give the status bit a name, instead of using the magic number 1.

---
 drivers/gpu/drm/i915/i915_reg.h |  1 +
 drivers/gpu/drm/i915/intel_pm.c | 11 ++---------
 2 files changed, 3 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 10ac3d5..d5199a3 100644
@@ -363,6 +363,7 @@
 #define PUNIT_REG_GPU_LFM			0xd3
 #define PUNIT_REG_GPU_FREQ_REQ			0xd4
 #define PUNIT_REG_GPU_FREQ_STS			0xd8
+#define   GENFREQSTATUS				(1<<0)
 #define PUNIT_REG_MEDIA_TURBO_FREQ_REQ		0xdc
 
 #define PUNIT_FUSE_BUS2				0xf6 /* bits 47:40 */
drivers/gpu/drm/i915/intel_pm.c +2 -9
index aa48fc6..bff5709 100644
@@ -3074,19 +3074,12 @@ void gen6_set_rps(struct drm_device *dev, u8 val)
  */
 static void vlv_update_rps_cur_delay(struct drm_i915_private *dev_priv)
 {
-	unsigned long timeout = jiffies + msecs_to_jiffies(10);
 	u32 pval;
 
 	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
 
-	do {
-		pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
-		if (time_after(jiffies, timeout)) {
-			DRM_DEBUG_DRIVER("timed out waiting for Punit\n");
-			break;
-		}
-		udelay(10);
-	} while (pval & 1);
+	if (wait_for(((pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS)) & GENFREQSTATUS) == 0, 10))
+		DRM_DEBUG_DRIVER("timed out waiting for Punit\n");
 
 	pval >>= 8;
 
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#9 lore raw

Re: [PATCH] drm/i915: Use wait_for() to wait for Punit to change GPU freq on VLV

Quoted 46 lines · On Wed, 26 Jun 2013 17:43:24 +0300 [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Use wait_for() instead of the open coded loop to avoid spreading the same old timeout related bugs.

This changes the loop to use msleep(1) instead of udelay(10) when the Punit had not yet completed the frequency change. In practice that doesn't seem to hurt performance as the Punit appears to be ready pretty much always.

Also give the status bit a name, instead of using the magic number 1.

---
 drivers/gpu/drm/i915/i915_reg.h |  1 +
 drivers/gpu/drm/i915/intel_pm.c | 11 ++---------
 2 files changed, 3 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 10ac3d5..d5199a3 100644
@@ -363,6 +363,7 @@
 #define PUNIT_REG_GPU_LFM			0xd3
 #define PUNIT_REG_GPU_FREQ_REQ			0xd4
 #define PUNIT_REG_GPU_FREQ_STS			0xd8
+#define   GENFREQSTATUS				(1<<0)
 #define PUNIT_REG_MEDIA_TURBO_FREQ_REQ		0xdc
 
 #define PUNIT_FUSE_BUS2				0xf6 /* bits 47:40 */
drivers/gpu/drm/i915/intel_pm.c +0 -4
index aa48fc6..bff5709 100644
@@ -3074,19 +3074,12 @@ void gen6_set_rps(struct drm_device *dev, u8 val)
  */
 static void vlv_update_rps_cur_delay(struct drm_i915_private *dev_priv)
 {
-	unsigned long timeout = jiffies + msecs_to_jiffies(10);
 	u32 pval;
 
 	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
 
-	do {
-		pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
-		if (time_after(jiffies, timeout)) {

drivers/gpu/drm/i915/intel_pm.c void gen6_set_rps(struct drm_device *dev, u8 val) · line 3085

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +2 -5
-			DRM_DEBUG_DRIVER("timed out waiting for Punit\n");
-			break;
-		}
-		udelay(10);
-	} while (pval & 1);
+	if (wait_for(((pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS)) & GENFREQSTATUS) == 0, 10))
+		DRM_DEBUG_DRIVER("timed out waiting for Punit\n");
 
 	pval >>= 8;
 
Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

Re: [PATCH] drm/i915: Use wait_for() to wait for Punit to change GPU freq on VLV

Quoted 57 lines · Jesse Barnes
Quoted 54 lines · On Wed, 26 Jun 2013 17:43:24 +0300 [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Use wait_for() instead of the open coded loop to avoid spreading the same old timeout related bugs.

This changes the loop to use msleep(1) instead of udelay(10) when the Punit had not yet completed the frequency change. In practice that doesn't seem to hurt performance as the Punit appears to be ready pretty much always.

Also give the status bit a name, instead of using the magic number 1.

---
 drivers/gpu/drm/i915/i915_reg.h |  1 +
 drivers/gpu/drm/i915/intel_pm.c | 11 ++---------
 2 files changed, 3 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 10ac3d5..d5199a3 100644
@@ -363,6 +363,7 @@
 #define PUNIT_REG_GPU_LFM			0xd3
 #define PUNIT_REG_GPU_FREQ_REQ			0xd4
 #define PUNIT_REG_GPU_FREQ_STS			0xd8
+#define   GENFREQSTATUS				(1<<0)
 #define PUNIT_REG_MEDIA_TURBO_FREQ_REQ		0xdc
 
 #define PUNIT_FUSE_BUS2				0xf6 /* bits 47:40 */
drivers/gpu/drm/i915/intel_pm.c +2 -9
index aa48fc6..bff5709 100644
@@ -3074,19 +3074,12 @@ void gen6_set_rps(struct drm_device *dev, u8 val)
  */
 static void vlv_update_rps_cur_delay(struct drm_i915_private *dev_priv)
 {
-	unsigned long timeout = jiffies + msecs_to_jiffies(10);
 	u32 pval;
 
 	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
 
-	do {
-		pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
-		if (time_after(jiffies, timeout)) {
-			DRM_DEBUG_DRIVER("timed out waiting for Punit\n");
-			break;
-		}
-		udelay(10);
-	} while (pval & 1);
+	if (wait_for(((pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS)) & GENFREQSTATUS) == 0, 10))
+		DRM_DEBUG_DRIVER("timed out waiting for Punit\n");
 
Quoted 4 lines

drivers/gpu/drm/i915/intel_pm.c void gen6_set_rps(struct drm_device *dev, u8 val) · line 3085

Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +0 -0
 	pval >>= 8;
 

Queued for -next, thanks for the patch.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#11 lore raw

Re: [PATCH] drm/i915: Use wait_for() to wait for Punit to change GPU freq on VLV

In reply to Jesse Barnes
Quoted 57 lines · Jesse Barnes
Quoted 54 lines · On Wed, 26 Jun 2013 17:43:24 +0300 [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Use wait_for() instead of the open coded loop to avoid spreading the same old timeout related bugs.

This changes the loop to use msleep(1) instead of udelay(10) when the Punit had not yet completed the frequency change. In practice that doesn't seem to hurt performance as the Punit appears to be ready pretty much always.

Also give the status bit a name, instead of using the magic number 1.

---
 drivers/gpu/drm/i915/i915_reg.h |  1 +
 drivers/gpu/drm/i915/intel_pm.c | 11 ++---------
 2 files changed, 3 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 10ac3d5..d5199a3 100644
@@ -363,6 +363,7 @@
 #define PUNIT_REG_GPU_LFM			0xd3
 #define PUNIT_REG_GPU_FREQ_REQ			0xd4
 #define PUNIT_REG_GPU_FREQ_STS			0xd8
+#define   GENFREQSTATUS				(1<<0)
 #define PUNIT_REG_MEDIA_TURBO_FREQ_REQ		0xdc
 
 #define PUNIT_FUSE_BUS2				0xf6 /* bits 47:40 */
drivers/gpu/drm/i915/intel_pm.c +2 -9
index aa48fc6..bff5709 100644
@@ -3074,19 +3074,12 @@ void gen6_set_rps(struct drm_device *dev, u8 val)
  */
 static void vlv_update_rps_cur_delay(struct drm_i915_private *dev_priv)
 {
-	unsigned long timeout = jiffies + msecs_to_jiffies(10);
 	u32 pval;
 
 	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
 
-	do {
-		pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
-		if (time_after(jiffies, timeout)) {
-			DRM_DEBUG_DRIVER("timed out waiting for Punit\n");
-			break;
-		}
-		udelay(10);
-	} while (pval & 1);
+	if (wait_for(((pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS)) & GENFREQSTATUS) == 0, 10))
+		DRM_DEBUG_DRIVER("timed out waiting for Punit\n");
 
Quoted 4 lines

drivers/gpu/drm/i915/intel_pm.c void gen6_set_rps(struct drm_device *dev, u8 val) · line 3085

Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +0 -0
 	pval >>= 8;
 

Oops, missed that one here. Queued for -next, thanks for the patch. -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#12 lore raw

PATCH 4/6 drm/i915: Use msecs_to_jiffies_timeout when waiting for Punit freq change

In reply to [email protected]

From: Ville Syrjälä <[email protected]>

The timeout is 10 ms so it would end up as one jiffy when HZ=100, and one jiffy is quite susceptible to spurious timeouts as we've seen recently.

---
 drivers/gpu/drm/i915/intel_pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +1 -1
index 6b98d45..8b7475e 100644
@@ -3073,7 +3073,7 @@ void gen6_set_rps(struct drm_device *dev, u8 val)
  */
 static void vlv_update_rps_cur_delay(struct drm_i915_private *dev_priv)
 {
-	unsigned long timeout = jiffies + msecs_to_jiffies(10);
+	unsigned long timeout = jiffies + msecs_to_jiffies_timeout(10);
 	u32 pval;
 
 	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 4/6
#13 lore raw

Re: [PATCH 4/6] drm/i915: Use msecs_to_jiffies_timeout when waiting for Punit freq change

Quoted 16 lines · On Tue, 25 Jun 2013 19:21:04 +0300 [email protected] wrote:

From: Ville Syrjälä <[email protected]>

The timeout is 10 ms so it would end up as one jiffy when HZ=100, and one jiffy is quite susceptible to spurious timeouts as we've seen recently.

---
 drivers/gpu/drm/i915/intel_pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +0 -0
index 6b98d45..8b7475e 100644

drivers/gpu/drm/i915/intel_pm.c void gen6_set_rps(struct drm_device *dev, u8 val) · line 3079

Quoted 8 lines
drivers/gpu/drm/i915/intel_pm.c +1 -1
@@ -3073,7 +3073,7 @@ void gen6_set_rps(struct drm_device *dev, u8 val)
  */
 static void vlv_update_rps_cur_delay(struct drm_i915_private *dev_priv)
 {
-	unsigned long timeout = jiffies + msecs_to_jiffies(10);
+	unsigned long timeout = jiffies + msecs_to_jiffies_timeout(10);
 	u32 pval;
 
 	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

PATCH 5/6 drm/i915: Make the rps new_delay comparison more readable

In reply to [email protected]

From: Ville Syrjälä <[email protected]>

Eliminate the weird inverted logic from the rps new_delay comparison.

---
 drivers/gpu/drm/i915/i915_irq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +2 -2
index 611da3a..62f8b2d 100644
@@ -707,8 +707,8 @@ static void gen6_pm_rps_work(struct work_struct *work)
 	/* sysfs frequency interfaces may have snuck in while servicing the
 	 * interrupt
 	 */
-	if (!(new_delay > dev_priv->rps.max_delay ||
-	      new_delay < dev_priv->rps.min_delay)) {
+	if (new_delay >= dev_priv->rps.min_delay &&
+	    new_delay <= dev_priv->rps.max_delay) {
 		if (IS_VALLEYVIEW(dev_priv->dev))
 			valleyview_set_rps(dev_priv->dev, new_delay);
 		else
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 5/6
#15 lore raw

Re: [PATCH 5/6] drm/i915: Make the rps new_delay comparison more readable

Quoted 14 lines · On Tue, 25 Jun 2013 19:21:05 +0300 [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Eliminate the weird inverted logic from the rps new_delay comparison.

---
 drivers/gpu/drm/i915/i915_irq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 611da3a..62f8b2d 100644

drivers/gpu/drm/i915/i915_irq.c static void gen6_pm_rps_work(struct work_struct *work) · line 714

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +2 -2
@@ -707,8 +707,8 @@ static void gen6_pm_rps_work(struct work_struct *work)
 	/* sysfs frequency interfaces may have snuck in while servicing the
 	 * interrupt
 	 */
-	if (!(new_delay > dev_priv->rps.max_delay ||
-	      new_delay < dev_priv->rps.min_delay)) {
+	if (new_delay >= dev_priv->rps.min_delay &&
+	    new_delay <= dev_priv->rps.max_delay) {
 		if (IS_VALLEYVIEW(dev_priv->dev))
 			valleyview_set_rps(dev_priv->dev, new_delay);
 		else
Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#16 lore raw

PATCH 6/6 drm/i915: GEN6_RP_INTERRUPT_LIMITS doesn't seem to exist on VLV

In reply to [email protected]

From: Ville Syrjälä <[email protected]>

I can't find GEN6_RP_INTERRUPT_LIMITS (0xA014) anywhere in VLV docs. Reading it always returns zero from what I can tell, and eliminating it doesn't seem to make any difference to the behaviour of the system.

---
 drivers/gpu/drm/i915/intel_pm.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +2 -6
index 8b7475e..96cfb3e 100644
@@ -3107,7 +3107,8 @@ static void vlv_update_rps_cur_delay(struct drm_i915_private *dev_priv)
 void valleyview_set_rps(struct drm_device *dev, u8 val)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	u32 limits = gen6_rps_limits(dev_priv, &val);
+
+	gen6_rps_limits(dev_priv, &val);
 
 	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
 	WARN_ON(val > dev_priv->rps.max_delay);
@@ -3126,11 +3127,6 @@ void valleyview_set_rps(struct drm_device *dev, u8 val)
 
 	vlv_punit_write(dev_priv, PUNIT_REG_GPU_FREQ_REQ, val);
 
-	/* Make sure we continue to get interrupts
-	 * until we hit the minimum or maximum frequencies.
-	 */
-	I915_WRITE(GEN6_RP_INTERRUPT_LIMITS, limits);
-
 	dev_priv->rps.cur_delay = val;
 
 	trace_intel_gpu_freq_change(vlv_gpu_freq(dev_priv->mem_freq, val));
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#17 lore raw

Re: [PATCH 6/6] drm/i915: GEN6_RP_INTERRUPT_LIMITS doesn't seem to exist on VLV

Quoted 27 lines · On Tue, 25 Jun 2013 19:21:06 +0300 [email protected] wrote:

From: Ville Syrjälä <[email protected]>

I can't find GEN6_RP_INTERRUPT_LIMITS (0xA014) anywhere in VLV docs. Reading it always returns zero from what I can tell, and eliminating it doesn't seem to make any difference to the behaviour of the system.

---
 drivers/gpu/drm/i915/intel_pm.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +2 -1
index 8b7475e..96cfb3e 100644
@@ -3107,7 +3107,8 @@ static void vlv_update_rps_cur_delay(struct drm_i915_private *dev_priv)
 void valleyview_set_rps(struct drm_device *dev, u8 val)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	u32 limits = gen6_rps_limits(dev_priv, &val);
+
+	gen6_rps_limits(dev_priv, &val);
 
 	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
 	WARN_ON(val > dev_priv->rps.max_delay);
@@ -3126,11 +3127,6 @@ void valleyview_set_rps(struct drm_device *dev, u8 val)
 

drivers/gpu/drm/i915/intel_pm.c void valleyview_set_rps(struct drm_device *dev, u8 val) · line 3132

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +0 -5
 	vlv_punit_write(dev_priv, PUNIT_REG_GPU_FREQ_REQ, val);
 
-	/* Make sure we continue to get interrupts
-	 * until we hit the minimum or maximum frequencies.
-	 */
-	I915_WRITE(GEN6_RP_INTERRUPT_LIMITS, limits);
-
 	dev_priv->rps.cur_delay = val;
 
 	trace_intel_gpu_freq_change(vlv_gpu_freq(dev_priv->mem_freq, val));

I don't see it anymore either... so Reviewed-by: Jesse Barnes <[email protected]>

Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#18 lore raw

Re: [PATCH 6/6] drm/i915: GEN6_RP_INTERRUPT_LIMITS doesn't seem to exist on VLV

Quoted 39 lines · Jesse Barnes
Quoted 36 lines · On Tue, 25 Jun 2013 19:21:06 +0300 [email protected] wrote:

From: Ville Syrjälä <[email protected]>

I can't find GEN6_RP_INTERRUPT_LIMITS (0xA014) anywhere in VLV docs. Reading it always returns zero from what I can tell, and eliminating it doesn't seem to make any difference to the behaviour of the system.

---
 drivers/gpu/drm/i915/intel_pm.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +2 -6
index 8b7475e..96cfb3e 100644
@@ -3107,7 +3107,8 @@ static void vlv_update_rps_cur_delay(struct drm_i915_private *dev_priv)
 void valleyview_set_rps(struct drm_device *dev, u8 val)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	u32 limits = gen6_rps_limits(dev_priv, &val);
+
+	gen6_rps_limits(dev_priv, &val);
 
 	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
 	WARN_ON(val > dev_priv->rps.max_delay);
@@ -3126,11 +3127,6 @@ void valleyview_set_rps(struct drm_device *dev, u8 val)
 
 	vlv_punit_write(dev_priv, PUNIT_REG_GPU_FREQ_REQ, val);
 
-	/* Make sure we continue to get interrupts
-	 * until we hit the minimum or maximum frequencies.
-	 */
-	I915_WRITE(GEN6_RP_INTERRUPT_LIMITS, limits);
-
 	dev_priv->rps.cur_delay = val;
 
Quoted 4 lines

drivers/gpu/drm/i915/intel_pm.c void valleyview_set_rps(struct drm_device *dev, u8 val) · line 3132

Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +0 -0
 	trace_intel_gpu_freq_change(vlv_gpu_freq(dev_priv->mem_freq, val));

I don't see it anymore either... so Reviewed-by: Jesse Barnes <[email protected]>

Thanks for patches and review, all but 4&5 merged to dinq. Like mentioned in my other mail I'd vote to replace the logic in patches 4&5 with a simple wait_for if it doesn't hurt performance.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch