Skip to contentSkip to conversation

Ring frequency & Rpe changes for SKL

PATCH Superseded [email protected] 3 participants 11 messages Jun 19, 2015 – Jun 28, 2015

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Ring frequency & Rpe changes for SKL

From: Akash Goel <[email protected]>

This patch series adds the changes for supporting the Ring frequency table programming and retrieving the efficient frequency (aka RPe) value from the pcode for SKL.
Addressed review comments from Ville, Daniel & added r-b tag from Rodrigo on the 3 patches

Akash Goel (6):
drm/i915/skl: Retrieve the Rpe value from Pcode drm/i915/skl: Ring frequency table programming changes drm/i915/skl: Restrict the ring frequency table programming to SKL drm/i915: Corrected the platform checks in i915_ring_freq_table
function
drm/i915/skl: Updated the i915_ring_freq_table debugfs function drm/i915: Added BXT check in i915_ring_freq_table function

 drivers/gpu/drm/i915/i915_debugfs.c | 22 +++++++++++++----
 drivers/gpu/drm/i915/intel_pm.c     | 47 ++++++++++++++++++++++++++-----------
 2 files changed, 50 insertions(+), 19 deletions(-)
Signature · 6 lines
1.9.2

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

PATCH v2 1/6 drm/i915/skl: Retrieve the Rpe value from Pcode

From: Akash Goel <[email protected]>

Read the efficient frequency (aka RPe) value through the the mailbox command (0x1A) from the pcode, as done on Haswell and Broadwell. The turbo minimum frequency softlimit is not revised as per the efficient frequency value.

v2: Replaced the conditional expression operator with 'if' statement (Tom)
v3: Corrected the derivation of efficient frequency & shifted the
GEN9_FREQ_SCALER multiplications downwards (Ville)

Issue: VIZ-5143

---
 drivers/gpu/drm/i915/intel_pm.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +11 -8
index 32ff034..8185a23 100644
@@ -4295,18 +4295,11 @@ static void gen6_init_rps_frequencies(struct drm_device *dev)
 	dev_priv->rps.rp0_freq		= (rp_state_cap >>  0) & 0xff;
 	dev_priv->rps.rp1_freq		= (rp_state_cap >>  8) & 0xff;
 	dev_priv->rps.min_freq		= (rp_state_cap >> 16) & 0xff;
-	if (IS_SKYLAKE(dev)) {
-		/* Store the frequency values in 16.66 MHZ units, which is
-		   the natural hardware unit for SKL */
-		dev_priv->rps.rp0_freq *= GEN9_FREQ_SCALER;
-		dev_priv->rps.rp1_freq *= GEN9_FREQ_SCALER;
-		dev_priv->rps.min_freq *= GEN9_FREQ_SCALER;
-	}
 	/* hw_max = RP0 until we check for overclocking */
 	dev_priv->rps.max_freq		= dev_priv->rps.rp0_freq;
 
 	dev_priv->rps.efficient_freq = dev_priv->rps.rp1_freq;
-	if (IS_HASWELL(dev) || IS_BROADWELL(dev)) {
+	if (IS_HASWELL(dev) || IS_BROADWELL(dev) || IS_SKYLAKE(dev)) {
 		ret = sandybridge_pcode_read(dev_priv,
 					HSW_PCODE_DYNAMIC_DUTY_CYCLE_CONTROL,
 					&ddcc_status);
@@ -4318,6 +4311,16 @@ static void gen6_init_rps_frequencies(struct drm_device *dev)
 					dev_priv->rps.max_freq);
 	}
 
+	if (IS_SKYLAKE(dev)) {
+		/* Store the frequency values in 16.66 MHZ units, which is
+		   the natural hardware unit for SKL */
+		dev_priv->rps.rp0_freq *= GEN9_FREQ_SCALER;
+		dev_priv->rps.rp1_freq *= GEN9_FREQ_SCALER;
+		dev_priv->rps.min_freq *= GEN9_FREQ_SCALER;
+		dev_priv->rps.max_freq *= GEN9_FREQ_SCALER;
+		dev_priv->rps.efficient_freq *= GEN9_FREQ_SCALER;
+	}
+
 	dev_priv->rps.idle_freq = dev_priv->rps.min_freq;
 
 	/* Preserve min/max settings in case of re-init */
Signature · 6 lines
1.9.2

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

PATCH v2 2/6 drm/i915/skl: Ring frequency table programming changes

In reply to [email protected]

From: Akash Goel <[email protected]>

Ring frequency table programming changes for SKL. No need for a floor on ring frequency, as the issue of performance impact with ring running below DDR frequency, is believed to be fixed on SKL

v2: Removed the check for avoiding ring frequency programming for BXT (Rodrigo)

Issue: VIZ-5144

---
 drivers/gpu/drm/i915/intel_pm.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +19 -4
index 8185a23..89c1b73 100644
@@ -4613,6 +4613,7 @@ static void __gen6_update_ring_freq(struct drm_device *dev)
 	int min_freq = 15;
 	unsigned int gpu_freq;
 	unsigned int max_ia_freq, min_ring_freq;
+	unsigned int max_gpu_freq, min_gpu_freq;
 	int scaling_factor = 180;
 	struct cpufreq_policy *policy;
 
@@ -4637,17 +4638,31 @@ static void __gen6_update_ring_freq(struct drm_device *dev)
 	/* convert DDR frequency from units of 266.6MHz to bandwidth */
 	min_ring_freq = mult_frac(min_ring_freq, 8, 3);
 
+	if (IS_SKYLAKE(dev)) {
+		/* Convert GT frequency to 50 HZ units */
+		min_gpu_freq = dev_priv->rps.min_freq / GEN9_FREQ_SCALER;
+		max_gpu_freq = dev_priv->rps.max_freq / GEN9_FREQ_SCALER;
+	} else {
+		min_gpu_freq = dev_priv->rps.min_freq;
+		max_gpu_freq = dev_priv->rps.max_freq;
+	}
+
 	/*
 	 * For each potential GPU frequency, load a ring frequency we'd like
 	 * to use for memory access.  We do this by specifying the IA frequency
 	 * the PCU should use as a reference to determine the ring frequency.
 	 */
-	for (gpu_freq = dev_priv->rps.max_freq; gpu_freq >= dev_priv->rps.min_freq;
-	     gpu_freq--) {
-		int diff = dev_priv->rps.max_freq - gpu_freq;
+	for (gpu_freq = max_gpu_freq; gpu_freq >= min_gpu_freq; gpu_freq--) {
+		int diff = max_gpu_freq - gpu_freq;
 		unsigned int ia_freq = 0, ring_freq = 0;
 
-		if (INTEL_INFO(dev)->gen >= 8) {
+		if (IS_SKYLAKE(dev)) {
+			/*
+			 * ring_freq = 2 * GT. ring_freq is in 100MHz units
+			 * No floor required for ring frequency on SKL.
+			 */
+			ring_freq = gpu_freq;
+		} else if (INTEL_INFO(dev)->gen >= 8) {
 			/* max(2 * GT, DDR). NB: GT is 50MHz units */
 			ring_freq = max(min_ring_freq, gpu_freq);
 		} else if (IS_HASWELL(dev)) {
Signature · 6 lines
1.9.2

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

PATCH v2 3/6 drm/i915/skl: Restrict the ring frequency table programming to SKL

In reply to [email protected]

From: Akash Goel <[email protected]>

Ring frequency table programming is not required on BXT. Added separate checks to enable the programming only for SKL & skip for BXT.

Issue: VIZ-5144

---
 drivers/gpu/drm/i915/intel_pm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +3 -2
index 89c1b73..31d2fa0 100644
@@ -4696,7 +4696,7 @@ void gen6_update_ring_freq(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (INTEL_INFO(dev)->gen < 6 || IS_VALLEYVIEW(dev))
+	if (INTEL_INFO(dev)->gen < 6 || IS_VALLEYVIEW(dev) || IS_BROXTON(dev))
 		return;
 
 	mutex_lock(&dev_priv->rps.hw_lock);
@@ -5811,7 +5811,8 @@ static void intel_gen6_powersave_work(struct work_struct *work)
 	} else if (INTEL_INFO(dev)->gen >= 9) {
 		gen9_enable_rc6(dev);
 		gen9_enable_rps(dev);
-		__gen6_update_ring_freq(dev);
+		if (IS_SKYLAKE(dev))
+			__gen6_update_ring_freq(dev);
 	} else if (IS_BROADWELL(dev)) {
 		gen8_enable_rps(dev);
 		__gen6_update_ring_freq(dev);
Signature · 6 lines
1.9.2

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

PATCH v2 4/6 drm/i915: Corrected the platform checks in i915_ring_freq_table function

In reply to [email protected]

From: Akash Goel <[email protected]>

Corrected the platform checks in i915_ring_freq_table debugfs function so as to allow the read of ring frequency table for BDW and disallow for VLV

v2: Simplified the checks to avoid the double negation (Daniel)

Issue: VIZ-5144

---
 drivers/gpu/drm/i915/i915_debugfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_debugfs.c +2 -1
index c49fe2a..438c10b 100644
@@ -1746,7 +1746,8 @@ static int i915_ring_freq_table(struct seq_file *m, void *unused)
 	int ret = 0;
 	int gpu_freq, ia_freq;
 
-	if (!(IS_GEN6(dev) || IS_GEN7(dev))) {
+	if (!(IS_GEN6(dev) || (IS_GEN7(dev) && !IS_VALLEYVIEW(dev)) ||
+	      IS_BROADWELL(dev))) {
 		seq_puts(m, "unsupported on this chipset\n");
 		return 0;
 	}
Signature · 6 lines
1.9.2

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

Re: [PATCH 4/6] drm/i915: Corrected the platform checks in i915_ring_freq_table function

Quoted 18 lines · On Fri, Jun 19, 2015 at 11:07:29PM +0530, [email protected] wrote:

From: Akash Goel <[email protected]>

Corrected the platform checks in i915_ring_freq_table debugfs function so as to allow the read of ring frequency table for BDW and disallow for VLV

v2: Simplified the checks to avoid the double negation (Daniel)

Issue: VIZ-5144

---
 drivers/gpu/drm/i915/i915_debugfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
index c49fe2a..438c10b 100644

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ring_freq_table(struct seq_file *m, void *unused) · line 1750

Quoted 6 lines
drivers/gpu/drm/i915/i915_debugfs.c +2 -1
@@ -1746,7 +1746,8 @@ static int i915_ring_freq_table(struct seq_file *m, void *unused)
 	int ret = 0;
 	int gpu_freq, ia_freq;
 
-	if (!(IS_GEN6(dev) || IS_GEN7(dev))) {
+	if (!(IS_GEN6(dev) || (IS_GEN7(dev) && !IS_VALLEYVIEW(dev)) ||
+	      IS_BROADWELL(dev))) {

Still complicated and also duplicated. What about a HAS_CORE_RING_FREQ() feature macro, maybe even as a bitmask somewhere? We have them for rps too, so lots of precendence.
-Daniel

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
 		seq_puts(m, "unsupported on this chipset\n");
 		return 0;
 	}
Signature · 6 lines
1.9.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#6 lore raw

Re: [PATCH 4/6] drm/i915: Corrected the platform checks in i915_ring_freq_table function

Quoted 22 lines · Daniel Vetter
Quoted 21 lines · On Fri, Jun 19, 2015 at 11:07:29PM +0530, [email protected] wrote:

From: Akash Goel <[email protected]>

Corrected the platform checks in i915_ring_freq_table debugfs function so as to allow the read of ring frequency table for BDW and disallow for VLV

v2: Simplified the checks to avoid the double negation (Daniel)

Issue: VIZ-5144

---
 drivers/gpu/drm/i915/i915_debugfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
index c49fe2a..438c10b 100644
@@ -1746,7 +1746,8 @@ static int i915_ring_freq_table(struct seq_file *m, void *unused)
 	int ret = 0;
 	int gpu_freq, ia_freq;
 
Quoted 8 lines

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ring_freq_table(struct seq_file *m, void *unused) · line 1750

Quoted 3 lines
drivers/gpu/drm/i915/i915_debugfs.c +2 -1
-	if (!(IS_GEN6(dev) || IS_GEN7(dev))) {
+	if (!(IS_GEN6(dev) || (IS_GEN7(dev) && !IS_VALLEYVIEW(dev)) ||
+	      IS_BROADWELL(dev))) {

Still complicated and also duplicated. What about a HAS_CORE_RING_FREQ() feature macro, maybe even as a bitmask somewhere? We have them for rps too, so lots of precendence.
-Daniel

Sincere apologies for this blooper. Messed up on my side & sent the old patch only (with the double negation)..
Will introduce the new macro, as you suggested.

Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
 		seq_puts(m, "unsupported on this chipset\n");
 		return 0;
 	}
Signature · 1 line
1.9.2
Quoted 5 lines
Quoted 4 lines

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

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

#7 lore raw

PATCH v2 5/6 drm/i915/skl: Updated the i915_ring_freq_table debugfs function

In reply to [email protected]

From: Akash Goel <[email protected]>

Updated the i915_ring_freq_table debugfs function to support the read of ring frequency table, through Punit interface, for SKL also.

Issue: VIZ-5144

---
 drivers/gpu/drm/i915/i915_debugfs.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +16 -6
index 438c10b..2666d8a 100644
@@ -1745,9 +1745,9 @@ static int i915_ring_freq_table(struct seq_file *m, void *unused)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int ret = 0;
 	int gpu_freq, ia_freq;
+	unsigned int max_gpu_freq, min_gpu_freq;
 
-	if (!(IS_GEN6(dev) || (IS_GEN7(dev) && !IS_VALLEYVIEW(dev)) ||
-	      IS_BROADWELL(dev))) {
+	if ((INTEL_INFO(dev)->gen < 6) || IS_VALLEYVIEW(dev)) {
 		seq_puts(m, "unsupported on this chipset\n");
 		return 0;
 	}
@@ -1760,17 +1760,27 @@ static int i915_ring_freq_table(struct seq_file *m, void *unused)
 	if (ret)
 		goto out;
 
+	if (IS_SKYLAKE(dev)) {
+		/* Convert GT frequency to 50 HZ units */
+		min_gpu_freq =
+			dev_priv->rps.min_freq_softlimit / GEN9_FREQ_SCALER;
+		max_gpu_freq =
+			dev_priv->rps.max_freq_softlimit / GEN9_FREQ_SCALER;
+	} else {
+		min_gpu_freq = dev_priv->rps.min_freq_softlimit;
+		max_gpu_freq = dev_priv->rps.max_freq_softlimit;
+	}
+
 	seq_puts(m, "GPU freq (MHz)\tEffective CPU freq (MHz)\tEffective Ring freq (MHz)\n");
 
-	for (gpu_freq = dev_priv->rps.min_freq_softlimit;
-	     gpu_freq <= dev_priv->rps.max_freq_softlimit;
-	     gpu_freq++) {
+	for (gpu_freq = min_gpu_freq; gpu_freq <= max_gpu_freq; gpu_freq++) {
 		ia_freq = gpu_freq;
 		sandybridge_pcode_read(dev_priv,
 				       GEN6_PCODE_READ_MIN_FREQ_TABLE,
 				       &ia_freq);
 		seq_printf(m, "%d\t\t%d\t\t\t\t%d\n",
-			   intel_gpu_freq(dev_priv, gpu_freq),
+			   intel_gpu_freq(dev_priv, (gpu_freq *
+				(IS_SKYLAKE(dev) ? GEN9_FREQ_SCALER : 1))),
 			   ((ia_freq >> 0) & 0xff) * 100,
 			   ((ia_freq >> 8) & 0xff) * 100);
 	}
Signature · 6 lines
1.9.2

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

PATCH v2 6/6 drm/i915: Added BXT check in i915_ring_freq_table function

In reply to [email protected]

From: Akash Goel <[email protected]>

Updated the i915_ring_freq_table debugfs function to add the broxton check, so as to disallow the read of ring frequency table for it.

Issue: VIZ-5144

---
 drivers/gpu/drm/i915/i915_debugfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_debugfs.c +2 -1
index 2666d8a..daf6bdc 100644
@@ -1747,7 +1747,8 @@ static int i915_ring_freq_table(struct seq_file *m, void *unused)
 	int gpu_freq, ia_freq;
 	unsigned int max_gpu_freq, min_gpu_freq;
 
-	if ((INTEL_INFO(dev)->gen < 6) || IS_VALLEYVIEW(dev)) {
+	if ((INTEL_INFO(dev)->gen < 6) || IS_VALLEYVIEW(dev) ||
+	    IS_BROXTON(dev)) {
 		seq_puts(m, "unsupported on this chipset\n");
 		return 0;
 	}
Signature · 6 lines
1.9.2

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

Re: [PATCH 6/6] drm/i915: Added BXT check in i915_ring_freq_table function

Quoted 17 lines · On Fri, Jun 19, 2015 at 11:07:31PM +0530, [email protected] wrote:

From: Akash Goel <[email protected]>

Updated the i915_ring_freq_table debugfs function to add the broxton check, so as to disallow the read of ring frequency table for it.

Issue: VIZ-5144

---
 drivers/gpu/drm/i915/i915_debugfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
index 2666d8a..daf6bdc 100644

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ring_freq_table(struct seq_file *m, void *unused) · line 1751

Quoted 6 lines
drivers/gpu/drm/i915/i915_debugfs.c +2 -1
@@ -1747,7 +1747,8 @@ static int i915_ring_freq_table(struct seq_file *m, void *unused)
 	int gpu_freq, ia_freq;
 	unsigned int max_gpu_freq, min_gpu_freq;
 
-	if ((INTEL_INFO(dev)->gen < 6) || IS_VALLEYVIEW(dev)) {
+	if ((INTEL_INFO(dev)->gen < 6) || IS_VALLEYVIEW(dev) ||
+	    IS_BROXTON(dev)) {

Yup, imo add a HAS_FOO feature macro here over all the place in one patch, then do 1 patch to fix things up to exclude bxt everywhere. Lots of different patches with lots of different checks makes reviewing this properly unecesarily hard imo.
-Daniel

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
 		seq_puts(m, "unsupported on this chipset\n");
 		return 0;
 	}
Signature · 6 lines
1.9.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tested-by on v2 6/6
#10 lore raw

Re: [PATCH 6/6] drm/i915: Added BXT check in i915_ring_freq_table function

In reply to [email protected]

Task id: 6578 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied

ILK                                  303/303              303/303
SNB                                  312/312              312/312
IVB                                  343/343              343/343
BYT                                  284/284              284/284
HSW                                  380/380              380/380

-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx