summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2014-02-19 16:44:08 -0300
committerPaulo Zanoni <paulo.r.zanoni@intel.com>2014-02-26 18:42:32 -0300
commit5b4a385c5aa3db321ae97e9518fced1dfcef22d4 (patch)
treed14d7e7c9ebd3980018320d665df943356e9f766
parentc703cb1ec17316109dd1420252aac1299a3e5d3f (diff)
drm/i915: add forcewake functions that don't touch runtime PM
To solve a chicken-and-egg problem. Currently when we get/put forcewake we also get/put runtime PM and this works fine because the runtime PM code doesn't need forcewake. But we're going to merge PC8 and runtime PM into a single feature, and the PC8 code (the LCPLL code) does need the forcewake, so that specific piece of code needs to call the _no_rpm version so it doesn't try to get runtime PM in the code that gets runtime PM. For now the new functions are unused, we'll use them on the patch that merges PC8 with runtime PM. Also notice that, so simplify things, the put() function doesn't use the workqueue, since the workqueue also puts runtime PM. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h4
-rw-r--r--drivers/gpu/drm/i915/intel_uncore.c40
2 files changed, 44 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 712921079c96..38be2bd5627b 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2587,6 +2587,10 @@ extern void intel_display_print_error_state(struct drm_i915_error_state_buf *e,
*/
void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv, int fw_engine);
void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine);
+void gen6_gt_force_wake_get_no_rpm(struct drm_i915_private *dev_priv,
+ int fw_engine);
+void gen6_gt_force_wake_put_no_rpm(struct drm_i915_private *dev_priv,
+ int fw_engine);
void assert_force_wake_inactive(struct drm_i915_private *dev_priv);
int sandybridge_pcode_read(struct drm_i915_private *dev_priv, u8 mbox, u32 *val);
diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
index f67884a70add..e7d899d2fa59 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -432,6 +432,46 @@ out:
intel_runtime_pm_put(dev_priv);
}
+/*
+ * These two _no_rpm functions below should only be used by the code that runs
+ * while we are enabling/disabling runtiem PM. See gen6_gt_force_wake_get().
+ */
+void gen6_gt_force_wake_get_no_rpm(struct drm_i915_private *dev_priv,
+ int fw_engine)
+{
+ unsigned long irqflags;
+
+ if (!dev_priv->uncore.funcs.force_wake_get)
+ return;
+
+ /* Redirect to VLV specific routine */
+ if (IS_VALLEYVIEW(dev_priv->dev))
+ return vlv_force_wake_get(dev_priv, fw_engine);
+
+ spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
+ if (dev_priv->uncore.forcewake_count++ == 0)
+ dev_priv->uncore.funcs.force_wake_get(dev_priv, FORCEWAKE_ALL);
+ spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
+}
+
+void gen6_gt_force_wake_put_no_rpm(struct drm_i915_private *dev_priv,
+ int fw_engine)
+{
+ unsigned long irqflags;
+
+ if (!dev_priv->uncore.funcs.force_wake_put)
+ return;
+
+ /* Redirect to VLV specific routine */
+ if (IS_VALLEYVIEW(dev_priv->dev))
+ return vlv_force_wake_put(dev_priv, fw_engine);
+
+ spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
+ if (--dev_priv->uncore.forcewake_count == 0)
+ dev_priv->uncore.funcs.force_wake_put(dev_priv, FORCEWAKE_ALL);
+ spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
+}
+
void assert_force_wake_inactive(struct drm_i915_private *dev_priv)
{
if (!dev_priv->uncore.funcs.force_wake_get)