[Intel-gfx] [PATCH] drm/i915: Wait old forcewake ack to clear on vlv

Mika Kuoppala mika.kuoppala at linux.intel.com
Wed Nov 5 16:13:27 CET 2014


with

commit 5cb13c07dae73380d8b3ddc792740487b8742938
Author: Deepak S <deepak.s at linux.intel.com>
Date:   Thu Sep 18 18:51:50 2014 +0530

    drm/i915/vlv: Remove check for Old Ack during forcewake

we didn't wait anymore for old ack bit clearing in basis
of workaround WaRsDontPollForAckOnClearingFWBits.
That WA says that driver sw should not wait for ack on clearing
fw, as the clearing is done lazily. Only when all the the fws
are cleared, the acks will clear. When in multibit fw use case.

But as we only use one bit per engine, and the assumption in here
is that engines are independant, our vlv/chv forcewake use case
does not correlate with WaRsDontPollForAckOnClearingFWBits.

So revert into waiting the ack to clear, because there is
only one bit to wait.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85684
Tested-by: lu hua <huax.lu at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
Cc: S, Deepak <deepak.s at intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
---
 drivers/gpu/drm/i915/intel_uncore.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
index 9427641..e315bce 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -195,15 +195,22 @@ static void __vlv_force_wake_get(struct drm_i915_private *dev_priv,
 						int fw_engine)
 {
 	/*
-	 * WaRsDontPollForAckOnClearingFWBits:vlv
-	 * Hardware clears ack bits lazily (only when all ack
-	 * bits become 0) so don't poll for individiual ack
-	 * bits to be clear here like on other platforms.
+	 * WaRsDontPollForAckOnClearingFWBits is not required
+	 * here as we only do one bit per engine so, the lazy
+	 * clearing of bits is not of our concern.
+	 *
+	 * XXX Even if we access multi-threaded forcewake registers, we 
+	 * use only one bit in it (another bit for userspace). Multibit access
+	 * is broken on multiple gens (IVB, BDW). See WaRSForceSingleThreadFW.
 	 */
 
 	/* Check for Render Engine */
 	if (FORCEWAKE_RENDER & fw_engine) {
 
+		if (wait_for_atomic((__raw_i915_read32(dev_priv, FORCEWAKE_ACK_VLV) &
+				     FORCEWAKE_KERNEL) == 0, FORCEWAKE_ACK_TIMEOUT_MS))
+			DRM_ERROR("Timed out: waiting for old Render ack to clear.\n");
+
 		__raw_i915_write32(dev_priv, FORCEWAKE_VLV,
 				   _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL));
 
@@ -217,6 +224,11 @@ static void __vlv_force_wake_get(struct drm_i915_private *dev_priv,
 	/* Check for Media Engine */
 	if (FORCEWAKE_MEDIA & fw_engine) {
 
+		if (wait_for_atomic((__raw_i915_read32(dev_priv, FORCEWAKE_ACK_MEDIA_VLV) &
+				     FORCEWAKE_KERNEL) == 0, FORCEWAKE_ACK_TIMEOUT_MS))
+			DRM_ERROR("Timed out: waiting for old media ack to clear.\n");
+
+
 		__raw_i915_write32(dev_priv, FORCEWAKE_MEDIA_VLV,
 				   _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL));
 
-- 
1.9.1




More information about the Intel-gfx mailing list