public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH 07/23] drm/i915: add forcewake functions that don't touch runtime PM
Date: Thu, 27 Feb 2014 19:26:34 -0300	[thread overview]
Message-ID: <1393540010-1582-8-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <1393540010-1582-1-git-send-email-przanoni@gmail.com>

From: Paulo Zanoni <paulo.r.zanoni@intel.com>

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>
---
 drivers/gpu/drm/i915/i915_drv.h     |  4 ++++
 drivers/gpu/drm/i915/intel_uncore.c | 40 +++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 2a2a3a9..dcaa130 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2604,6 +2604,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);
 
 int sandybridge_pcode_read(struct drm_i915_private *dev_priv, u8 mbox, u32 *val);
 int sandybridge_pcode_write(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 6a21f43..d0ec32a 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -422,6 +422,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);
+}
+
 /* We give fast paths for the really cool registers */
 #define NEEDS_FORCE_WAKE(dev_priv, reg) \
 	 ((reg) < 0x40000 && (reg) != FORCEWAKE)
-- 
1.8.5.3

  parent reply	other threads:[~2014-02-27 22:27 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-27 22:26 [PATCH 00/23] Merge PC8 with runtime PM, v2 Paulo Zanoni
2014-02-27 22:26 ` [PATCH 01/23] drm/i915: Accurately track when we mark the hardware as idle/busy Paulo Zanoni
2014-02-27 22:26 ` [PATCH 02/23] drm/i915: put runtime PM only at the end of intel_mark_idle Paulo Zanoni
2014-02-27 22:26 ` [PATCH 03/23] drm/i915: put runtime PM only when we actually release force_wake Paulo Zanoni
2014-02-27 22:26 ` [PATCH 04/23] drm/i915: kill dev_priv->pc8.gpu_idle Paulo Zanoni
2014-02-28 15:23   ` Imre Deak
2014-02-27 22:26 ` [PATCH 05/23] drm/i915: rename modeset_update_power_wells Paulo Zanoni
2014-02-27 22:26 ` [PATCH 06/23] drm/i915: get/put runtime PM without holding rps.hw_lock Paulo Zanoni
2014-02-27 22:26 ` Paulo Zanoni [this message]
2014-02-28  8:44   ` [PATCH 07/23] drm/i915: add forcewake functions that don't touch runtime PM Chris Wilson
2014-02-28 19:38     ` Paulo Zanoni
2014-02-28 19:46       ` Chris Wilson
2014-03-05 16:56   ` Daniel Vetter
2014-02-27 22:26 ` [PATCH 08/23] drm/i915: extract __hsw_do_{en, dis}able_package_c8 Paulo Zanoni
2014-02-27 22:26 ` [PATCH 09/23] drm/i915: make PC8 be part of runtime PM suspend/resume Paulo Zanoni
2014-02-28  9:42   ` Chris Wilson
2014-03-06 22:48     ` Daniel Vetter
2014-02-27 22:26 ` [PATCH 10/23] drm/i915: get/put runtime PM when we get/put a power domain Paulo Zanoni
2014-02-28 15:45   ` Imre Deak
2014-02-28 19:54     ` Paulo Zanoni
2014-02-27 22:26 ` [PATCH 11/23] drm/i915: remove dev_priv->pc8.requirements_met Paulo Zanoni
2014-02-27 22:26 ` [PATCH 12/23] drm/i915: get runtime PM references when the GPU is idle/busy Paulo Zanoni
2014-02-28 17:08   ` Jesse Barnes
2014-02-27 22:26 ` [PATCH 13/23] drm/i915: kill pc8.disable_count Paulo Zanoni
2014-02-28 17:10   ` Jesse Barnes
2014-02-27 22:26 ` [PATCH 14/23] drm/i915: remove an indirection level on PC8 functions Paulo Zanoni
2014-02-28 17:11   ` Jesse Barnes
2014-02-27 22:26 ` [PATCH 15/23] drm/i915: don't get/put PC8 reference on freeze/thaw Paulo Zanoni
2014-02-28 17:11   ` Jesse Barnes
2014-02-27 22:26 ` [PATCH 16/23] drm/i915: get/put runtime PM references for GMBUS and DP AUX Paulo Zanoni
2014-02-28 17:13   ` Jesse Barnes
2014-02-28 17:38     ` Imre Deak
2014-02-28 17:55       ` Jesse Barnes
2014-02-28 18:20         ` Imre Deak
2014-02-28 19:07           ` Paulo Zanoni
2014-03-05 17:04         ` Daniel Vetter
2014-02-27 22:26 ` [PATCH 17/23] drm/i915: don't get/put PC8 when getting/putting power wells Paulo Zanoni
2014-02-28 17:13   ` Jesse Barnes
2014-02-27 22:26 ` [PATCH 18/23] drm/i915: remove dev_priv->pc8.enabled Paulo Zanoni
2014-02-28 17:14   ` Jesse Barnes
2014-02-27 22:26 ` [PATCH 19/23] drm/i915: move pc8.irqs_disabled to pm.irqs_disabled Paulo Zanoni
2014-02-28 17:15   ` Jesse Barnes
2014-02-28 18:17     ` Paulo Zanoni
2014-02-27 22:26 ` [PATCH 20/23] drm/i915: kill struct i915_package_c8 Paulo Zanoni
2014-02-28 17:16   ` Jesse Barnes
2014-02-27 22:26 ` [PATCH 21/23] drm/i915: rename __hsw_do_{en, dis}able_pc8 Paulo Zanoni
2014-02-28 17:17   ` Jesse Barnes
2014-02-27 22:26 ` [PATCH 22/23] drm/i915: update the PC8 and runtime PM documentation Paulo Zanoni
2014-02-28 17:19   ` Jesse Barnes
2014-02-27 22:26 ` [PATCH 23/23] drm/i915: init pm.suspended earlier Paulo Zanoni
2014-02-28 17:20   ` Jesse Barnes
2014-03-05 17:09 ` [PATCH 00/23] Merge PC8 with runtime PM, v2 Daniel Vetter
2014-03-06 22:23   ` Paulo Zanoni
2014-03-06 22:45     ` Daniel Vetter
2014-03-07  8:51       ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1393540010-1582-8-git-send-email-przanoni@gmail.com \
    --to=przanoni@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox