Skip to contentSkip to conversation

drm/i915/gen6+: Clear upper data byte during PCODE write

PATCH Superseded Imre Deak 4 participants 13 messages Nov 24, 2016 – Nov 28, 2016

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Imre Deak

author
#0 lore raw

PATCH 1/2 drm/i915/gen6+: Clear upper data byte during PCODE write

The spec calls for the upper data byte to be cleared before most of the PCODE write commands, for others like IPS control it doesn't say anything about this byte. Let's clear it in case it's clobbered somehow, especially that there are places where we only do a PCODE write without a preceeding PCODE read.

Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_pm.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/intel_pm.c +1 -0
index 29b6653..66c62f3 100644
@@ -7838,6 +7838,7 @@ int sandybridge_pcode_write(struct drm_i915_private *dev_priv,
 	}
 
 	I915_WRITE_FW(GEN6_PCODE_DATA, val);
+	I915_WRITE_FW(GEN6_PCODE_DATA1, 0);
 	I915_WRITE_FW(GEN6_PCODE_MAILBOX, GEN6_PCODE_READY | mbox);
 
 	if (intel_wait_for_register_fw(dev_priv,
Signature · 6 lines
2.5.0

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

PATCH 2/2 drm/i915/skl: Increase PCODE CDCLK change notify timeout

commit 848496e5902833600f7992f4faa82dc1546051ba

Author: Ville Syrjälä <[email protected]>
Date:   Wed Jul 13 16:32:03 2016 +0300

drm/i915: Wait up to 3ms for the pcu to ack the cdclk change request on SKL

increased the timeout to match the spec, but we still see a timeout on at least one SKL. A CDCLK change request following the failed one will succeed nevertheless, so let's try to increase the timeout to 10ms.

Cc: Ville Syrjälä <[email protected]>
Reference: https://bugs.freedesktop.org/show_bug.cgi?id=97929

---
 drivers/gpu/drm/i915/intel_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
index 5d11002..3b711f4 100644
@@ -6261,7 +6261,7 @@ static bool skl_cdclk_pcu_ready(struct drm_i915_private *dev_priv)
 
 static bool skl_cdclk_wait_for_pcu_ready(struct drm_i915_private *dev_priv)
 {
-	return _wait_for(skl_cdclk_pcu_ready(dev_priv), 3000, 10) == 0;
+	return _wait_for(skl_cdclk_pcu_ready(dev_priv), 10000, 10) == 0;
 }
 
 static void skl_set_cdclk(struct drm_i915_private *dev_priv, int cdclk, int vco)
Signature · 6 lines
2.5.0

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

Re: [PATCH 2/2] drm/i915/skl: Increase PCODE CDCLK change notify timeout

Quoted 22 lines · Imre Deak

commit 848496e5902833600f7992f4faa82dc1546051ba

Author: Ville Syrjälä <[email protected]>
Date:   Wed Jul 13 16:32:03 2016 +0300

drm/i915: Wait up to 3ms for the pcu to ack the cdclk change request on SKL

increased the timeout to match the spec, but we still see a timeout on at least one SKL. A CDCLK change request following the failed one will succeed nevertheless, so let's try to increase the timeout to 10ms.

Cc: Ville Syrjälä <[email protected]>
Reference: https://bugs.freedesktop.org/show_bug.cgi?id=97929

---
 drivers/gpu/drm/i915/intel_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 5d11002..3b711f4 100644

drivers/gpu/drm/i915/intel_display.c static bool skl_cdclk_pcu_ready(struct drm_i915_private *dev_priv) · line 6265

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -6261,7 +6261,7 @@ static bool skl_cdclk_pcu_ready(struct drm_i915_private *dev_priv)
 
 static bool skl_cdclk_wait_for_pcu_ready(struct drm_i915_private *dev_priv)
 {
-	return _wait_for(skl_cdclk_pcu_ready(dev_priv), 3000, 10) == 0;
+	return _wait_for(skl_cdclk_pcu_ready(dev_priv), 10000, 10) == 0;
 }

I can't think of a better approach to kick the pcu. But that is a wakeup every 10us for 10ms.

{
	int ret;

	ret = wait_for_us(skl_cdclk_pcu_ready(dev_priv), 10);
	if (ret)
		ret = wait_for(skl_cdclk_pcu_ready(dev_priv), 10);

	return ret;
}

would spin for the first 10us then do a more gentle probe for the next 10ms.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [PATCH 2/2] drm/i915/skl: Increase PCODE CDCLK change notify timeout

Quoted 43 lines · Chris Wilson
Quoted 22 lines · Imre Deak

commit 848496e5902833600f7992f4faa82dc1546051ba

Author: Ville Syrjälä <[email protected]>
Date:   Wed Jul 13 16:32:03 2016 +0300

drm/i915: Wait up to 3ms for the pcu to ack the cdclk change request on SKL

increased the timeout to match the spec, but we still see a timeout on at least one SKL. A CDCLK change request following the failed one will succeed nevertheless, so let's try to increase the timeout to 10ms.

Cc: Ville Syrjälä <[email protected]>
Reference: https://bugs.freedesktop.org/show_bug.cgi?id=97929

---
 drivers/gpu/drm/i915/intel_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 5d11002..3b711f4 100644

drivers/gpu/drm/i915/intel_display.c static bool skl_cdclk_pcu_ready(struct drm_i915_private *dev_priv) · line 6265

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -6261,7 +6261,7 @@ static bool skl_cdclk_pcu_ready(struct drm_i915_private *dev_priv)
 
 static bool skl_cdclk_wait_for_pcu_ready(struct drm_i915_private *dev_priv)
 {
-	return _wait_for(skl_cdclk_pcu_ready(dev_priv), 3000, 10) == 0;
+	return _wait_for(skl_cdclk_pcu_ready(dev_priv), 10000, 10) == 0;
 }

I can't think of a better approach to kick the pcu. But that is a wakeup every 10us for 10ms.

{
	int ret;

	ret = wait_for_us(skl_cdclk_pcu_ready(dev_priv), 10);
	if (ret)
		ret = wait_for(skl_cdclk_pcu_ready(dev_priv), 10);

	return ret;
}
Quoted 2 lines

would spin for the first 10us then do a more gentle probe for the next 10ms.

Otoh, talking to the pcu also includes such spinners within itself, so probably overkill to spin on top as well.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#4 lore raw

PATCH v2 2/2 drm/i915/skl: Increase PCODE CDCLK change notify timeout

In reply to Imre Deak

commit 848496e5902833600f7992f4faa82dc1546051ba

Author: Ville Syrjälä <[email protected]>
Date:   Wed Jul 13 16:32:03 2016 +0300

drm/i915: Wait up to 3ms for the pcu to ack the cdclk change request on SKL

increased the timeout to match the spec, but we still see a timeout on at least one SKL. A CDCLK change request following the failed one will succeed nevertheless, so let's try to increase the timeout to 10ms.

v2:
- Use 1ms poll period instead of 10us. (Chris)

Cc: Ville Syrjälä <[email protected]>
Cc: Chris Wilson <[email protected]>
Reference: https://bugs.freedesktop.org/show_bug.cgi?id=97929

---
 drivers/gpu/drm/i915/intel_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
index 5d11002..f07b611 100644
@@ -6261,7 +6261,7 @@ static bool skl_cdclk_pcu_ready(struct drm_i915_private *dev_priv)
 
 static bool skl_cdclk_wait_for_pcu_ready(struct drm_i915_private *dev_priv)
 {
-	return _wait_for(skl_cdclk_pcu_ready(dev_priv), 3000, 10) == 0;
+	return wait_for(skl_cdclk_pcu_ready(dev_priv), 10) == 0;
 }
 
 static void skl_set_cdclk(struct drm_i915_private *dev_priv, int cdclk, int vco)
Signature · 6 lines
2.5.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 2/2
#5 lore raw

Re: [PATCH v2 2/2] drm/i915/skl: Increase PCODE CDCLK change notify timeout

Quoted 10 lines · Imre Deak

commit 848496e5902833600f7992f4faa82dc1546051ba

Author: Ville Syrjälä <[email protected]>
Date:   Wed Jul 13 16:32:03 2016 +0300

drm/i915: Wait up to 3ms for the pcu to ack the cdclk change request on SKL

increased the timeout to match the spec, but we still see a timeout on at least one SKL. A CDCLK change request following the failed one will succeed nevertheless, so let's try to increase the timeout to 10ms.

Quoted 7 lines

v2:
- Use 1ms poll period instead of 10us. (Chris)

Cc: Ville Syrjälä <[email protected]>
Cc: Chris Wilson <[email protected]>
Reference: https://bugs.freedesktop.org/show_bug.cgi?id=97929

If you are happy with it, so am I!

Possibly time to volunteer someone to look at the poll interval again. -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

Re: [PATCH v2 2/2] drm/i915/skl: Increase PCODE CDCLK change notify timeout

In reply to Imre Deak
Quoted 4 lines · Imre Deak

commit 848496e5902833600f7992f4faa82dc1546051ba

Author: Ville Syrjälä <[email protected]>
Date:   Wed Jul 13 16:32:03 2016 +0300
Quoted 8 lines

drm/i915: Wait up to 3ms for the pcu to ack the cdclk change request on SKL

increased the timeout to match the spec, but we still see a timeout on at least one SKL. A CDCLK change request following the failed one will succeed nevertheless, so let's try to increase the timeout to 10ms.

v2:
- Use 1ms poll period instead of 10us. (Chris)

I'm not sure that's what we want. IIRC the spec says no delay between attempts, so I'm not sure this isn't just going to make it more likely to fail.

Quoted 24 lines

Cc: Ville Syrjälä <[email protected]>
Cc: Chris Wilson <[email protected]>
Reference: https://bugs.freedesktop.org/show_bug.cgi?id=97929

---
 drivers/gpu/drm/i915/intel_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
index 5d11002..f07b611 100644
@@ -6261,7 +6261,7 @@ static bool skl_cdclk_pcu_ready(struct drm_i915_private *dev_priv)
 
 static bool skl_cdclk_wait_for_pcu_ready(struct drm_i915_private *dev_priv)
 {
-	return _wait_for(skl_cdclk_pcu_ready(dev_priv), 3000, 10) == 0;
+	return wait_for(skl_cdclk_pcu_ready(dev_priv), 10) == 0;
 }
 
 static void skl_set_cdclk(struct drm_i915_private *dev_priv, int cdclk, int vco)
Signature · 1 line
2.5.0
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

Re: [PATCH v2 2/2] drm/i915/skl: Increase PCODE CDCLK change notify timeout

Quoted 11 lines · Ville Syrjälä
Quoted 10 lines · Imre Deak

commit 848496e5902833600f7992f4faa82dc1546051ba

Author: Ville Syrjälä <[email protected]>
Date:   Wed Jul 13 16:32:03 2016 +0300

drm/i915: Wait up to 3ms for the pcu to ack the cdclk change request on SKL

increased the timeout to match the spec, but we still see a timeout on at least one SKL. A CDCLK change request following the failed one will succeed nevertheless, so let's try to increase the timeout to 10ms.

Quoted 6 lines
Quoted 2 lines

v2:
- Use 1ms poll period instead of 10us. (Chris)

I'm not sure that's what we want. IIRC the spec says no delay between attempts, so I'm not sure this isn't just going to make it more likely to fail.

Hmm. We're going to be scheduled away eventually, unless we steal the cpu for 10ms. To be strict to the spec we would need

	preempt_disable();
	ret = wait_for_atomic(pcu_ready(), 10);
	preempt_enable();

	return ret;
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#8 lore raw

Re: [PATCH v2 2/2] drm/i915/skl: Increase PCODE CDCLK change notify timeout

Quoted 25 lines · Chris Wilson
Quoted 15 lines · Ville Syrjälä
Quoted 14 lines · Imre Deak

commit 848496e5902833600f7992f4faa82dc1546051ba
Author: Ville Syrjälä <[email protected]> Date:   Wed Jul 13 16:32:03 2016 +0300

    drm/i915: Wait up to 3ms for the pcu to ack the cdclk change request on SKL

increased the timeout to match the spec, but we still see a timeout on
at least one SKL. A CDCLK change request following the failed one will
succeed nevertheless, so let's try to increase the timeout to 10ms.

Quoted 8 lines
Quoted 2 lines

v2:
- Use 1ms poll period instead of 10us. (Chris)

I'm not sure that's what we want. IIRC the spec says no delay between
attempts, so I'm not sure this isn't just going to make it more likely
to fail.

Quoted 8 lines

Hmm. We're going to be scheduled away eventually, unless we steal the cpu for 10ms. To be strict to the spec we would need

	preempt_disable();
	ret = wait_for_atomic(pcu_ready(), 10);
	preempt_enable();

	return ret;

Yes, after some testing it looks like when things fail we call pcu_ready() only once after scheduling away for 3ms and so if that one call fails we time out. So I think we need preempt_disable(), I updated the patch adding that.

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

Reviewed-by on v1 1/2
#9 lore raw
In reply to Imre Deak
Quoted 8 lines · Imre Deak

The spec calls for the upper data byte to be cleared before most of the PCODE write commands, for others like IPS control it doesn't say anything about this byte. Let's clear it in case it's clobbered somehow, especially that there are places where we only do a PCODE write without a preceeding PCODE read.

Cc Ville Syrjälä <[email protected]>

Seems sensible to me.

-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/2
#10 lore raw
In reply to Imre Deak
Quoted 17 lines · Imre Deak

The spec calls for the upper data byte to be cleared before most of the PCODE write commands, for others like IPS control it doesn't say anything about this byte. Let's clear it in case it's clobbered somehow, especially that there are places where we only do a PCODE write without a preceeding PCODE read.

Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_pm.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/intel_pm.c +0 -0
index 29b6653..66c62f3 100644

drivers/gpu/drm/i915/intel_pm.c int sandybridge_pcode_write(struct drm_i915_private *dev_priv, · line 7842

Quoted 5 lines
drivers/gpu/drm/i915/intel_pm.c +1 -0
@@ -7838,6 +7838,7 @@ int sandybridge_pcode_write(struct drm_i915_private *dev_priv,
 	}
 
 	I915_WRITE_FW(GEN6_PCODE_DATA, val);
+	I915_WRITE_FW(GEN6_PCODE_DATA1, 0);
 	I915_WRITE_FW(GEN6_PCODE_MAILBOX, GEN6_PCODE_READY | mbox);

Hmm. Somehow we missed it in dddab346d828 ("drm/i915: Clear PCODE_DATA1 on SNB+") even though my ramblings (which were quoted in the commit msg) stated that we should do it in both the read and write functions.

Quoted 4 lines
drivers/gpu/drm/i915/intel_pm.c +0 -0
 	if (intel_wait_for_register_fw(dev_priv,
Signature · 1 line
2.5.0
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915/gen6+: Clear upper data byte during PCODE write

In reply to Imre Deak
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915/gen6+: Clear upper data byte during PCODE write
URL : https://patchwork.freedesktop.org/series/15911/
State : success

== Summary ==

Series 15911v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/15911/revisions/1/mbox/

fi-bdw-5557u     total:244  pass:229  dwarn:0   dfail:0   fail:0   skip:15 
fi-bsw-n3050     total:244  pass:204  dwarn:0   dfail:0   fail:0   skip:40 
fi-bxt-t5700     total:244  pass:216  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-j1900     total:244  pass:216  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-n2820     total:244  pass:212  dwarn:0   dfail:0   fail:0   skip:32 
fi-hsw-4770      total:244  pass:224  dwarn:0   dfail:0   fail:0   skip:20 
fi-hsw-4770r     total:244  pass:224  dwarn:0   dfail:0   fail:0   skip:20 
fi-ilk-650       total:244  pass:191  dwarn:0   dfail:0   fail:0   skip:53 
fi-ivb-3520m     total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-ivb-3770      total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-kbl-7200u     total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-kbl-7500u     total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-skl-6260u     total:244  pass:230  dwarn:0   dfail:0   fail:0   skip:14 
fi-skl-6700hq    total:244  pass:223  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6700k     total:244  pass:222  dwarn:1   dfail:0   fail:0   skip:21 
fi-skl-6770hq    total:244  pass:230  dwarn:0   dfail:0   fail:0   skip:14 
fi-snb-2520m     total:244  pass:212  dwarn:0   dfail:0   fail:0   skip:32 
fi-snb-2600      total:244  pass:211  dwarn:0   dfail:0   fail:0   skip:33 

262f64d637b5d976bd042a05fc00f2b8a16faee5 drm-tip: 2016y-11m-24d-15h-21m-13s UTC integration manifest d647418 drm/i915/skl: Increase PCODE CDCLK change notify timeout
fe8604a drm/i915/gen6+: Clear upper data byte during PCODE write

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3110/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#12 lore raw

✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915/gen6+: Clear upper data byte during PCODE write (rev2)

In reply to Imre Deak
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915/gen6+: Clear upper data byte during PCODE write (rev2)
URL : https://patchwork.freedesktop.org/series/15911/
State : success

== Summary ==

Series 15911v2 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/15911/revisions/2/mbox/

fi-bdw-5557u     total:244  pass:229  dwarn:0   dfail:0   fail:0   skip:15 
fi-bsw-n3050     total:244  pass:204  dwarn:0   dfail:0   fail:0   skip:40 
fi-byt-j1900     total:244  pass:216  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-n2820     total:244  pass:212  dwarn:0   dfail:0   fail:0   skip:32 
fi-hsw-4770      total:244  pass:224  dwarn:0   dfail:0   fail:0   skip:20 
fi-hsw-4770r     total:244  pass:224  dwarn:0   dfail:0   fail:0   skip:20 
fi-ilk-650       total:244  pass:191  dwarn:0   dfail:0   fail:0   skip:53 
fi-ivb-3520m     total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-ivb-3770      total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-kbl-7500u     total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-skl-6260u     total:244  pass:230  dwarn:0   dfail:0   fail:0   skip:14 
fi-skl-6700hq    total:244  pass:223  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6700k     total:244  pass:222  dwarn:1   dfail:0   fail:0   skip:21 
fi-skl-6770hq    total:244  pass:230  dwarn:0   dfail:0   fail:0   skip:14 
fi-snb-2520m     total:244  pass:212  dwarn:0   dfail:0   fail:0   skip:32 
fi-snb-2600      total:244  pass:211  dwarn:0   dfail:0   fail:0   skip:33 

90e312d771441d1ec7bf3cd72620a3fe9a4aef82 drm-tip: 2016y-11m-25d-07h-11m-59s UTC integration manifest 492a9da drm/i915/skl: Increase PCODE CDCLK change notify timeout
4427f60 drm/i915/gen6+: Clear upper data byte during PCODE write

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3114/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx