Commit 0d4c351a authored by Pankaj Bharadiya's avatar Pankaj Bharadiya Committed by Jani Nikula

drm/i915/gt: Make WARN* drm specific where drm_priv ptr is available

drm specific WARN* calls include device information in the
backtrace, so we know what device the warnings originate from.

Covert all the calls of WARN* with device specific drm_WARN*
variants in functions where drm_i915_private struct pointer is readily
available.

The conversion was done automatically with below coccinelle semantic
patch. checkpatch errors/warnings are fixed manually.

@rule1@
identifier func, T;
@@
func(...) {
...
struct drm_i915_private *T = ...;
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}

@rule2@
identifier func, T;
@@
func(struct drm_i915_private *T,...) {
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}

command: spatch --sp-file <script> --dir drivers/gpu/drm/i915/gt \
					--linux-spacing --in-place
Signed-off-by: default avatarPankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200115034455.17658-7-pankaj.laxminarayan.bharadiya@intel.com
parent 85c823ac
...@@ -448,8 +448,8 @@ int intel_engines_init_mmio(struct intel_gt *gt) ...@@ -448,8 +448,8 @@ int intel_engines_init_mmio(struct intel_gt *gt)
unsigned int i; unsigned int i;
int err; int err;
WARN_ON(engine_mask == 0); drm_WARN_ON(&i915->drm, engine_mask == 0);
WARN_ON(engine_mask & drm_WARN_ON(&i915->drm, engine_mask &
GENMASK(BITS_PER_TYPE(mask) - 1, I915_NUM_ENGINES)); GENMASK(BITS_PER_TYPE(mask) - 1, I915_NUM_ENGINES));
if (i915_inject_probe_failure(i915)) if (i915_inject_probe_failure(i915))
...@@ -471,7 +471,7 @@ int intel_engines_init_mmio(struct intel_gt *gt) ...@@ -471,7 +471,7 @@ int intel_engines_init_mmio(struct intel_gt *gt)
* are added to the driver by a warning and disabling the forgotten * are added to the driver by a warning and disabling the forgotten
* engines. * engines.
*/ */
if (WARN_ON(mask != engine_mask)) if (drm_WARN_ON(&i915->drm, mask != engine_mask))
device_info->engine_mask = mask; device_info->engine_mask = mask;
RUNTIME_INFO(i915)->num_engines = hweight32(mask); RUNTIME_INFO(i915)->num_engines = hweight32(mask);
......
...@@ -278,7 +278,8 @@ void intel_engines_driver_register(struct drm_i915_private *i915) ...@@ -278,7 +278,8 @@ void intel_engines_driver_register(struct drm_i915_private *i915)
} }
} }
if (WARN(errors, "Invalid UABI engine mapping found")) if (drm_WARN(&i915->drm, errors,
"Invalid UABI engine mapping found"))
i915->uabi_engines = RB_ROOT; i915->uabi_engines = RB_ROOT;
} }
......
...@@ -448,7 +448,7 @@ void gtt_write_workarounds(struct intel_gt *gt) ...@@ -448,7 +448,7 @@ void gtt_write_workarounds(struct intel_gt *gt)
intel_uncore_write(uncore, intel_uncore_write(uncore,
HSW_GTT_CACHE_EN, HSW_GTT_CACHE_EN,
can_use_gtt_cache ? GTT_CACHE_EN_ALL : 0); can_use_gtt_cache ? GTT_CACHE_EN_ALL : 0);
WARN_ON_ONCE(can_use_gtt_cache && drm_WARN_ON_ONCE(&i915->drm, can_use_gtt_cache &&
intel_uncore_read(uncore, intel_uncore_read(uncore,
HSW_GTT_CACHE_EN) == 0); HSW_GTT_CACHE_EN) == 0);
} }
......
...@@ -300,7 +300,7 @@ static bool get_mocs_settings(const struct drm_i915_private *i915, ...@@ -300,7 +300,7 @@ static bool get_mocs_settings(const struct drm_i915_private *i915,
table->n_entries = GEN9_NUM_MOCS_ENTRIES; table->n_entries = GEN9_NUM_MOCS_ENTRIES;
table->table = broxton_mocs_table; table->table = broxton_mocs_table;
} else { } else {
WARN_ONCE(INTEL_GEN(i915) >= 9, drm_WARN_ONCE(&i915->drm, INTEL_GEN(i915) >= 9,
"Platform that should have a MOCS table does not.\n"); "Platform that should have a MOCS table does not.\n");
return false; return false;
} }
......
...@@ -715,7 +715,7 @@ u64 intel_rc6_residency_ns(struct intel_rc6 *rc6, const i915_reg_t reg) ...@@ -715,7 +715,7 @@ u64 intel_rc6_residency_ns(struct intel_rc6 *rc6, const i915_reg_t reg)
*/ */
i = (i915_mmio_reg_offset(reg) - i = (i915_mmio_reg_offset(reg) -
i915_mmio_reg_offset(GEN6_GT_GFX_RC6_LOCKED)) / sizeof(u32); i915_mmio_reg_offset(GEN6_GT_GFX_RC6_LOCKED)) / sizeof(u32);
if (WARN_ON_ONCE(i >= ARRAY_SIZE(rc6->cur_residency))) if (drm_WARN_ON_ONCE(&i915->drm, i >= ARRAY_SIZE(rc6->cur_residency)))
return 0; return 0;
fw_domains = intel_uncore_forcewake_for_reg(uncore, reg, FW_REG_READ); fw_domains = intel_uncore_forcewake_for_reg(uncore, reg, FW_REG_READ);
......
...@@ -568,7 +568,8 @@ static void flush_cs_tlb(struct intel_engine_cs *engine) ...@@ -568,7 +568,8 @@ static void flush_cs_tlb(struct intel_engine_cs *engine)
return; return;
/* ring should be idle before issuing a sync flush*/ /* ring should be idle before issuing a sync flush*/
WARN_ON((ENGINE_READ(engine, RING_MI_MODE) & MODE_IDLE) == 0); drm_WARN_ON(&dev_priv->drm,
(ENGINE_READ(engine, RING_MI_MODE) & MODE_IDLE) == 0);
ENGINE_WRITE(engine, RING_INSTPM, ENGINE_WRITE(engine, RING_INSTPM,
_MASKED_BIT_ENABLE(INSTPM_TLB_INVALIDATE | _MASKED_BIT_ENABLE(INSTPM_TLB_INVALIDATE |
...@@ -1787,7 +1788,7 @@ static void ring_release(struct intel_engine_cs *engine) ...@@ -1787,7 +1788,7 @@ static void ring_release(struct intel_engine_cs *engine)
{ {
struct drm_i915_private *dev_priv = engine->i915; struct drm_i915_private *dev_priv = engine->i915;
WARN_ON(INTEL_GEN(dev_priv) > 2 && drm_WARN_ON(&dev_priv->drm, INTEL_GEN(dev_priv) > 2 &&
(ENGINE_READ(engine, RING_MI_MODE) & MODE_IDLE) == 0); (ENGINE_READ(engine, RING_MI_MODE) & MODE_IDLE) == 0);
intel_engine_cleanup_common(engine); intel_engine_cleanup_common(engine);
......
...@@ -1026,7 +1026,8 @@ static bool chv_rps_enable(struct intel_rps *rps) ...@@ -1026,7 +1026,8 @@ static bool chv_rps_enable(struct intel_rps *rps)
vlv_punit_put(i915); vlv_punit_put(i915);
/* RPS code assumes GPLL is used */ /* RPS code assumes GPLL is used */
WARN_ONCE((val & GPLLENABLE) == 0, "GPLL not enabled\n"); drm_WARN_ONCE(&i915->drm, (val & GPLLENABLE) == 0,
"GPLL not enabled\n");
DRM_DEBUG_DRIVER("GPLL enabled? %s\n", yesno(val & GPLLENABLE)); DRM_DEBUG_DRIVER("GPLL enabled? %s\n", yesno(val & GPLLENABLE));
DRM_DEBUG_DRIVER("GPU status: 0x%08x\n", val); DRM_DEBUG_DRIVER("GPU status: 0x%08x\n", val);
...@@ -1123,7 +1124,8 @@ static bool vlv_rps_enable(struct intel_rps *rps) ...@@ -1123,7 +1124,8 @@ static bool vlv_rps_enable(struct intel_rps *rps)
vlv_punit_put(i915); vlv_punit_put(i915);
/* RPS code assumes GPLL is used */ /* RPS code assumes GPLL is used */
WARN_ONCE((val & GPLLENABLE) == 0, "GPLL not enabled\n"); drm_WARN_ONCE(&i915->drm, (val & GPLLENABLE) == 0,
"GPLL not enabled\n");
DRM_DEBUG_DRIVER("GPLL enabled? %s\n", yesno(val & GPLLENABLE)); DRM_DEBUG_DRIVER("GPLL enabled? %s\n", yesno(val & GPLLENABLE));
DRM_DEBUG_DRIVER("GPU status: 0x%08x\n", val); DRM_DEBUG_DRIVER("GPU status: 0x%08x\n", val);
...@@ -1191,11 +1193,11 @@ void intel_rps_enable(struct intel_rps *rps) ...@@ -1191,11 +1193,11 @@ void intel_rps_enable(struct intel_rps *rps)
if (!rps->enabled) if (!rps->enabled)
return; return;
WARN_ON(rps->max_freq < rps->min_freq); drm_WARN_ON(&i915->drm, rps->max_freq < rps->min_freq);
WARN_ON(rps->idle_freq > rps->max_freq); drm_WARN_ON(&i915->drm, rps->idle_freq > rps->max_freq);
WARN_ON(rps->efficient_freq < rps->min_freq); drm_WARN_ON(&i915->drm, rps->efficient_freq < rps->min_freq);
WARN_ON(rps->efficient_freq > rps->max_freq); drm_WARN_ON(&i915->drm, rps->efficient_freq > rps->max_freq);
} }
static void gen6_rps_disable(struct intel_rps *rps) static void gen6_rps_disable(struct intel_rps *rps)
...@@ -1390,8 +1392,8 @@ static void chv_rps_init(struct intel_rps *rps) ...@@ -1390,8 +1392,8 @@ static void chv_rps_init(struct intel_rps *rps)
BIT(VLV_IOSF_SB_NC) | BIT(VLV_IOSF_SB_NC) |
BIT(VLV_IOSF_SB_CCK)); BIT(VLV_IOSF_SB_CCK));
WARN_ONCE((rps->max_freq | rps->efficient_freq | rps->rp1_freq | drm_WARN_ONCE(&i915->drm, (rps->max_freq | rps->efficient_freq |
rps->min_freq) & 1, rps->rp1_freq | rps->min_freq) & 1,
"Odd GPU freq values\n"); "Odd GPU freq values\n");
} }
......
...@@ -827,7 +827,7 @@ wa_init_mcr(struct drm_i915_private *i915, struct i915_wa_list *wal) ...@@ -827,7 +827,7 @@ wa_init_mcr(struct drm_i915_private *i915, struct i915_wa_list *wal)
DRM_WARN("No common index found between subslice mask %x and L3 bank mask %x!\n", DRM_WARN("No common index found between subslice mask %x and L3 bank mask %x!\n",
intel_sseu_get_subslices(sseu, slice), l3_en); intel_sseu_get_subslices(sseu, slice), l3_en);
subslice = fls(l3_en); subslice = fls(l3_en);
WARN_ON(!subslice); drm_WARN_ON(&i915->drm, !subslice);
} }
subslice--; subslice--;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment