Skip to contentSkip to conversation

drm/i915/vlv: Workaround a punit issue in DDR data rate for 1333.

PATCH Applied Chon Ming Lee 4 participants 11 messages Nov 7, 2013 1 message not in the archive

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

PATCH 1/2 drm/i915/vlv: Workaround a punit issue in DDR data rate for 1333.

For DDR data rate reporting by Punit in PUNIT_GPU_FREQ_STS, the actual data encoding is 00b=800, 01b=1066, 10b=1333, 11b=1333.

Some premium VLV sku will get the DDR_DATA_RATE set as 11. As a result, the turbo frequency reporting will be incorrect without this workaround.

---
 drivers/gpu/drm/i915/intel_pm.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +1 -6
index a5778e5..13fb7f8 100644
@@ -5328,12 +5328,7 @@ static void valleyview_init_clock_gating(struct drm_device *dev)
 		dev_priv->mem_freq = 1333;
 		break;
 	case 3:
-		/*
-		 * Probably a BIOS/Punit bug, or a new platform we don't
-		 * support yet.
-		 */
-		WARN(1, "invalid DDR freq detected, assuming 800MHz\n");
-		dev_priv->mem_freq = 800;
+		dev_priv->mem_freq = 1333;
 		break;
 	}
 	DRM_DEBUG_DRIVER("DDR speed: %d MHz", dev_priv->mem_freq);
Signature · 1 line
1.7.7.6
#1 lore raw

PATCH 2/2 drm/i915/vlv: For i915_cur_delayinfo, the max frequency reporting wrong value.

The max frequency reporting is not correct. But there is already an existing valleyview_rps_max_freq and valleyview_rps_min_freq to get the frequency. Use that for i915_cur_delayinfo.

---
 drivers/gpu/drm/i915/i915_debugfs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +2 -2
index cae3e9c..5254d95 100644
@@ -972,11 +972,11 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
 		seq_printf(m, "PUNIT_REG_GPU_FREQ_STS: 0x%08x\n", freq_sts);
 		seq_printf(m, "DDR freq: %d MHz\n", dev_priv->mem_freq);
 
-		val = vlv_punit_read(dev_priv, PUNIT_FUSE_BUS1);
+		val = valleyview_rps_max_freq(dev_priv);
 		seq_printf(m, "max GPU freq: %d MHz\n",
 			   vlv_gpu_freq(dev_priv->mem_freq, val));
 
-		val = vlv_punit_read(dev_priv, PUNIT_REG_GPU_LFM);
+		val = valleyview_rps_min_freq(dev_priv);
 		seq_printf(m, "min GPU freq: %d MHz\n",
 			   vlv_gpu_freq(dev_priv->mem_freq, val));
 
Signature · 1 line
1.7.7.6
#2 lore raw

Re: [PATCH 2/2] drm/i915/vlv: For i915_cur_delayinfo, the max frequency reporting wrong value.

Quoted 14 lines · Chon Ming Lee

The max frequency reporting is not correct. But there is already an existing valleyview_rps_max_freq and valleyview_rps_min_freq to get the frequency. Use that for i915_cur_delayinfo.

---
 drivers/gpu/drm/i915/i915_debugfs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
index cae3e9c..5254d95 100644

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

Quoted 5 lines
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
@@ -972,11 +972,11 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
 		seq_printf(m, "PUNIT_REG_GPU_FREQ_STS: 0x%08x\n", freq_sts);
 		seq_printf(m, "DDR freq: %d MHz\n", dev_priv->mem_freq);
 
-		val = vlv_punit_read(dev_priv, PUNIT_FUSE_BUS1);
+		val = valleyview_rps_max_freq(dev_priv);

I'm not actually sure about the NC freq stuff. Not sure where that is even documented. The punit turbo HAS tells us to read the max and guaranteed freqs from PUNIT_FUSE_BUS1. Maybe we should actually change valleyview_rps_max_freq() and valleyview_rps_rpe_freq() to read them from PUNIT_FUSE_BUS1?

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

Quoted 5 lines
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
 		seq_printf(m, "max GPU freq: %d MHz\n",
 			   vlv_gpu_freq(dev_priv->mem_freq, val));
 
-		val = vlv_punit_read(dev_priv, PUNIT_REG_GPU_LFM);
+		val = valleyview_rps_min_freq(dev_priv);

This one is the same register, just with masking, so this change looks OK. And it matches the punit turbo HAS.

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
 		seq_printf(m, "min GPU freq: %d MHz\n",
 			   vlv_gpu_freq(dev_priv->mem_freq, val));
 
Signature · 6 lines
1.7.7.6

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

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

#4 lore raw

Re: [PATCH 2/2] drm/i915/vlv: For i915_cur_delayinfo, the max frequency reporting wrong value.

Cc back the the mailing list.

Quoted 59 lines · Chon Ming
Quoted 18 lines · Ville Syrjälä
Quoted 17 lines · Chon Ming Lee

The max frequency reporting is not correct. But there is already an existing valleyview_rps_max_freq and valleyview_rps_min_freq to get the frequency. Use that for i915_cur_delayinfo.

---
 drivers/gpu/drm/i915/i915_debugfs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
index cae3e9c..5254d95 100644
@@ -972,11 +972,11 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
 		seq_printf(m, "PUNIT_REG_GPU_FREQ_STS: 0x%08x\n", freq_sts);
 		seq_printf(m, "DDR freq: %d MHz\n", dev_priv->mem_freq);
 
Quoted 8 lines

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

Quoted 2 lines
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
-		val = vlv_punit_read(dev_priv, PUNIT_FUSE_BUS1);
+		val = valleyview_rps_max_freq(dev_priv);

I'm not actually sure about the NC freq stuff. Not sure where that is even documented. The punit turbo HAS tells us to read the max and guaranteed freqs from PUNIT_FUSE_BUS1. Maybe we should actually change valleyview_rps_max_freq() and valleyview_rps_rpe_freq() to read them from PUNIT_FUSE_BUS1?

The document is not correct. I remember few months back during email exchange with the punit owner on how to get the max frequency, the correct way is to read from the NC Fuse. Jesse is in the loop, which I believe he created the patch for valleyview_rps_max_freq.

Regards,
Chon Ming

Quoted 24 lines

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

Quoted 6 lines
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
 		seq_printf(m, "max GPU freq: %d MHz\n",
 			   vlv_gpu_freq(dev_priv->mem_freq, val));
 
-		val = vlv_punit_read(dev_priv, PUNIT_REG_GPU_LFM);
+		val = valleyview_rps_min_freq(dev_priv);

This one is the same register, just with masking, so this change looks OK. And it matches the punit turbo HAS.

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
 		seq_printf(m, "min GPU freq: %d MHz\n",
 			   vlv_gpu_freq(dev_priv->mem_freq, val));
 
Signature · 6 lines
1.7.7.6

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

Re: [PATCH 2/2] drm/i915/vlv: For i915_cur_delayinfo, the max frequency reporting wrong value.

In reply to Chon Ming Lee
Quoted 17 lines · On Thu, 7 Nov 2013 15:23:27 +0800 Chon Ming Lee <[email protected]>…

The max frequency reporting is not correct. But there is already an existing valleyview_rps_max_freq and valleyview_rps_min_freq to get the frequency. Use that for i915_cur_delayinfo.

---
 drivers/gpu/drm/i915/i915_debugfs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
index cae3e9c..5254d95 100644
@@ -972,11 +972,11 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
 		seq_printf(m, "PUNIT_REG_GPU_FREQ_STS: 0x%08x\n", freq_sts);
 		seq_printf(m, "DDR freq: %d MHz\n", dev_priv->mem_freq);
 

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

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +2 -2
-		val = vlv_punit_read(dev_priv, PUNIT_FUSE_BUS1);
+		val = valleyview_rps_max_freq(dev_priv);
 		seq_printf(m, "max GPU freq: %d MHz\n",
 			   vlv_gpu_freq(dev_priv->mem_freq, val));
 
-		val = vlv_punit_read(dev_priv, PUNIT_REG_GPU_LFM);
+		val = valleyview_rps_min_freq(dev_priv);
 		seq_printf(m, "min GPU freq: %d MHz\n",
 			   vlv_gpu_freq(dev_priv->mem_freq, val));
 

Ok yeah this is just ancient. It never got fixed up when the other bits were added.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#6 lore raw

Re: [PATCH 2/2] drm/i915/vlv: For i915_cur_delayinfo, the max frequency reporting wrong value.

Quoted 34 lines · Jesse Barnes
Quoted 17 lines · On Thu, 7 Nov 2013 15:23:27 +0800 Chon Ming Lee <[email protected]>…

The max frequency reporting is not correct. But there is already an existing valleyview_rps_max_freq and valleyview_rps_min_freq to get the frequency. Use that for i915_cur_delayinfo.

---
 drivers/gpu/drm/i915/i915_debugfs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
index cae3e9c..5254d95 100644
@@ -972,11 +972,11 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
 		seq_printf(m, "PUNIT_REG_GPU_FREQ_STS: 0x%08x\n", freq_sts);
 		seq_printf(m, "DDR freq: %d MHz\n", dev_priv->mem_freq);
 

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

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +2 -2
-		val = vlv_punit_read(dev_priv, PUNIT_FUSE_BUS1);
+		val = valleyview_rps_max_freq(dev_priv);
 		seq_printf(m, "max GPU freq: %d MHz\n",
 			   vlv_gpu_freq(dev_priv->mem_freq, val));
 
-		val = vlv_punit_read(dev_priv, PUNIT_REG_GPU_LFM);
+		val = valleyview_rps_min_freq(dev_priv);
 		seq_printf(m, "min GPU freq: %d MHz\n",
 			   vlv_gpu_freq(dev_priv->mem_freq, val));
 

Ok yeah this is just ancient. It never got fixed up when the other bits were added.

Quoted 1 line

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
#7 lore raw
In reply to Chon Ming Lee
Quoted 5 lines · Chon Ming Lee

For DDR data rate reporting by Punit in PUNIT_GPU_FREQ_STS, the actual data encoding is 00b=800, 01b=1066, 10b=1333, 11b=1333.

Some premium VLV sku will get the DDR_DATA_RATE set as 11. As a result, the turbo frequency reporting will be incorrect without this workaround.

Does that mean that the original encoding we used was in fact correct, and the new one is not?

Quoted 31 lines
---
 drivers/gpu/drm/i915/intel_pm.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +1 -6
index a5778e5..13fb7f8 100644
@@ -5328,12 +5328,7 @@ static void valleyview_init_clock_gating(struct drm_device *dev)
 		dev_priv->mem_freq = 1333;
 		break;
 	case 3:
-		/*
-		 * Probably a BIOS/Punit bug, or a new platform we don't
-		 * support yet.
-		 */
-		WARN(1, "invalid DDR freq detected, assuming 800MHz\n");
-		dev_priv->mem_freq = 800;
+		dev_priv->mem_freq = 1333;
 		break;
 	}
 	DRM_DEBUG_DRIVER("DDR speed: %d MHz", dev_priv->mem_freq);
Signature · 6 lines
1.7.7.6

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

For DDR data rate reporting by Punit in PUNIT_GPU_FREQ_STS, the actual data encoding is 00b=800, 01b=1066, 10b=1333, 11b=1333.

Some premium VLV sku will get the DDR_DATA_RATE set as 11. As a result, the turbo frequency reporting will be incorrect without this workaround.

Does that mean that the original encoding we used was in fact correct, and the new one is not?

The spec documents the encoding is 00b=800, 01b=1066, 10b=1333, 11b=invalid

But after check with the punit owner, the 11b is refer to 1333 as well. It is not invalid anymore.

Quoted 35 lines
Quoted 31 lines
---
 drivers/gpu/drm/i915/intel_pm.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +1 -6
index a5778e5..13fb7f8 100644
@@ -5328,12 +5328,7 @@ static void valleyview_init_clock_gating(struct drm_device *dev)
 		dev_priv->mem_freq = 1333;
 		break;
 	case 3:
-		/*
-		 * Probably a BIOS/Punit bug, or a new platform we don't
-		 * support yet.
-		 */
-		WARN(1, "invalid DDR freq detected, assuming 800MHz\n");
-		dev_priv->mem_freq = 800;
+		dev_priv->mem_freq = 1333;
 		break;
 	}
 	DRM_DEBUG_DRIVER("DDR speed: %d MHz", dev_priv->mem_freq);
Signature · 6 lines
1.7.7.6

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC
Reviewed-by
#9 lore raw
Quoted 5 lines · Chon Ming
Quoted 4 lines · Ville Syrjälä
Quoted 3 lines · Chon Ming Lee

For DDR data rate reporting by Punit in PUNIT_GPU_FREQ_STS, the actual data encoding is 00b=800, 01b=1066, 10b=1333, 11b=1333.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Some premium VLV sku will get the DDR_DATA_RATE set as 11. As a result, the turbo frequency reporting will be incorrect without this workaround.

Does that mean that the original encoding we used was in fact correct, and the new one is not?

The spec documents the encoding is 00b=800, 01b=1066, 10b=1333, 11b=invalid

There was another encoding in some older spec. And we just changed from that to the current one.

Quoted 3 lines

But after check with the punit owner, the 11b is refer to 1333 as well. It is not invalid anymore.

OK. In that case:

Quoted 36 lines
Quoted 36 lines
Quoted 32 lines
---
 drivers/gpu/drm/i915/intel_pm.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +1 -6
index a5778e5..13fb7f8 100644
@@ -5328,12 +5328,7 @@ static void valleyview_init_clock_gating(struct drm_device *dev)
 		dev_priv->mem_freq = 1333;
 		break;
 	case 3:
-		/*
-		 * Probably a BIOS/Punit bug, or a new platform we don't
-		 * support yet.
-		 */
-		WARN(1, "invalid DDR freq detected, assuming 800MHz\n");
-		dev_priv->mem_freq = 800;
+		dev_priv->mem_freq = 1333;
 		break;
 	}
 	DRM_DEBUG_DRIVER("DDR speed: %d MHz", dev_priv->mem_freq);
Signature · 6 lines
1.7.7.6

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC
Signature · 2 lines
Ville Syrjälä
Intel OTC
#10 lore raw
Quoted 19 lines · Ville Syrjälä
Quoted 5 lines · Chon Ming
Quoted 4 lines · Ville Syrjälä
Quoted 3 lines · Chon Ming Lee

For DDR data rate reporting by Punit in PUNIT_GPU_FREQ_STS, the actual data encoding is 00b=800, 01b=1066, 10b=1333, 11b=1333.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Some premium VLV sku will get the DDR_DATA_RATE set as 11. As a result, the turbo frequency reporting will be incorrect without this workaround.

Does that mean that the original encoding we used was in fact correct, and the new one is not?

The spec documents the encoding is 00b=800, 01b=1066, 10b=1333, 11b=invalid

There was another encoding in some older spec. And we just changed from that to the current one.

Quoted 1 line
Quoted 6 lines
Quoted 2 lines

But after check with the punit owner, the 11b is refer to 1333 as well. It is not invalid anymore.

OK. In that case:

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
In reply to Ville Syrjälä
Quoted 19 lines · On Thu, 7 Nov 2013 16:01:50 +0200 Ville Syrjälä…
Quoted 5 lines · Chon Ming
Quoted 4 lines · Ville Syrjälä
Quoted 3 lines · Chon Ming Lee

For DDR data rate reporting by Punit in PUNIT_GPU_FREQ_STS, the actual data encoding is 00b=800, 01b=1066, 10b=1333, 11b=1333.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Some premium VLV sku will get the DDR_DATA_RATE set as 11. As a result, the turbo frequency reporting will be incorrect without this workaround.

Does that mean that the original encoding we used was in fact correct, and the new one is not?

The spec documents the encoding is 00b=800, 01b=1066, 10b=1333, 11b=invalid

There was another encoding in some older spec. And we just changed from that to the current one.

Quoted 1 line
Quoted 6 lines
Quoted 2 lines

But after check with the punit owner, the 11b is refer to 1333 as well. It is not invalid anymore.

OK. In that case:

Yeah and just for the record books, the old encoding was listed as 00 = 800, 01=800, 10=1066, 11=1333. But apparently it's been shifted left, with 11 staying as 1333. So Chon Ming's patch looks ok.

I don't understand 2/2 though; was there a Punit HAS or Punit turbo HAS update we missed?

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