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

Chris Wilson chris at chris-wilson.co.uk
Wed Dec 7 14:01:49 UTC 2016


On Wed, Dec 07, 2016 at 03:49:39PM +0200, Joonas Lahtinen wrote:
> Add WARN_ON to find_fw_domain to registers related to uninitialized
> hardware.
> 
> 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 | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
> index 07779d0..b20b58e 100644
> --- a/drivers/gpu/drm/i915/intel_uncore.c
> +++ b/drivers/gpu/drm/i915/intel_uncore.c
> @@ -625,7 +625,12 @@ 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_ON(entry->domains & ~dev_priv->uncore.fw_domains);

Ok, this is going to be hard to diagnose in the wild, how about

WARN(entry->domains & ~fw_domains,
"Attempting to use register 0x%04x from uninitialised fw domain %x\n",
offset, entry->domains & ~fw_domains); ?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list