]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/gvt: Make WARN* drm specific where drm_priv ptr is available
authorPankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Thu, 20 Feb 2020 16:55:06 +0000 (22:25 +0530)
committerZhenyu Wang <zhenyuw@linux.intel.com>
Mon, 24 Feb 2020 10:13:20 +0000 (18:13 +0800)
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: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Acked-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200220165507.16823-8-pankaj.laxminarayan.bharadiya@intel.com
drivers/gpu/drm/i915/gvt/aperture_gm.c
drivers/gpu/drm/i915/gvt/cmd_parser.c
drivers/gpu/drm/i915/gvt/display.c
drivers/gpu/drm/i915/gvt/dmabuf.c
drivers/gpu/drm/i915/gvt/edid.c
drivers/gpu/drm/i915/gvt/gvt.c
drivers/gpu/drm/i915/gvt/handlers.c
drivers/gpu/drm/i915/gvt/mmio_context.c

index 771420453f8244f7670b2024e857c09e9fa9d268..29eed8400647b9f7a21f0e1959a173cda5865204 100644 (file)
@@ -134,11 +134,11 @@ void intel_vgpu_write_fence(struct intel_vgpu *vgpu,
 
        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;
 
        reg = vgpu->fence.regs[fence];
-       if (WARN_ON(!reg))
+       if (drm_WARN_ON(&dev_priv->drm, !reg))
                return;
 
        fence_reg_lo = FENCE_REG_GEN6_LO(reg->id);
@@ -167,7 +167,7 @@ static void free_vgpu_fence(struct intel_vgpu *vgpu)
        struct i915_fence_reg *reg;
        u32 i;
 
-       if (WARN_ON(!vgpu_fence_sz(vgpu)))
+       if (drm_WARN_ON(&dev_priv->drm, !vgpu_fence_sz(vgpu)))
                return;
 
        intel_runtime_pm_get(&dev_priv->runtime_pm);
index 21a176cd8acc9c591b1394d6edc285a9ae2baff7..73a2891114a41e2de4063dabe0e3f069e3d81ff5 100644 (file)
@@ -1230,7 +1230,7 @@ static int gen8_decode_mi_display_flip(struct parser_exec_state *s,
        dword2 = cmd_val(s, 2);
 
        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;
 
        info->pipe = gen8_plane_code[v].pipe;
@@ -1250,7 +1250,7 @@ static int gen8_decode_mi_display_flip(struct parser_exec_state *s,
                info->stride_reg = SPRSTRIDE(info->pipe);
                info->surf_reg = SPRSURF(info->pipe);
        } else {
-               WARN_ON(1);
+               drm_WARN_ON(&dev_priv->drm, 1);
                return -EBADRQC;
        }
        return 0;
index e1c313da6c00cfa7706d4fdd182f22cece527873..9a9329fb8d6494be75418fae56ac774e60816b2d 100644 (file)
@@ -71,7 +71,8 @@ int pipe_is_enabled(struct intel_vgpu *vgpu, int pipe)
 {
        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;
 
        if (vgpu_vreg_t(vgpu, PIPECONF(pipe)) & PIPECONF_ENABLE)
index 2477a1e5a1669cf220ccb85b062885714c100d3d..b854bd243e11efa2d416c3701cc54bc1f71b5db9 100644 (file)
@@ -67,11 +67,11 @@ static int vgpu_gem_get_pages(
        u32 page_num;
 
        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;
 
        vgpu = fb_info->obj->vgpu;
-       if (WARN_ON(!vgpu))
+       if (drm_WARN_ON(&dev_priv->drm, !vgpu))
                return -ENODEV;
 
        st = kmalloc(sizeof(*st), GFP_KERNEL);
index 1fe6124918f1bcc2a97b39e7a811548a7a611e6d..97bf75890c7d87b71e5f2cc1169c3a9e0bb93a80 100644 (file)
@@ -153,7 +153,7 @@ static int gmbus0_mmio_write(struct intel_vgpu *vgpu,
                port = cnp_get_port_from_gmbus0(pin_select);
        else
                port = get_port_from_gmbus0(pin_select);
-       if (WARN_ON(port < 0))
+       if (drm_WARN_ON(&dev_priv->drm, port < 0))
                return 0;
 
        vgpu->display.i2c_edid.state = I2C_GMBUS;
index cb5fa30b8e63d8723f8c8f892b01775bed5cf3be..87bed32f1191791ad4596c93f657bd569dc5e213 100644 (file)
@@ -265,7 +265,7 @@ void intel_gvt_clean_device(struct drm_i915_private *dev_priv)
 {
        struct intel_gvt *gvt = to_gvt(dev_priv);
 
-       if (WARN_ON(!gvt))
+       if (drm_WARN_ON(&dev_priv->drm, !gvt))
                return;
 
        intel_gvt_destroy_idle_vgpu(gvt->idle_vgpu);
@@ -304,7 +304,7 @@ int intel_gvt_init_device(struct drm_i915_private *dev_priv)
        struct intel_vgpu *vgpu;
        int ret;
 
-       if (WARN_ON(dev_priv->gvt))
+       if (drm_WARN_ON(&dev_priv->drm, dev_priv->gvt))
                return -EEXIST;
 
        gvt = kzalloc(sizeof(struct intel_gvt), GFP_KERNEL);
index ae6700dc9d73e2c61d4aeb21bee6c3b0085868f4..288572e2747357bd28e1857875996408f6450fc8 100644 (file)
@@ -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)))
                event = AUX_CHANNEL_D;
        else {
-               WARN_ON(true);
+               drm_WARN_ON(&dev_priv->drm, true);
                return -EINVAL;
        }
 
index aaf15916d29a6507c1ee416b3fc122a524d976d5..a4a1de347af07fe4ec888578b45010981e9a6fd5 100644 (file)
@@ -357,7 +357,7 @@ static void handle_tlb_pending_event(struct intel_vgpu *vgpu, int ring_id)
        if (!regs)
                return;
 
-       if (WARN_ON(ring_id >= cnt))
+       if (drm_WARN_ON(&dev_priv->drm, ring_id >= cnt))
                return;
 
        if (!test_and_clear_bit(ring_id, (void *)s->tlb_handle_pending))