public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ben Widawsky <benjamin.widawsky@linux.intel.com>
To: Intel GFX <intel-gfx@lists.freedesktop.org>
Cc: "Mika Kuoppala" <mika.kuoppala@linux.intel.com>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	stable@vger.kernel.org
Subject: [PATCH 01/12] drm/i915: Fix forcewake counts for gen8
Date: Fri, 21 Mar 2014 11:48:10 -0700	[thread overview]
Message-ID: <1395427701-13434-2-git-send-email-benjamin.widawsky@linux.intel.com> (raw)
In-Reply-To: <1395427701-13434-1-git-send-email-benjamin.widawsky@linux.intel.com>

From: Mika Kuoppala <mika.kuoppala@linux.intel.com>

Sometimes generic driver code gets forcewake explicitly by
gen6_gt_force_wake_get(), which check forcewake_count before accessing
hardware. However the register access with gen8_write function access
low level hw accessors directly, ignoring the forcewake_count. This
leads to nested forcewake get from hardware, in ring init and possibly
elsewhere, causing forcewake ack clear errors and/or hangs.

Fix this by checking the forcewake count also in gen8_write

v2: Read side doesn't care about shadowed registers,
    Remove __needs_put funkiness from gen8_write. (Ville)
    Improved commit message.

References: https://bugs.freedesktop.org/show_bug.cgi?id=74007
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
[BDW 3.14 backport]
Cc: stable@vger.kernel.org
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/intel_uncore.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
index 87df68f..6df5ec4 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -634,16 +634,17 @@ static bool is_gen8_shadowed(struct drm_i915_private *dev_priv, u32 reg)
 #define __gen8_write(x) \
 static void \
 gen8_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, bool trace) { \
-	bool __needs_put = reg < 0x40000 && !is_gen8_shadowed(dev_priv, reg); \
 	REG_WRITE_HEADER; \
-	if (__needs_put) { \
-		dev_priv->uncore.funcs.force_wake_get(dev_priv, \
-							FORCEWAKE_ALL); \
-	} \
-	__raw_i915_write##x(dev_priv, reg, val); \
-	if (__needs_put) { \
-		dev_priv->uncore.funcs.force_wake_put(dev_priv, \
-							FORCEWAKE_ALL); \
+	if (reg < 0x40000 && !is_gen8_shadowed(dev_priv, reg)) { \
+		if (dev_priv->uncore.forcewake_count == 0) \
+			dev_priv->uncore.funcs.force_wake_get(dev_priv,	\
+							      FORCEWAKE_ALL); \
+		__raw_i915_write##x(dev_priv, reg, val); \
+		if (dev_priv->uncore.forcewake_count == 0) \
+			dev_priv->uncore.funcs.force_wake_put(dev_priv, \
+							      FORCEWAKE_ALL); \
+	} else { \
+		__raw_i915_write##x(dev_priv, reg, val); \
 	} \
 	REG_WRITE_FOOTER; \
 }
-- 
1.9.1

  reply	other threads:[~2014-03-21 18:48 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-21 18:48 [PATCH 00/12] Broadwell 3.14 backports Ben Widawsky
2014-03-21 18:48 ` Ben Widawsky [this message]
2014-03-21 18:48 ` [PATCH 02/12] drm/i915: Do forcewake reset on gen8 Ben Widawsky
2014-03-21 18:48 ` [PATCH 03/12] drm/i915: Disable semaphore wait event idle message on BDW Ben Widawsky
2014-03-21 18:48 ` [PATCH 04/12] drm/i915: Implement WaDisableSDEUnitClockGating:bdw Ben Widawsky
2014-03-21 18:48 ` [PATCH 05/12] drm/i915: We implement WaDisableAsyncFlipPerfMode:bdw Ben Widawsky
2014-03-21 18:48 ` [PATCH 06/12] drm/i915: Add a partial instruction shootdown workaround on Broadwell Ben Widawsky
2014-03-21 18:48 ` [PATCH 07/12] drm/i915: Add thread stall DOP clock gating " Ben Widawsky
2014-03-21 18:48 ` [PATCH 08/12] drm/i915/bdw: The TLB invalidation mechanism has been removed from INSTPM Ben Widawsky
2014-03-21 18:48 ` [PATCH 09/12] drm/i915: Don't clobber CHICKEN_PIPESL_1 on BDW Ben Widawsky
2014-03-21 18:48 ` [PATCH 10/12] drm/i915: don't flood the logs about bdw semaphores Ben Widawsky
2014-03-21 22:06   ` [PATCH 10/12] [v2] " Ben Widawsky
2014-03-21 18:48 ` [PATCH 11/12] drm/i915/bdw: Use scratch page table for GEN8 PPGTT Ben Widawsky
2014-03-21 18:48 ` [PATCH 12/12] drm/i915/bdw: Restore PPAT on thaw Ben Widawsky
2014-03-21 19:49 ` [PATCH 00/12] Broadwell 3.14 backports Daniel Vetter
2014-03-21 22:14   ` Ben Widawsky
2014-03-21 23:47     ` Greg KH
2014-03-22  0:06       ` Ben Widawsky
2014-03-22  0:17         ` Ben Widawsky
2014-03-22 11:29           ` Daniel Vetter
2014-03-22  0:51 ` Ben Widawsky
2014-03-22 11:34   ` Daniel Vetter
2014-03-24 23:14     ` Ausmus, James
2014-03-24 23:17       ` Ben Widawsky
2014-03-25  9:43         ` 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=1395427701-13434-2-git-send-email-benjamin.widawsky@linux.intel.com \
    --to=benjamin.widawsky@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mika.kuoppala@linux.intel.com \
    --cc=stable@vger.kernel.org \
    --cc=ville.syrjala@linux.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