intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] drm/i915: Consolidate unclaimed mmio detection
@ 2015-12-15 14:25 Mika Kuoppala
  2015-12-15 14:25 ` [PATCH 2/7] drm/i915: Introduce intel_uncore_unclaimed_mmio Mika Kuoppala
                   ` (7 more replies)
  0 siblings, 8 replies; 23+ messages in thread
From: Mika Kuoppala @ 2015-12-15 14:25 UTC (permalink / raw)
  To: intel-gfx

Access the unclaimed reg detection register through
one helper which also does cleanup. Note that we now access
the register only if the platform has the actual non claimed
access bit. This prevents reading the register with gens that
doesn't have the register or the unclaimed bit,
when debug_mmio > 0.

Note that we post after clearing the bit. This makes sure
that the next unclaimed write access would get detected
also if it happened right after clearing, and not fold
into the previous detection.

v2: s/unclaimed_reg_access/check_for_unclaimed_mmio (Chris)
    debug log on unclaimed detection on uncore init (Joonas)

Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Paulo Zanoni <przanoni@gmail.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
 drivers/gpu/drm/i915/intel_uncore.c | 38 +++++++++++++++++++++++++------------
 1 file changed, 26 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
index fcf04fe..95e7803 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -334,13 +334,34 @@ static void intel_uncore_ellc_detect(struct drm_device *dev)
 	}
 }
 
+static bool
+check_for_unclaimed_mmio(struct drm_i915_private *dev_priv)
+{
+	u32 dbg;
+
+	if (!HAS_FPGA_DBG_UNCLAIMED(dev_priv))
+		return false;
+
+	dbg = __raw_i915_read32(dev_priv, FPGA_DBG);
+	if (likely(!(dbg & FPGA_DBG_RM_NOCLAIM)))
+		return false;
+
+	__raw_i915_write32(dev_priv, FPGA_DBG, FPGA_DBG_RM_NOCLAIM);
+
+	/* We want to clear it asap, so post */
+	__raw_i915_read32(dev_priv, FPGA_DBG);
+
+	return true;
+}
+
 static void __intel_uncore_early_sanitize(struct drm_device *dev,
 					  bool restore_forcewake)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (HAS_FPGA_DBG_UNCLAIMED(dev))
-		__raw_i915_write32(dev_priv, FPGA_DBG, FPGA_DBG_RM_NOCLAIM);
+	/* clear out unclaimed reg detection bit */
+	if (check_for_unclaimed_mmio(dev_priv))
+		DRM_DEBUG("unclaimed mmio detected on uncore init, clearing\n");
 
 	/* clear out old GT FIFO errors */
 	if (IS_GEN6(dev) || IS_GEN7(dev))
@@ -601,10 +622,9 @@ hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv,
 	if (!i915.mmio_debug)
 		return;
 
-	if (__raw_i915_read32(dev_priv, FPGA_DBG) & FPGA_DBG_RM_NOCLAIM) {
+	if (check_for_unclaimed_mmio(dev_priv)) {
 		WARN(1, "Unclaimed register detected %s %s register 0x%x\n",
 		     when, op, i915_mmio_reg_offset(reg));
-		__raw_i915_write32(dev_priv, FPGA_DBG, FPGA_DBG_RM_NOCLAIM);
 		i915.mmio_debug--; /* Only report the first N failures */
 	}
 }
@@ -617,11 +637,10 @@ hsw_unclaimed_reg_detect(struct drm_i915_private *dev_priv)
 	if (i915.mmio_debug || !mmio_debug_once)
 		return;
 
-	if (__raw_i915_read32(dev_priv, FPGA_DBG) & FPGA_DBG_RM_NOCLAIM) {
+	if (check_for_unclaimed_mmio(dev_priv)) {
 		DRM_DEBUG("Unclaimed register detected, "
 			  "enabling oneshot unclaimed register reporting. "
 			  "Please use i915.mmio_debug=N for more information.\n");
-		__raw_i915_write32(dev_priv, FPGA_DBG, FPGA_DBG_RM_NOCLAIM);
 		i915.mmio_debug = mmio_debug_once--;
 	}
 }
@@ -1589,11 +1608,6 @@ bool intel_has_gpu_reset(struct drm_device *dev)
 
 void intel_uncore_check_errors(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
-
-	if (HAS_FPGA_DBG_UNCLAIMED(dev) &&
-	    (__raw_i915_read32(dev_priv, FPGA_DBG) & FPGA_DBG_RM_NOCLAIM)) {
+	if (check_for_unclaimed_mmio(to_i915(dev)))
 		DRM_ERROR("Unclaimed register before interrupt\n");
-		__raw_i915_write32(dev_priv, FPGA_DBG, FPGA_DBG_RM_NOCLAIM);
-	}
 }
-- 
2.5.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2016-01-08 15:01 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-15 14:25 [PATCH 1/7] drm/i915: Consolidate unclaimed mmio detection Mika Kuoppala
2015-12-15 14:25 ` [PATCH 2/7] drm/i915: Introduce intel_uncore_unclaimed_mmio Mika Kuoppala
2015-12-15 14:46   ` Ville Syrjälä
2015-12-15 15:02     ` Mika Kuoppala
2015-12-15 14:25 ` [PATCH 3/7] drm/i915: Detect and clear unclaimed access on resume Mika Kuoppala
2015-12-15 14:25 ` [PATCH 4/7] drm/i915: Do one shot unclaimed mmio detection less frequently Mika Kuoppala
2015-12-15 14:49   ` Chris Wilson
2015-12-15 14:50   ` Ville Syrjälä
2015-12-16  7:26   ` Mika Kuoppala
2015-12-15 14:25 ` [PATCH 5/7] drm/i915: Streamline unclaimed reg debug trace Mika Kuoppala
2015-12-15 14:25 ` [PATCH 6/7] drm/i915: Add unclaimed mmio check to runtime pm get/put Mika Kuoppala
2015-12-15 14:33   ` Chris Wilson
2015-12-15 14:25 ` [PATCH 7/7] drm/i915/chv: Add non claimed mmio checking Mika Kuoppala
2015-12-15 14:44   ` Ville Syrjälä
2015-12-15 14:56     ` Ville Syrjälä
2015-12-15 14:59     ` Mika Kuoppala
2015-12-15 17:45   ` [PATCH 7/7] drm/i915: Add non claimed mmio checking for vlv/chv Mika Kuoppala
2015-12-15 17:55     ` Ville Syrjälä
2016-01-08 14:59       ` Mika Kuoppala
2015-12-15 14:38 ` [PATCH 1/7] drm/i915: Consolidate unclaimed mmio detection Chris Wilson
2015-12-15 14:40   ` Mika Kuoppala
2016-01-08 14:58   ` Mika Kuoppala
2015-12-15 17:24 ` Mika Kuoppala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).