From 8a628fff03bb145b8ed5180e2faa9a2bb42d2fe9 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 29 May 2012 14:24:47 +0100 Subject: [PATCH] drm/i915: Bump the CPU to C0 to ensure that we have left rc6 As part of the extended forcewake dance, we need this workaround of raising the CPU to C0 to be sure that we have left rc6. Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/i915_drv.c | 9 +++++++++ drivers/gpu/drm/i915/i915_drv.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index d3e1948..1c23bc8 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -437,6 +437,9 @@ void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv) count = 0; while (count++ < 50 && (I915_READ_NOTRACE(FORCEWAKE_ACK) & 1) == 0) udelay(10); + + /* w/a: we need for the CPU to be in C0 to be sure we are out of rc6 */ + dev_pm_qos_add_request(dev_priv->dev, &dev_priv->gt_pm_qos, 0); } void __gen6_gt_force_wake_mt_get(struct drm_i915_private *dev_priv) @@ -453,6 +456,8 @@ void __gen6_gt_force_wake_mt_get(struct drm_i915_private *dev_priv) count = 0; while (count++ < 50 && (I915_READ_NOTRACE(FORCEWAKE_MT_ACK) & 1) == 0) udelay(10); + + dev_pm_qos_add_request(dev_priv->dev, &dev_priv->gt_pm_qos, 0); } /* @@ -482,6 +487,8 @@ static void gen6_gt_check_fifodbg(struct drm_i915_private *dev_priv) void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) { + dev_pm_qos_remove_request(&dev_priv->gt_pm_qos); + I915_WRITE_NOTRACE(FORCEWAKE, 0); /* The below doubles as a POSTING_READ */ gen6_gt_check_fifodbg(dev_priv); @@ -489,6 +496,8 @@ void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) void __gen6_gt_force_wake_mt_put(struct drm_i915_private *dev_priv) { + dev_pm_qos_remove_request(&dev_priv->gt_pm_qos); + I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_DISABLE(1)); /* The below doubles as a POSTING_READ */ gen6_gt_check_fifodbg(dev_priv); diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 11c7a6a..414f02c 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -40,6 +40,7 @@ #include #include #include +#include /* General customization: */ @@ -356,6 +357,7 @@ typedef struct drm_i915_private { unsigned forcewake_count; /** gt_lock is also taken in irq contexts. */ struct spinlock gt_lock; + struct pm_qos_request gt_pm_qos; struct intel_gmbus gmbus[GMBUS_NUM_PORTS]; -- 1.7.10