Skip to contentSkip to conversation

drm/i915: Additional CHV RPS fixes

PATCH In review [email protected] 4 participants 16 messages Nov 10, 2014 – Nov 17, 2014

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

cover drm/i915: Additional CHV RPS fixes

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

I was staring at the GPU frquencies my BSW reports and they didn't seem to match the docs exactly, so I set out to fix a few things. Now things should match what the docs. No idea if the docs are correct anymore though, but at least the date on the spreadsheet I used was fairly recent.

And I ended up doing a bit of refactoring on the way, so the LOC went down a bit, which is always nice :)

Ville Syrjälä (4):
drm/i915: Refactor vlv/chv GPU frequency divider setup drm/i915: Fix chv GPU freq<->opcode conversions drm/i915: Add missing newline to 'DDR speed' debug messages drm/i915: Change CHV SKU400 GPU freq divider to 10

 drivers/gpu/drm/i915/intel_pm.c | 109 ++++++++++++++--------------------------
 1 file changed, 38 insertions(+), 71 deletions(-)
Signature · 6 lines
2.0.4

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

PATCH 1/4 drm/i915: Refactor vlv/chv GPU frequency divider setup

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

The divider used in the GPU frequency calculations is compatible between vlv and chv. vlv just wants doubled values compared to chv.

---
 drivers/gpu/drm/i915/intel_pm.c | 104 ++++++++++++++--------------------------
 1 file changed, 35 insertions(+), 69 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +35 -69
index ef8e055..03fbb45 100644
@@ -7283,99 +7283,65 @@ int sandybridge_pcode_write(struct drm_i915_private *dev_priv, u8 mbox, u32 val)
 	return 0;
 }
 
-static int byt_gpu_freq(struct drm_i915_private *dev_priv, int val)
+static int vlv_gpu_freq_div(unsigned int czclk_freq)
 {
-	int div;
-
-	/* 4 x czclk */
-	switch (dev_priv->mem_freq) {
-	case 800:
-		div = 10;
-		break;
-	case 1066:
-		div = 12;
-		break;
-	case 1333:
-		div = 16;
-		break;
+	switch (czclk_freq) {
+	case 200:
+		return 10;
+	case 267:
+		return 12;
+	case 320:
+	case 333:
+	case 400:
+		return 16;
 	default:
 		return -1;
 	}
+}
 
-	return DIV_ROUND_CLOSEST(dev_priv->mem_freq * (val + 6 - 0xbd), 4 * div);
+static int byt_gpu_freq(struct drm_i915_private *dev_priv, int val)
+{
+	int div, czclk_freq = DIV_ROUND_CLOSEST(dev_priv->mem_freq, 4);
+
+	div = vlv_gpu_freq_div(czclk_freq);
+	if (div < 0)
+		return div;
+
+	return DIV_ROUND_CLOSEST(czclk_freq * (val + 6 - 0xbd), div);
 }
 
 static int byt_freq_opcode(struct drm_i915_private *dev_priv, int val)
 {
-	int mul;
+	int mul, czclk_freq = DIV_ROUND_CLOSEST(dev_priv->mem_freq, 4);
 
-	/* 4 x czclk */
-	switch (dev_priv->mem_freq) {
-	case 800:
-		mul = 10;
-		break;
-	case 1066:
-		mul = 12;
-		break;
-	case 1333:
-		mul = 16;
-		break;
-	default:
-		return -1;
-	}
+	mul = vlv_gpu_freq_div(czclk_freq);
+	if (mul < 0)
+		return mul;
 
-	return DIV_ROUND_CLOSEST(4 * mul * val, dev_priv->mem_freq) + 0xbd - 6;
+	return DIV_ROUND_CLOSEST(mul * val, czclk_freq) + 0xbd - 6;
 }
 
 static int chv_gpu_freq(struct drm_i915_private *dev_priv, int val)
 {
-	int div, freq;
-
-	switch (dev_priv->rps.cz_freq) {
-	case 200:
-		div = 5;
-		break;
-	case 267:
-		div = 6;
-		break;
-	case 320:
-	case 333:
-	case 400:
-		div = 8;
-		break;
-	default:
-		return -1;
-	}
+	int div, czclk_freq = dev_priv->rps.cz_freq;
 
-	freq = (DIV_ROUND_CLOSEST((dev_priv->rps.cz_freq * val), 2 * div) / 2);
+	div = vlv_gpu_freq_div(czclk_freq) / 2;
+	if (div < 0)
+		return div;
 
-	return freq;
+	return DIV_ROUND_CLOSEST(czclk_freq * val, 2 * div) / 2;
 }
 
 static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val)
 {
-	int mul, opcode;
+	int mul, czclk_freq = dev_priv->rps.cz_freq;
 
-	switch (dev_priv->rps.cz_freq) {
-	case 200:
-		mul = 5;
-		break;
-	case 267:
-		mul = 6;
-		break;
-	case 320:
-	case 333:
-	case 400:
-		mul = 8;
-		break;
-	default:
-		return -1;
-	}
+	mul = vlv_gpu_freq_div(czclk_freq) / 2;
+	if (mul < 0)
+		return mul;
 
 	/* CHV needs even values */
-	opcode = (DIV_ROUND_CLOSEST((val * 2 * mul), dev_priv->rps.cz_freq) * 2);
-
-	return opcode;
+	return DIV_ROUND_CLOSEST(val * 2 * mul, czclk_freq) * 2;
 }
 
 int vlv_gpu_freq(struct drm_i915_private *dev_priv, int val)
Signature · 6 lines
2.0.4

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

Re: [PATCH 1/4] drm/i915: Refactor vlv/chv GPU frequency divider setup

Quoted 139 lines · On Tuesday 11 November 2014 02:25 AM, [email protected] wrote:

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

The divider used in the GPU frequency calculations is compatible between vlv and chv. vlv just wants doubled values compared to chv.

---
  drivers/gpu/drm/i915/intel_pm.c | 104 ++++++++++++++--------------------------
  1 file changed, 35 insertions(+), 69 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +33 -66
index ef8e055..03fbb45 100644
@@ -7283,99 +7283,65 @@ int sandybridge_pcode_write(struct drm_i915_private *dev_priv, u8 mbox, u32 val)
  	return 0;
  }
 
-static int byt_gpu_freq(struct drm_i915_private *dev_priv, int val)
+static int vlv_gpu_freq_div(unsigned int czclk_freq)
  {
-	int div;
-
-	/* 4 x czclk */
-	switch (dev_priv->mem_freq) {
-	case 800:
-		div = 10;
-		break;
-	case 1066:
-		div = 12;
-		break;
-	case 1333:
-		div = 16;
-		break;
+	switch (czclk_freq) {
+	case 200:
+		return 10;
+	case 267:
+		return 12;
+	case 320:
+	case 333:
+	case 400:
+		return 16;
  	default:
  		return -1;
  	}
+}
 
-	return DIV_ROUND_CLOSEST(dev_priv->mem_freq * (val + 6 - 0xbd), 4 * div);
+static int byt_gpu_freq(struct drm_i915_private *dev_priv, int val)
+{
+	int div, czclk_freq = DIV_ROUND_CLOSEST(dev_priv->mem_freq, 4);
+
+	div = vlv_gpu_freq_div(czclk_freq);
+	if (div < 0)
+		return div;
+
+	return DIV_ROUND_CLOSEST(czclk_freq * (val + 6 - 0xbd), div);
  }
 
  static int byt_freq_opcode(struct drm_i915_private *dev_priv, int val)
  {
-	int mul;
+	int mul, czclk_freq = DIV_ROUND_CLOSEST(dev_priv->mem_freq, 4);
 
-	/* 4 x czclk */
-	switch (dev_priv->mem_freq) {
-	case 800:
-		mul = 10;
-		break;
-	case 1066:
-		mul = 12;
-		break;
-	case 1333:
-		mul = 16;
-		break;
-	default:
-		return -1;
-	}
+	mul = vlv_gpu_freq_div(czclk_freq);
+	if (mul < 0)
+		return mul;
 
-	return DIV_ROUND_CLOSEST(4 * mul * val, dev_priv->mem_freq) + 0xbd - 6;
+	return DIV_ROUND_CLOSEST(mul * val, czclk_freq) + 0xbd - 6;
  }
 
  static int chv_gpu_freq(struct drm_i915_private *dev_priv, int val)
  {
-	int div, freq;
-
-	switch (dev_priv->rps.cz_freq) {
-	case 200:
-		div = 5;
-		break;
-	case 267:
-		div = 6;
-		break;
-	case 320:
-	case 333:
-	case 400:
-		div = 8;
-		break;
-	default:
-		return -1;
-	}
+	int div, czclk_freq = dev_priv->rps.cz_freq;
 
-	freq = (DIV_ROUND_CLOSEST((dev_priv->rps.cz_freq * val), 2 * div) / 2);
+	div = vlv_gpu_freq_div(czclk_freq) / 2;
+	if (div < 0)
+		return div;
 
-	return freq;
+	return DIV_ROUND_CLOSEST(czclk_freq * val, 2 * div) / 2;
  }
 
  static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val)
  {
-	int mul, opcode;
+	int mul, czclk_freq = dev_priv->rps.cz_freq;
 
-	switch (dev_priv->rps.cz_freq) {
-	case 200:
-		mul = 5;
-		break;
-	case 267:
-		mul = 6;
-		break;
-	case 320:
-	case 333:
-	case 400:
-		mul = 8;
-		break;
-	default:
-		return -1;
-	}
+	mul = vlv_gpu_freq_div(czclk_freq) / 2;
+	if (mul < 0)

drivers/gpu/drm/i915/intel_pm.c int sandybridge_pcode_write(struct drm_i915_private *dev_priv, u8 mbox, u32 val) · line 7347

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +2 -3
+		return mul;
 
  	/* CHV needs even values */
-	opcode = (DIV_ROUND_CLOSEST((val * 2 * mul), dev_priv->rps.cz_freq) * 2);
-
-	return opcode;
+	return DIV_ROUND_CLOSEST(val * 2 * mul, czclk_freq) * 2;
  }
 
  int vlv_gpu_freq(struct drm_i915_private *dev_priv, int val)

Nice Looks fine.

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

#3 lore raw

PATCH 2/4 drm/i915: Fix chv GPU freq<->opcode conversions

In reply to [email protected]

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

Currently we miscalculate the GPU frequency on chv. This causes us to report the GPU frequency as half of what it really is. Drop the extra factor of 2 from the calculations to get the correct answer.

---
 drivers/gpu/drm/i915/intel_pm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +2 -2
index 03fbb45..74e4293 100644
@@ -7329,7 +7329,7 @@ static int chv_gpu_freq(struct drm_i915_private *dev_priv, int val)
 	if (div < 0)
 		return div;
 
-	return DIV_ROUND_CLOSEST(czclk_freq * val, 2 * div) / 2;
+	return DIV_ROUND_CLOSEST(czclk_freq * val, 2 * div);
 }
 
 static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val)
@@ -7341,7 +7341,7 @@ static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val)
 		return mul;
 
 	/* CHV needs even values */
-	return DIV_ROUND_CLOSEST(val * 2 * mul, czclk_freq) * 2;
+	return DIV_ROUND_CLOSEST(val * mul, czclk_freq) * 2;
 }
 
 int vlv_gpu_freq(struct drm_i915_private *dev_priv, int val)
Signature · 6 lines
2.0.4

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

Re: [PATCH 2/4] drm/i915: Fix chv GPU freq<->opcode conversions

Quoted 16 lines · On Tuesday 11 November 2014 02:25 AM, [email protected] wrote:

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

Currently we miscalculate the GPU frequency on chv. This causes us to report the GPU frequency as half of what it really is. Drop the extra factor of 2 from the calculations to get the correct answer.

---
  drivers/gpu/drm/i915/intel_pm.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +0 -0
index 03fbb45..74e4293 100644

drivers/gpu/drm/i915/intel_pm.c static int chv_gpu_freq(struct drm_i915_private *dev_priv, int val) · line 7332

Quoted 5 lines
drivers/gpu/drm/i915/intel_pm.c +1 -1
@@ -7329,7 +7329,7 @@ static int chv_gpu_freq(struct drm_i915_private *dev_priv, int val)
  	if (div < 0)
  		return div;
 
-	return DIV_ROUND_CLOSEST(czclk_freq * val, 2 * div) / 2;
+	return DIV_ROUND_CLOSEST(czclk_freq * val, 2 * div);

I think CHV is 2 X cck, shouldn't we report the cck freq and not 2 *cck?

drivers/gpu/drm/i915/intel_pm.c static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val) · line 7347

Quoted 12 lines
drivers/gpu/drm/i915/intel_pm.c +1 -1
  }
 
  static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val)
@@ -7341,7 +7341,7 @@ static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val)
  		return mul;
 
  	/* CHV needs even values */
-	return DIV_ROUND_CLOSEST(val * 2 * mul, czclk_freq) * 2;
+	return DIV_ROUND_CLOSEST(val * mul, czclk_freq) * 2;
  }
 
  int vlv_gpu_freq(struct drm_i915_private *dev_priv, int val)

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

#5 lore raw

Re: [PATCH 2/4] drm/i915: Fix chv GPU freq<->opcode conversions

Quoted 21 lines · Deepak S
Quoted 19 lines · On Tuesday 11 November 2014 02:25 AM, [email protected] wrote:

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

Currently we miscalculate the GPU frequency on chv. This causes us to report the GPU frequency as half of what it really is. Drop the extra factor of 2 from the calculations to get the correct answer.

---
  drivers/gpu/drm/i915/intel_pm.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +0 -0
index 03fbb45..74e4293 100644
@@ -7329,7 +7329,7 @@ static int chv_gpu_freq(struct drm_i915_private *dev_priv, int val)
  	if (div < 0)
  		return div;
 
Quoted 4 lines

drivers/gpu/drm/i915/intel_pm.c static int chv_gpu_freq(struct drm_i915_private *dev_priv, int val) · line 7332

Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +1 -1
-	return DIV_ROUND_CLOSEST(czclk_freq * val, 2 * div) / 2;
+	return DIV_ROUND_CLOSEST(czclk_freq * val, 2 * div);

I think CHV is 2 X cck, shouldn't we report the cck freq and not 2 *cck?

Hmm. Once again the docs are extremely unclear. Dropping the 2x factor gives me the same numbers that the tables in the docs have. But then the spreadsheet calls it a "2x clock" in some places, which does suggest it might get further divided down by 2.

Oh, now I did find a somewhat clear note in the clock HAS:
"The dedicated GPLL (Graphics PLL) sends a 2GHz gfx clock to GenLC, which gets divided inside the GenLC block to derive a 1GHz Gfx fast clock."

So based on that the original code does make more sense.

Quoted 18 lines

drivers/gpu/drm/i915/intel_pm.c static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val) · line 7347

Quoted 13 lines
drivers/gpu/drm/i915/intel_pm.c +1 -1
  }
 
  static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val)
@@ -7341,7 +7341,7 @@ static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val)
  		return mul;
 
  	/* CHV needs even values */
-	return DIV_ROUND_CLOSEST(val * 2 * mul, czclk_freq) * 2;
+	return DIV_ROUND_CLOSEST(val * mul, czclk_freq) * 2;
  }
 
  int vlv_gpu_freq(struct drm_i915_private *dev_priv, int val)

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

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

Re: [PATCH 2/4] drm/i915: Fix chv GPU freq<->opcode conversions

Quoted 29 lines · Ville Syrjälä
Quoted 20 lines · Deepak S
Quoted 19 lines · On Tuesday 11 November 2014 02:25 AM, [email protected] wrote:

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

Currently we miscalculate the GPU frequency on chv. This causes us to report the GPU frequency as half of what it really is. Drop the extra factor of 2 from the calculations to get the correct answer.

---
   drivers/gpu/drm/i915/intel_pm.c | 4 ++--
   1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +0 -0
index 03fbb45..74e4293 100644
@@ -7329,7 +7329,7 @@ static int chv_gpu_freq(struct drm_i915_private *dev_priv, int val)
   	if (div < 0)
   		return div;
 
Quoted 3 lines

drivers/gpu/drm/i915/intel_pm.c static int chv_gpu_freq(struct drm_i915_private *dev_priv, int val) · line 7332

Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +1 -1
-	return DIV_ROUND_CLOSEST(czclk_freq * val, 2 * div) / 2;
+	return DIV_ROUND_CLOSEST(czclk_freq * val, 2 * div);

I think CHV is 2 X cck, shouldn't we report the cck freq and not 2 *cck?

Hmm. Once again the docs are extremely unclear. Dropping the 2x factor gives me the same numbers that the tables in the docs have. But then the spreadsheet calls it a "2x clock" in some places, which does suggest it might get further divided down by 2.

Quoted 6 lines

Oh, now I did find a somewhat clear note in the clock HAS:
"The dedicated GPLL (Graphics PLL) sends a 2GHz gfx clock to GenLC, which gets divided inside the GenLC block to derive a 1GHz Gfx fast clock."

So based on that the original code does make more sense.

Do we need to mention in comment about 2 * GFX clock?

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/i915/intel_pm.c +1 -1
   }
 
   static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val)
@@ -7341,7 +7341,7 @@ static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val)
   		return mul;
 
   	/* CHV needs even values */
-	return DIV_ROUND_CLOSEST(val * 2 * mul, czclk_freq) * 2;
+	return DIV_ROUND_CLOSEST(val * mul, czclk_freq) * 2;
   }
 
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/i915/intel_pm.c static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val) · line 7347

Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +0 -0
   int vlv_gpu_freq(struct drm_i915_private *dev_priv, int val)

_______________________________________________
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

Re: [PATCH 2/4] drm/i915: Fix chv GPU freq<->opcode conversions

Quoted 31 lines · Deepak S
Quoted 29 lines · Ville Syrjälä
Quoted 20 lines · Deepak S
Quoted 19 lines · On Tuesday 11 November 2014 02:25 AM, [email protected] wrote:

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

Currently we miscalculate the GPU frequency on chv. This causes us to report the GPU frequency as half of what it really is. Drop the extra factor of 2 from the calculations to get the correct answer.

---
   drivers/gpu/drm/i915/intel_pm.c | 4 ++--
   1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +0 -0
index 03fbb45..74e4293 100644
@@ -7329,7 +7329,7 @@ static int chv_gpu_freq(struct drm_i915_private *dev_priv, int val)
   	if (div < 0)
   		return div;
 
Quoted 3 lines

drivers/gpu/drm/i915/intel_pm.c static int chv_gpu_freq(struct drm_i915_private *dev_priv, int val) · line 7332

Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +1 -1
-	return DIV_ROUND_CLOSEST(czclk_freq * val, 2 * div) / 2;
+	return DIV_ROUND_CLOSEST(czclk_freq * val, 2 * div);

I think CHV is 2 X cck, shouldn't we report the cck freq and not 2 *cck?

Hmm. Once again the docs are extremely unclear. Dropping the 2x factor gives me the same numbers that the tables in the docs have. But then the spreadsheet calls it a "2x clock" in some places, which does suggest it might get further divided down by 2.

Quoted 7 lines
Quoted 6 lines

Oh, now I did find a somewhat clear note in the clock HAS:
"The dedicated GPLL (Graphics PLL) sends a 2GHz gfx clock to GenLC, which gets divided inside the GenLC block to derive a 1GHz Gfx fast clock."

So based on that the original code does make more sense.

Do we need to mention in comment about 2 * GFX clock?

Yeah, a comment would probably be a good idea. Could avoid some confusion in the future if someone else looks at this code.

Quoted 23 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/i915/intel_pm.c +1 -1
   }
 
   static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val)
@@ -7341,7 +7341,7 @@ static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val)
   		return mul;
 
   	/* CHV needs even values */
-	return DIV_ROUND_CLOSEST(val * 2 * mul, czclk_freq) * 2;
+	return DIV_ROUND_CLOSEST(val * mul, czclk_freq) * 2;
   }
 
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/i915/intel_pm.c static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val) · line 7347

Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +0 -0
   int vlv_gpu_freq(struct drm_i915_private *dev_priv, int val)

_______________________________________________
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

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

Re: [PATCH 2/4] drm/i915: Fix chv GPU freq<->opcode conversions

Quoted 35 lines · Ville Syrjälä
Quoted 34 lines · Deepak S
Quoted 33 lines · Ville Syrjälä
Quoted 20 lines · Deepak S
Quoted 19 lines · On Tuesday 11 November 2014 02:25 AM, [email protected] wrote:

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

Currently we miscalculate the GPU frequency on chv. This causes us to report the GPU frequency as half of what it really is. Drop the extra factor of 2 from the calculations to get the correct answer.

---
    drivers/gpu/drm/i915/intel_pm.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +0 -0
index 03fbb45..74e4293 100644
@@ -7329,7 +7329,7 @@ static int chv_gpu_freq(struct drm_i915_private *dev_priv, int val)
    	if (div < 0)
    		return div;
 
Quoted 3 lines

drivers/gpu/drm/i915/intel_pm.c static int chv_gpu_freq(struct drm_i915_private *dev_priv, int val) · line 7332

Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +1 -1
-	return DIV_ROUND_CLOSEST(czclk_freq * val, 2 * div) / 2;
+	return DIV_ROUND_CLOSEST(czclk_freq * val, 2 * div);

I think CHV is 2 X cck, shouldn't we report the cck freq and not 2 *cck?

Hmm. Once again the docs are extremely unclear. Dropping the 2x factor gives me the same numbers that the tables in the docs have. But then the spreadsheet calls it a "2x clock" in some places, which does suggest it might get further divided down by 2.

Oh, now I did find a somewhat clear note in the clock HAS:
"The dedicated GPLL (Graphics PLL) sends a 2GHz gfx clock to GenLC, which gets divided inside the GenLC block to derive a 1GHz Gfx fast clock."

Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

So based on that the original code does make more sense.

Do we need to mention in comment about 2 * GFX clock?

Yeah, a comment would probably be a good idea. Could avoid some confusion in the future if someone else looks at this code.

Will you add the comment and submit a patch?

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines

drivers/gpu/drm/i915/intel_pm.c static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val) · line 7347

Quoted 13 lines
drivers/gpu/drm/i915/intel_pm.c +1 -1
    }
 
    static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val)
@@ -7341,7 +7341,7 @@ static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val)
    		return mul;
 
    	/* CHV needs even values */
-	return DIV_ROUND_CLOSEST(val * 2 * mul, czclk_freq) * 2;
+	return DIV_ROUND_CLOSEST(val * mul, czclk_freq) * 2;
    }
 
    int vlv_gpu_freq(struct drm_i915_private *dev_priv, int val)

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

Quoted 4 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

#9 lore raw

Re: [PATCH 2/4] drm/i915: Fix chv GPU freq<->opcode conversions

Quoted 37 lines · Deepak S
Quoted 35 lines · Ville Syrjälä
Quoted 34 lines · Deepak S
Quoted 33 lines · Ville Syrjälä
Quoted 20 lines · Deepak S
Quoted 19 lines · On Tuesday 11 November 2014 02:25 AM, [email protected] wrote:

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

Currently we miscalculate the GPU frequency on chv. This causes us to report the GPU frequency as half of what it really is. Drop the extra factor of 2 from the calculations to get the correct answer.

---
    drivers/gpu/drm/i915/intel_pm.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +0 -0
index 03fbb45..74e4293 100644
@@ -7329,7 +7329,7 @@ static int chv_gpu_freq(struct drm_i915_private *dev_priv, int val)
    	if (div < 0)
    		return div;
 
Quoted 3 lines

drivers/gpu/drm/i915/intel_pm.c static int chv_gpu_freq(struct drm_i915_private *dev_priv, int val) · line 7332

Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +1 -1
-	return DIV_ROUND_CLOSEST(czclk_freq * val, 2 * div) / 2;
+	return DIV_ROUND_CLOSEST(czclk_freq * val, 2 * div);

I think CHV is 2 X cck, shouldn't we report the cck freq and not 2 *cck?

Hmm. Once again the docs are extremely unclear. Dropping the 2x factor gives me the same numbers that the tables in the docs have. But then the spreadsheet calls it a "2x clock" in some places, which does suggest it might get further divided down by 2.

Oh, now I did find a somewhat clear note in the clock HAS:
"The dedicated GPLL (Graphics PLL) sends a 2GHz gfx clock to GenLC, which gets divided inside the GenLC block to derive a 1GHz Gfx fast clock."

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

So based on that the original code does make more sense.

Do we need to mention in comment about 2 * GFX clock?

Yeah, a comment would probably be a good idea. Could avoid some confusion in the future if someone else looks at this code.

Will you add the comment and submit a patch?

Actually I'm no longer sure about the 2x :(

I also see the following note in the clock HAS:
GT_GFCLK: This is the full rate clock, its max freq is 2000MHz.

Which is sort of telling me that there's no /2 for gfclk.

I guess it doesn't really matter what we report as long as we consistently do the conversion the the same way both ways. But it would be nice if we would end up reporting the frequency of the same clock that BDW reports. Unfortunately the BDW docs I have are even more useless in this regard.

Quoted 27 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_pm.c +0 -0
    }
 
    static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val)

drivers/gpu/drm/i915/intel_pm.c static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val) · line 7347

Quoted 8 lines
drivers/gpu/drm/i915/intel_pm.c +1 -1
@@ -7341,7 +7341,7 @@ static int chv_freq_opcode(struct drm_i915_private *dev_priv, int val)
    		return mul;
 
    	/* CHV needs even values */
-	return DIV_ROUND_CLOSEST(val * 2 * mul, czclk_freq) * 2;
+	return DIV_ROUND_CLOSEST(val * mul, czclk_freq) * 2;
    }
 
    int vlv_gpu_freq(struct drm_i915_private *dev_priv, int val)

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

Quoted 4 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

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

PATCH 3/4 drm/i915: Add missing newline to 'DDR speed' debug messages

In reply to [email protected]

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

---
 drivers/gpu/drm/i915/intel_pm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +2 -2
index 74e4293..0f5c391 100644
@@ -5217,7 +5217,7 @@ static void valleyview_init_gt_powersave(struct drm_device *dev)
 		dev_priv->mem_freq = 1333;
 		break;
 	}
-	DRM_DEBUG_DRIVER("DDR speed: %d MHz", dev_priv->mem_freq);
+	DRM_DEBUG_DRIVER("DDR speed: %d MHz\n", dev_priv->mem_freq);
 
 	dev_priv->rps.max_freq = valleyview_rps_max_freq(dev_priv);
 	dev_priv->rps.rp0_freq = dev_priv->rps.max_freq;
@@ -5286,7 +5286,7 @@ static void cherryview_init_gt_powersave(struct drm_device *dev)
 		dev_priv->mem_freq = 1600;
 		break;
 	}
-	DRM_DEBUG_DRIVER("DDR speed: %d MHz", dev_priv->mem_freq);
+	DRM_DEBUG_DRIVER("DDR speed: %d MHz\n", dev_priv->mem_freq);
 
 	dev_priv->rps.max_freq = cherryview_rps_max_freq(dev_priv);
 	dev_priv->rps.rp0_freq = dev_priv->rps.max_freq;
Signature · 6 lines
2.0.4

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

Re: [PATCH 3/4] drm/i915: Add missing newline to 'DDR speed' debug messages

Quoted 21 lines · On Tuesday 11 November 2014 02:25 AM, [email protected] wrote:

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

---
  drivers/gpu/drm/i915/intel_pm.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +1 -1
index 74e4293..0f5c391 100644
@@ -5217,7 +5217,7 @@ static void valleyview_init_gt_powersave(struct drm_device *dev)
  		dev_priv->mem_freq = 1333;
  		break;
  	}
-	DRM_DEBUG_DRIVER("DDR speed: %d MHz", dev_priv->mem_freq);
+	DRM_DEBUG_DRIVER("DDR speed: %d MHz\n", dev_priv->mem_freq);
 
  	dev_priv->rps.max_freq = valleyview_rps_max_freq(dev_priv);
  	dev_priv->rps.rp0_freq = dev_priv->rps.max_freq;

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

Quoted 8 lines
drivers/gpu/drm/i915/intel_pm.c +1 -1
@@ -5286,7 +5286,7 @@ static void cherryview_init_gt_powersave(struct drm_device *dev)
  		dev_priv->mem_freq = 1600;
  		break;
  	}
-	DRM_DEBUG_DRIVER("DDR speed: %d MHz", dev_priv->mem_freq);
+	DRM_DEBUG_DRIVER("DDR speed: %d MHz\n", dev_priv->mem_freq);
 
  	dev_priv->rps.max_freq = cherryview_rps_max_freq(dev_priv);
  	dev_priv->rps.rp0_freq = dev_priv->rps.max_freq;

:)

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

#12 lore raw

PATCH 4/4 drm/i915: Change CHV SKU400 GPU freq divider to 10

In reply to [email protected]

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

According to "Cherryview_GFXclocks_y14w36d1.xlsx" the GPU frequency divider should be 10 in when the CZ clock is 400 MHz. Change the code to agree so that we report the correct frequencies.

---
 drivers/gpu/drm/i915/intel_pm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +2 -1
index 0f5c391..b73506f 100644
@@ -7292,8 +7292,9 @@ static int vlv_gpu_freq_div(unsigned int czclk_freq)
 		return 12;
 	case 320:
 	case 333:
-	case 400:
 		return 16;
+	case 400:
+		return 20;
 	default:
 		return -1;
 	}
Signature · 6 lines
2.0.4

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

Re: [PATCH 4/4] drm/i915: Change CHV SKU400 GPU freq

-------------------------------------Summary-------------------------------------
Platform: baseline_drm_intel_nightly_pass_rate->patch_applied_pass_rate
BYT: pass/total=247/348->277/348
PNV: pass/total=326/328->325/328
ILK: pass/total=329/330->330/330
IVB: pass/total=544/546->544/546
SNB: pass/total=558/563->558/563
HSW: pass/total=573/578->573/578
BDW: pass/total=435/435->434/435
-------------------------------------Detailed-------------------------------------
test_platform: test_suite, test_case, result_with_drm_intel_nightly(count, machine_id...)...->result_with_patch_applied(count, machine_id)...
BYT: Intel_gpu_tools, igt_drv_hangman_error-state-basic, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_drv_hangman_error-state-capture-blt, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_drv_hangman_error-state-capture-bsd, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_drv_hangman_error-state-capture-render, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_drv_hangman_error-state-debugfs-entry, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_drv_hangman_error-state-sysfs-entry, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_ban-ctx-render, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_ban-render, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_close-pending-blt, BLACKLIST(1, M31)DMESG_WARN(7, M31M36M29)PASS(5, M31M36M38) -> DMESG_WARN(1, M31)PASS(3, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_close-pending-bsd, BLACKLIST(1, M31)DMESG_WARN(5, M36M29)PASS(7, M31M29M38) -> DMESG_WARN(3, M31)PASS(1, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_close-pending-ctx-render, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_close-pending-fork-blt, BLACKLIST(1, M31)DMESG_WARN(5, M31M36M29)PASS(7, M31M36M29M38) -> DMESG_WARN(2, M31)PASS(2, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_close-pending-fork-bsd, BLACKLIST(1, M31)DMESG_WARN(5, M31M36M29)PASS(7, M31M36M29M38) -> DMESG_WARN(2, M31)PASS(2, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_close-pending-fork-render, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_close-pending-fork-reverse-blt, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_close-pending-fork-reverse-bsd, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_close-pending-fork-reverse-render, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_close-pending-render, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_params, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_params-ctx-render, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_reset-count-blt, BLACKLIST(1, M31)DMESG_WARN(8, M31M36M29)PASS(4, M29M38) -> DMESG_WARN(2, M31)PASS(2, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_reset-count-bsd, BLACKLIST(1, M31)DMESG_WARN(7, M31M36M29)PASS(5, M36M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_reset-count-ctx-render, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_reset-count-render, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_reset-stats-blt, BLACKLIST(1, M31)DMESG_WARN(3, M36M29)PASS(9, M31M36M29M38) -> DMESG_WARN(1, M31)PASS(3, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_reset-stats-bsd, BLACKLIST(1, M31)DMESG_WARN(4, M36M29)PASS(8, M31M36M29M38) -> DMESG_WARN(2, M31)PASS(2, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_reset-stats-ctx-render, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_reset-stats-render, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_gem_reset_stats_unrelated-ctx-render, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
BYT: Intel_gpu_tools, igt_drv_hangman_ring-stop-sysfs-entry, BLACKLIST(1, M31)PASS(12, M31M36M29M38) -> PASS(4, M31)
PNV: Intel_gpu_tools, igt_gem_linear_blits_normal, NSPT(9, M23M7)PASS(1, M25) -> NSPT(4, M7)
ILK: Intel_gpu_tools, igt_kms_flip_flip-vs-modeset-interruptible, DMESG_WARN(1, M26)PASS(9, M37) -> PASS(4, M37)
IVB: Intel_gpu_tools, igt_kms_cursor_crc_cursor-256x256-random, PASS(4, M34M21) -> DMESG_WARN(1, M21)PASS(3, M21)
IVB: Intel_gpu_tools, igt_kms_plane_plane-position-covered-pipe-A-plane-1, TIMEOUT(1, M34)PASS(6, M21) -> PASS(4, M21)
SNB: Intel_gpu_tools, igt_kms_cursor_crc_cursor-256x256-random, PASS(4, M35M22) -> DMESG_WARN(1, M22)PASS(3, M22)
SNB: Intel_gpu_tools, igt_kms_cursor_crc_cursor-256x256-sliding, DMESG_WARN(1, M35)PASS(6, M35M22) -> PASS(4, M22)
BDW: Intel_gpu_tools, igt_gem_reset_stats_ban-bsd, PASS(13, M42M30M28) -> DMESG_WARN(1, M42)PASS(3, M42)
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 4/4
#14 lore raw

Re: [PATCH 4/4] drm/i915: Change CHV SKU400 GPU freq divider to 10

In reply to [email protected]
Quoted 16 lines · On Tuesday 11 November 2014 02:25 AM, [email protected] wrote:

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

According to "Cherryview_GFXclocks_y14w36d1.xlsx" the GPU frequency divider should be 10 in when the CZ clock is 400 MHz. Change the code to agree so that we report the correct frequencies.

---
  drivers/gpu/drm/i915/intel_pm.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +0 -0
index 0f5c391..b73506f 100644

drivers/gpu/drm/i915/intel_pm.c static int vlv_gpu_freq_div(unsigned int czclk_freq) · line 7300

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +2 -1
@@ -7292,8 +7292,9 @@ static int vlv_gpu_freq_div(unsigned int czclk_freq)
  		return 12;
  	case 320:
  	case 333:
-	case 400:
  		return 16;
+	case 400:
+		return 20;
  	default:
  		return -1;
  	}

right latest spec as div is 20

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

#15 lore raw

Re: [PATCH 4/4] drm/i915: Change CHV SKU400 GPU freq divider to 10

Quoted 31 lines · Deepak S
Quoted 16 lines · On Tuesday 11 November 2014 02:25 AM, [email protected] wrote:

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

According to "Cherryview_GFXclocks_y14w36d1.xlsx" the GPU frequency divider should be 10 in when the CZ clock is 400 MHz. Change the code to agree so that we report the correct frequencies.

---
 drivers/gpu/drm/i915/intel_pm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +0 -0
index 0f5c391..b73506f 100644

drivers/gpu/drm/i915/intel_pm.c static int vlv_gpu_freq_div(unsigned int czclk_freq) · line 7300

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +2 -1
@@ -7292,8 +7292,9 @@ static int vlv_gpu_freq_div(unsigned int czclk_freq)
 		return 12;
 	case 320:
 	case 333:
-	case 400:
 		return 16;
+	case 400:
+		return 20;
 	default:
 		return -1;
 	}

right latest spec as div is 20

Quoted 1 line

Merged all from this series except patch 2 about the 2*clock confusion. Thanks for patches&review.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx