[Intel-gfx] [PATCH 2/2] drm/i915: restrict unclaimed register checking
Paulo Zanoni
paulo.r.zanoni at intel.com
Tue Aug 25 15:03:42 PDT 2015
The unclaimed register bit is only triggered when someone touches the
specified register range.
For the normal use case (with i915.mmio_debug=0), this commit will
avoid the extra __raw_i915_read32() call for every register outside
the specified range, at the expense of a few additional "if"
statements.
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
---
drivers/gpu/drm/i915/intel_uncore.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
index 3fa1b89..894da40 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -596,6 +596,8 @@ void assert_forcewakes_inactive(struct drm_i915_private *dev_priv)
!FORCEWAKE_GEN9_MEDIA_RANGE_OFFSET(reg) && \
!FORCEWAKE_GEN9_COMMON_RANGE_OFFSET(reg))
+#define UNCLAIMED_CHECK_RANGE(reg) REG_RANGE(reg, 0x40000, 0xC0000)
+
static void
ilk_dummy_write(struct drm_i915_private *dev_priv)
{
@@ -612,7 +614,7 @@ hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read,
const char *op = read ? "reading" : "writing to";
const char *when = before ? "before" : "after";
- if (!i915.mmio_debug)
+ if (!i915.mmio_debug || !UNCLAIMED_CHECK_RANGE(reg))
return;
if (__raw_i915_read32(dev_priv, FPGA_DBG) & FPGA_DBG_RM_NOCLAIM) {
@@ -624,11 +626,11 @@ hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read,
}
static void
-hsw_unclaimed_reg_detect(struct drm_i915_private *dev_priv)
+hsw_unclaimed_reg_detect(struct drm_i915_private *dev_priv, u32 reg)
{
static bool mmio_debug_once = true;
- if (i915.mmio_debug || !mmio_debug_once)
+ if (i915.mmio_debug || !UNCLAIMED_CHECK_RANGE(reg) || !mmio_debug_once)
return;
if (__raw_i915_read32(dev_priv, FPGA_DBG) & FPGA_DBG_RM_NOCLAIM) {
@@ -893,7 +895,7 @@ hsw_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, bool trace)
gen6_gt_check_fifodbg(dev_priv); \
} \
hsw_unclaimed_reg_debug(dev_priv, reg, false, false); \
- hsw_unclaimed_reg_detect(dev_priv); \
+ hsw_unclaimed_reg_detect(dev_priv, reg); \
GEN6_WRITE_FOOTER; \
}
@@ -935,7 +937,7 @@ gen8_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, bool trace
__force_wake_get(dev_priv, FORCEWAKE_RENDER); \
__raw_i915_write##x(dev_priv, reg, val); \
hsw_unclaimed_reg_debug(dev_priv, reg, false, false); \
- hsw_unclaimed_reg_detect(dev_priv); \
+ hsw_unclaimed_reg_detect(dev_priv, reg); \
GEN6_WRITE_FOOTER; \
}
@@ -1001,7 +1003,7 @@ gen9_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, \
__force_wake_get(dev_priv, fw_engine); \
__raw_i915_write##x(dev_priv, reg, val); \
hsw_unclaimed_reg_debug(dev_priv, reg, false, false); \
- hsw_unclaimed_reg_detect(dev_priv); \
+ hsw_unclaimed_reg_detect(dev_priv, reg); \
GEN6_WRITE_FOOTER; \
}
--
2.5.0
More information about the Intel-gfx
mailing list