diff options
author | Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com> | 2020-01-15 04:44:53 +0100 |
---|---|---|
committer | Jani Nikula <jani.nikula@intel.com> | 2020-01-22 16:54:33 +0100 |
commit | 48a1b8d4af01abd38e51cef205a0f2c4deeb092a (patch) | |
tree | aa3cba994843f69b4cc872f1fe8c25798f6700cd /drivers/gpu/drm/i915/i915_irq.c | |
parent | drm/i915/gt: Make WARN* drm specific where drm_priv ptr is available (diff) | |
download | linux-48a1b8d4af01abd38e51cef205a0f2c4deeb092a.tar.xz linux-48a1b8d4af01abd38e51cef205a0f2c4deeb092a.zip |
drm/i915: 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: ls drivers/gpu/drm/i915/*.c | xargs spatch --sp-file \
<script> --linux-spacing --in-place
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200115034455.17658-10-pankaj.laxminarayan.bharadiya@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/i915_irq.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_irq.c | 75 |
1 files changed, 40 insertions, 35 deletions
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index afc6aad9bf8c..4b53d776bf7e 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c @@ -262,7 +262,7 @@ i915_hotplug_interrupt_update_locked(struct drm_i915_private *dev_priv, u32 val; lockdep_assert_held(&dev_priv->irq_lock); - WARN_ON(bits & ~mask); + drm_WARN_ON(&dev_priv->drm, bits & ~mask); val = I915_READ(PORT_HOTPLUG_EN); val &= ~mask; @@ -305,9 +305,9 @@ void ilk_update_display_irq(struct drm_i915_private *dev_priv, lockdep_assert_held(&dev_priv->irq_lock); - WARN_ON(enabled_irq_mask & ~interrupt_mask); + drm_WARN_ON(&dev_priv->drm, enabled_irq_mask & ~interrupt_mask); - if (WARN_ON(!intel_irqs_enabled(dev_priv))) + if (drm_WARN_ON(&dev_priv->drm, !intel_irqs_enabled(dev_priv))) return; new_val = dev_priv->irq_mask; @@ -336,9 +336,9 @@ static void bdw_update_port_irq(struct drm_i915_private *dev_priv, lockdep_assert_held(&dev_priv->irq_lock); - WARN_ON(enabled_irq_mask & ~interrupt_mask); + drm_WARN_ON(&dev_priv->drm, enabled_irq_mask & ~interrupt_mask); - if (WARN_ON(!intel_irqs_enabled(dev_priv))) + if (drm_WARN_ON(&dev_priv->drm, !intel_irqs_enabled(dev_priv))) return; old_val = I915_READ(GEN8_DE_PORT_IMR); @@ -369,9 +369,9 @@ void bdw_update_pipe_irq(struct drm_i915_private *dev_priv, lockdep_assert_held(&dev_priv->irq_lock); - WARN_ON(enabled_irq_mask & ~interrupt_mask); + drm_WARN_ON(&dev_priv->drm, enabled_irq_mask & ~interrupt_mask); - if (WARN_ON(!intel_irqs_enabled(dev_priv))) + if (drm_WARN_ON(&dev_priv->drm, !intel_irqs_enabled(dev_priv))) return; new_val = dev_priv->de_irq_mask[pipe]; @@ -399,11 +399,11 @@ void ibx_display_interrupt_update(struct drm_i915_private *dev_priv, sdeimr &= ~interrupt_mask; sdeimr |= (~enabled_irq_mask & interrupt_mask); - WARN_ON(enabled_irq_mask & ~interrupt_mask); + drm_WARN_ON(&dev_priv->drm, enabled_irq_mask & ~interrupt_mask); lockdep_assert_held(&dev_priv->irq_lock); - if (WARN_ON(!intel_irqs_enabled(dev_priv))) + if (drm_WARN_ON(&dev_priv->drm, !intel_irqs_enabled(dev_priv))) return; I915_WRITE(SDEIMR, sdeimr); @@ -425,13 +425,15 @@ u32 i915_pipestat_enable_mask(struct drm_i915_private *dev_priv, * On pipe A we don't support the PSR interrupt yet, * on pipe B and C the same bit MBZ. */ - if (WARN_ON_ONCE(status_mask & PIPE_A_PSR_STATUS_VLV)) + if (drm_WARN_ON_ONCE(&dev_priv->drm, + status_mask & PIPE_A_PSR_STATUS_VLV)) return 0; /* * On pipe B and C we don't support the PSR interrupt yet, on pipe * A the same bit is for perf counters which we don't use either. */ - if (WARN_ON_ONCE(status_mask & PIPE_B_PSR_STATUS_VLV)) + if (drm_WARN_ON_ONCE(&dev_priv->drm, + status_mask & PIPE_B_PSR_STATUS_VLV)) return 0; enable_mask &= ~(PIPE_FIFO_UNDERRUN_STATUS | @@ -443,10 +445,11 @@ u32 i915_pipestat_enable_mask(struct drm_i915_private *dev_priv, enable_mask |= SPRITE1_FLIP_DONE_INT_EN_VLV; out: - WARN_ONCE(enable_mask & ~PIPESTAT_INT_ENABLE_MASK || - status_mask & ~PIPESTAT_INT_STATUS_MASK, - "pipe %c: enable_mask=0x%x, status_mask=0x%x\n", - pipe_name(pipe), enable_mask, status_mask); + drm_WARN_ONCE(&dev_priv->drm, + enable_mask & ~PIPESTAT_INT_ENABLE_MASK || + status_mask & ~PIPESTAT_INT_STATUS_MASK, + "pipe %c: enable_mask=0x%x, status_mask=0x%x\n", + pipe_name(pipe), enable_mask, status_mask); return enable_mask; } @@ -457,12 +460,12 @@ void i915_enable_pipestat(struct drm_i915_private *dev_priv, i915_reg_t reg = PIPESTAT(pipe); u32 enable_mask; - WARN_ONCE(status_mask & ~PIPESTAT_INT_STATUS_MASK, - "pipe %c: status_mask=0x%x\n", - pipe_name(pipe), status_mask); + drm_WARN_ONCE(&dev_priv->drm, status_mask & ~PIPESTAT_INT_STATUS_MASK, + "pipe %c: status_mask=0x%x\n", + pipe_name(pipe), status_mask); lockdep_assert_held(&dev_priv->irq_lock); - WARN_ON(!intel_irqs_enabled(dev_priv)); + drm_WARN_ON(&dev_priv->drm, !intel_irqs_enabled(dev_priv)); if ((dev_priv->pipestat_irq_mask[pipe] & status_mask) == status_mask) return; @@ -480,12 +483,12 @@ void i915_disable_pipestat(struct drm_i915_private *dev_priv, i915_reg_t reg = PIPESTAT(pipe); u32 enable_mask; - WARN_ONCE(status_mask & ~PIPESTAT_INT_STATUS_MASK, - "pipe %c: status_mask=0x%x\n", - pipe_name(pipe), status_mask); + drm_WARN_ONCE(&dev_priv->drm, status_mask & ~PIPESTAT_INT_STATUS_MASK, + "pipe %c: status_mask=0x%x\n", + pipe_name(pipe), status_mask); lockdep_assert_held(&dev_priv->irq_lock); - WARN_ON(!intel_irqs_enabled(dev_priv)); + drm_WARN_ON(&dev_priv->drm, !intel_irqs_enabled(dev_priv)); if ((dev_priv->pipestat_irq_mask[pipe] & status_mask) == 0) return; @@ -777,7 +780,7 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index, IS_G4X(dev_priv) || IS_GEN(dev_priv, 2) || mode->private_flags & I915_MODE_FLAG_USE_SCANLINE_COUNTER; - if (WARN_ON(!mode->crtc_clock)) { + if (drm_WARN_ON(&dev_priv->drm, !mode->crtc_clock)) { DRM_DEBUG_DRIVER("trying to get scanoutpos for disabled " "pipe %c\n", pipe_name(pipe)); return false; @@ -918,7 +921,7 @@ static void ivb_parity_work(struct work_struct *work) mutex_lock(&dev_priv->drm.struct_mutex); /* If we've screwed up tracking, just let the interrupt fire again */ - if (WARN_ON(!dev_priv->l3_parity.which_slice)) + if (drm_WARN_ON(&dev_priv->drm, !dev_priv->l3_parity.which_slice)) goto out; misccpctl = I915_READ(GEN7_MISCCPCTL); @@ -929,7 +932,8 @@ static void ivb_parity_work(struct work_struct *work) i915_reg_t reg; slice--; - if (WARN_ON_ONCE(slice >= NUM_L3_SLICES(dev_priv))) + if (drm_WARN_ON_ONCE(&dev_priv->drm, + slice >= NUM_L3_SLICES(dev_priv))) break; dev_priv->l3_parity.which_slice &= ~(1<<slice); @@ -966,7 +970,7 @@ static void ivb_parity_work(struct work_struct *work) I915_WRITE(GEN7_MISCCPCTL, misccpctl); out: - WARN_ON(dev_priv->l3_parity.which_slice); + drm_WARN_ON(&dev_priv->drm, dev_priv->l3_parity.which_slice); spin_lock_irq(>->irq_lock); gen5_gt_enable_irq(gt, GT_PARITY_ERROR(dev_priv)); spin_unlock_irq(>->irq_lock); @@ -1463,9 +1467,9 @@ static u32 i9xx_hpd_irq_ack(struct drm_i915_private *dev_priv) I915_WRITE(PORT_HOTPLUG_STAT, hotplug_status); } - WARN_ONCE(1, - "PORT_HOTPLUG_STAT did not clear (0x%08x)\n", - I915_READ(PORT_HOTPLUG_STAT)); + drm_WARN_ONCE(&dev_priv->drm, 1, + "PORT_HOTPLUG_STAT did not clear (0x%08x)\n", + I915_READ(PORT_HOTPLUG_STAT)); return hotplug_status; } @@ -1844,8 +1848,9 @@ static void icp_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir) tc_port_hotplug_long_detect = icp_tc_port_hotplug_long_detect; pins = hpd_icp; } else { - WARN(!HAS_PCH_ICP(dev_priv), - "Unrecognized PCH type 0x%x\n", INTEL_PCH_TYPE(dev_priv)); + drm_WARN(&dev_priv->drm, !HAS_PCH_ICP(dev_priv), + "Unrecognized PCH type 0x%x\n", + INTEL_PCH_TYPE(dev_priv)); ddi_hotplug_trigger = pch_iir & SDE_DDI_MASK_ICP; tc_hotplug_trigger = pch_iir & SDE_TC_MASK_ICP; @@ -2686,7 +2691,7 @@ static void ibx_irq_pre_postinstall(struct drm_i915_private *dev_priv) if (HAS_PCH_NOP(dev_priv)) return; - WARN_ON(I915_READ(SDEIER) != 0); + drm_WARN_ON(&dev_priv->drm, I915_READ(SDEIER) != 0); I915_WRITE(SDEIER, 0xffffffff); POSTING_READ(SDEIER); } @@ -2733,7 +2738,7 @@ static void vlv_display_irq_postinstall(struct drm_i915_private *dev_priv) enable_mask |= I915_DISPLAY_PIPE_C_EVENT_INTERRUPT | I915_LPE_PIPE_C_INTERRUPT; - WARN_ON(dev_priv->irq_mask != ~0u); + drm_WARN_ON(&dev_priv->drm, dev_priv->irq_mask != ~0u); dev_priv->irq_mask = ~enable_mask; @@ -3418,7 +3423,7 @@ static void icp_irq_postinstall(struct drm_i915_private *dev_priv) { u32 mask = SDE_GMBUS_ICP; - WARN_ON(I915_READ(SDEIER) != 0); + drm_WARN_ON(&dev_priv->drm, I915_READ(SDEIER) != 0); I915_WRITE(SDEIER, 0xffffffff); POSTING_READ(SDEIER); |