Commit db19c724 authored by Pankaj Bharadiya's avatar Pankaj Bharadiya Committed by Zhenyu Wang

drm/i915/gvt: 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,
...)
)
...+>
}
Signed-off-by: default avatarPankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Acked-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200220165507.16823-8-pankaj.laxminarayan.bharadiya@intel.com
parent 06d63c48
...@@ -134,11 +134,11 @@ void intel_vgpu_write_fence(struct intel_vgpu *vgpu, ...@@ -134,11 +134,11 @@ void intel_vgpu_write_fence(struct intel_vgpu *vgpu,
assert_rpm_wakelock_held(&dev_priv->runtime_pm); assert_rpm_wakelock_held(&dev_priv->runtime_pm);
if (WARN_ON(fence >= vgpu_fence_sz(vgpu))) if (drm_WARN_ON(&dev_priv->drm, fence >= vgpu_fence_sz(vgpu)))
return; return;
reg = vgpu->fence.regs[fence]; reg = vgpu->fence.regs[fence];
if (WARN_ON(!reg)) if (drm_WARN_ON(&dev_priv->drm, !reg))
return; return;
fence_reg_lo = FENCE_REG_GEN6_LO(reg->id); fence_reg_lo = FENCE_REG_GEN6_LO(reg->id);
...@@ -167,7 +167,7 @@ static void free_vgpu_fence(struct intel_vgpu *vgpu) ...@@ -167,7 +167,7 @@ static void free_vgpu_fence(struct intel_vgpu *vgpu)
struct i915_fence_reg *reg; struct i915_fence_reg *reg;
u32 i; u32 i;
if (WARN_ON(!vgpu_fence_sz(vgpu))) if (drm_WARN_ON(&dev_priv->drm, !vgpu_fence_sz(vgpu)))
return; return;
intel_runtime_pm_get(&dev_priv->runtime_pm); intel_runtime_pm_get(&dev_priv->runtime_pm);
......
...@@ -1230,7 +1230,7 @@ static int gen8_decode_mi_display_flip(struct parser_exec_state *s, ...@@ -1230,7 +1230,7 @@ static int gen8_decode_mi_display_flip(struct parser_exec_state *s,
dword2 = cmd_val(s, 2); dword2 = cmd_val(s, 2);
v = (dword0 & GENMASK(21, 19)) >> 19; v = (dword0 & GENMASK(21, 19)) >> 19;
if (WARN_ON(v >= ARRAY_SIZE(gen8_plane_code))) if (drm_WARN_ON(&dev_priv->drm, v >= ARRAY_SIZE(gen8_plane_code)))
return -EBADRQC; return -EBADRQC;
info->pipe = gen8_plane_code[v].pipe; info->pipe = gen8_plane_code[v].pipe;
...@@ -1250,7 +1250,7 @@ static int gen8_decode_mi_display_flip(struct parser_exec_state *s, ...@@ -1250,7 +1250,7 @@ static int gen8_decode_mi_display_flip(struct parser_exec_state *s,
info->stride_reg = SPRSTRIDE(info->pipe); info->stride_reg = SPRSTRIDE(info->pipe);
info->surf_reg = SPRSURF(info->pipe); info->surf_reg = SPRSURF(info->pipe);
} else { } else {
WARN_ON(1); drm_WARN_ON(&dev_priv->drm, 1);
return -EBADRQC; return -EBADRQC;
} }
return 0; return 0;
......
...@@ -71,7 +71,8 @@ int pipe_is_enabled(struct intel_vgpu *vgpu, int pipe) ...@@ -71,7 +71,8 @@ int pipe_is_enabled(struct intel_vgpu *vgpu, int pipe)
{ {
struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv;
if (WARN_ON(pipe < PIPE_A || pipe >= I915_MAX_PIPES)) if (drm_WARN_ON(&dev_priv->drm,
pipe < PIPE_A || pipe >= I915_MAX_PIPES))
return -EINVAL; return -EINVAL;
if (vgpu_vreg_t(vgpu, PIPECONF(pipe)) & PIPECONF_ENABLE) if (vgpu_vreg_t(vgpu, PIPECONF(pipe)) & PIPECONF_ENABLE)
......
...@@ -67,11 +67,11 @@ static int vgpu_gem_get_pages( ...@@ -67,11 +67,11 @@ static int vgpu_gem_get_pages(
u32 page_num; u32 page_num;
fb_info = (struct intel_vgpu_fb_info *)obj->gvt_info; fb_info = (struct intel_vgpu_fb_info *)obj->gvt_info;
if (WARN_ON(!fb_info)) if (drm_WARN_ON(&dev_priv->drm, !fb_info))
return -ENODEV; return -ENODEV;
vgpu = fb_info->obj->vgpu; vgpu = fb_info->obj->vgpu;
if (WARN_ON(!vgpu)) if (drm_WARN_ON(&dev_priv->drm, !vgpu))
return -ENODEV; return -ENODEV;
st = kmalloc(sizeof(*st), GFP_KERNEL); st = kmalloc(sizeof(*st), GFP_KERNEL);
......
...@@ -153,7 +153,7 @@ static int gmbus0_mmio_write(struct intel_vgpu *vgpu, ...@@ -153,7 +153,7 @@ static int gmbus0_mmio_write(struct intel_vgpu *vgpu,
port = cnp_get_port_from_gmbus0(pin_select); port = cnp_get_port_from_gmbus0(pin_select);
else else
port = get_port_from_gmbus0(pin_select); port = get_port_from_gmbus0(pin_select);
if (WARN_ON(port < 0)) if (drm_WARN_ON(&dev_priv->drm, port < 0))
return 0; return 0;
vgpu->display.i2c_edid.state = I2C_GMBUS; vgpu->display.i2c_edid.state = I2C_GMBUS;
......
...@@ -265,7 +265,7 @@ void intel_gvt_clean_device(struct drm_i915_private *dev_priv) ...@@ -265,7 +265,7 @@ void intel_gvt_clean_device(struct drm_i915_private *dev_priv)
{ {
struct intel_gvt *gvt = to_gvt(dev_priv); struct intel_gvt *gvt = to_gvt(dev_priv);
if (WARN_ON(!gvt)) if (drm_WARN_ON(&dev_priv->drm, !gvt))
return; return;
intel_gvt_destroy_idle_vgpu(gvt->idle_vgpu); intel_gvt_destroy_idle_vgpu(gvt->idle_vgpu);
...@@ -304,7 +304,7 @@ int intel_gvt_init_device(struct drm_i915_private *dev_priv) ...@@ -304,7 +304,7 @@ int intel_gvt_init_device(struct drm_i915_private *dev_priv)
struct intel_vgpu *vgpu; struct intel_vgpu *vgpu;
int ret; int ret;
if (WARN_ON(dev_priv->gvt)) if (drm_WARN_ON(&dev_priv->drm, dev_priv->gvt))
return -EEXIST; return -EEXIST;
gvt = kzalloc(sizeof(struct intel_gvt), GFP_KERNEL); gvt = kzalloc(sizeof(struct intel_gvt), GFP_KERNEL);
......
...@@ -836,7 +836,7 @@ static int trigger_aux_channel_interrupt(struct intel_vgpu *vgpu, ...@@ -836,7 +836,7 @@ static int trigger_aux_channel_interrupt(struct intel_vgpu *vgpu,
reg == i915_mmio_reg_offset(DP_AUX_CH_CTL(AUX_CH_D))) reg == i915_mmio_reg_offset(DP_AUX_CH_CTL(AUX_CH_D)))
event = AUX_CHANNEL_D; event = AUX_CHANNEL_D;
else { else {
WARN_ON(true); drm_WARN_ON(&dev_priv->drm, true);
return -EINVAL; return -EINVAL;
} }
......
...@@ -357,7 +357,7 @@ static void handle_tlb_pending_event(struct intel_vgpu *vgpu, int ring_id) ...@@ -357,7 +357,7 @@ static void handle_tlb_pending_event(struct intel_vgpu *vgpu, int ring_id)
if (!regs) if (!regs)
return; return;
if (WARN_ON(ring_id >= cnt)) if (drm_WARN_ON(&dev_priv->drm, ring_id >= cnt))
return; return;
if (!test_and_clear_bit(ring_id, (void *)s->tlb_handle_pending)) if (!test_and_clear_bit(ring_id, (void *)s->tlb_handle_pending))
......
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