drm/i915: implement WaIssueDummyWriteToWakeupFromRC6
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 18 Oct 2012 12:16:09 +0000 (14:16 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Sun, 11 Nov 2012 22:51:02 +0000 (23:51 +0100)
Or at least our best understanding of it.

v2: Fixup commit message and put the wa name into the comment block.
And actually update the commit, too.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_drv.c

index 59dc4817964b65ed4fa091318023290f0d0bd0f1..42388533708f47530517600bf5b502a332a0ef90 100644 (file)
@@ -1131,9 +1131,20 @@ static bool IS_DISPLAYREG(u32 reg)
        return true;
 }
 
+static void
+ilk_dummy_write(struct drm_i915_private *dev_priv)
+{
+       /* WaIssueDummyWriteToWakeupFromRC6: Issue a dummy write to wake up the
+        * chip from rc6 before touching it for real. MI_MODE is masked, hence
+        * harmless to write 0 into. */
+       I915_WRITE_NOTRACE(MI_MODE, 0);
+}
+
 #define __i915_read(x, y) \
 u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \
        u##x val = 0; \
+       if (IS_GEN5(dev_priv->dev)) \
+               ilk_dummy_write(dev_priv); \
        if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \
                unsigned long irqflags; \
                spin_lock_irqsave(&dev_priv->gt_lock, irqflags); \
@@ -1165,6 +1176,8 @@ void i915_write##x(struct drm_i915_private *dev_priv, u32 reg, u##x val) { \
        if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \
                __fifo_ret = __gen6_gt_wait_for_fifo(dev_priv); \
        } \
+       if (IS_GEN5(dev_priv->dev)) \
+               ilk_dummy_write(dev_priv); \
        if (IS_VALLEYVIEW(dev_priv->dev) && IS_DISPLAYREG(reg)) { \
                write##y(val, dev_priv->regs + reg + 0x180000);         \
        } else {                                                        \