[Intel-gfx] [PATCH v2] drm/i915: Catch non-existent registers in find_fw_domain

Chris Wilson chris at chris-wilson.co.uk
Wed Dec 7 18:28:07 UTC 2016


On Wed, Dec 07, 2016 at 06:18:02PM +0000, Tvrtko Ursulin wrote:
> 
> On 07/12/2016 14:22, Joonas Lahtinen wrote:
> >Add WARN_ON to find_fw_domain to registers related to uninitialized
> >hardware.
> >
> >v2:
> >- Print the uninitialized domains and register (Chris)
> >
> >Cc: Imre Deak <imre.deak at intel.com>
> >Cc: Wang Elaine <elaine.wang at intel.com>
> >Cc: Chris Wilson <chris at chris-wilson.co.uk>
> >Signed-off-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> >---
> > drivers/gpu/drm/i915/intel_uncore.c | 9 ++++++++-
> > 1 file changed, 8 insertions(+), 1 deletion(-)
> >
> >diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
> >index 07779d0..88f3611 100644
> >--- a/drivers/gpu/drm/i915/intel_uncore.c
> >+++ b/drivers/gpu/drm/i915/intel_uncore.c
> >@@ -625,7 +625,14 @@ find_fw_domain(struct drm_i915_private *dev_priv, u32 offset)
> > 			dev_priv->uncore.fw_domains_table_entries,
> > 			fw_range_cmp);
> >
> >-	return entry ? entry->domains : 0;
> >+	if (!entry)
> >+		return 0;
> >+
> >+	WARN(entry->domains & ~dev_priv->uncore.fw_domains,
> >+	     "Uninitialized forcewake domain(s) 0x%x accessed at 0x%x\n",
> >+	     entry->domains & ~dev_priv->uncore.fw_domains, offset);
> >+
> >+	return entry->domains;
> > }
> >
> > static void
> >
> 
> Only slight issues I can spot is that for some platforms, should it
> trigger, it would trigger twice since
> intel_uncore_forcewake_for_read/write functions have the same WARN.

I don't think that's too much of an issue whilst both are WARN() - we
are likely to get a flood of hits if we get any.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list