]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/gvt: Fix drm_WARN issue where vgpu ptr is unavailable
authorTina Zhang <tina.zhang@intel.com>
Tue, 25 Feb 2020 05:35:26 +0000 (13:35 +0800)
committerZhenyu Wang <zhenyuw@linux.intel.com>
Tue, 25 Feb 2020 08:13:04 +0000 (16:13 +0800)
When vgpu ptr is unavailable, the drm_WARN* can hang the whole system
due to the drm pointer is NULL. This patch fixes this issue by using
WARN directly which won't care about the drm pointer.

Fixes: d2a8702f3fb95 ("drm/i915/gvt: Make WARN* drm specific where vgpu ptr is available")
Signed-off-by: Tina Zhang <tina.zhang@intel.com>
Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200225053527.8336-1-tina.zhang@intel.com
drivers/gpu/drm/i915/gvt/mmio_context.c

index 46c291e4926b264d63ce0d0bca0fffb9f632a30d..1213c8e23317843124dbef3902d1047add7d79c9 100644 (file)
@@ -392,7 +392,6 @@ static void handle_tlb_pending_event(struct intel_vgpu *vgpu, int ring_id)
 static void switch_mocs(struct intel_vgpu *pre, struct intel_vgpu *next,
                        int ring_id)
 {
-       struct drm_i915_private *i915 = pre->gvt->dev_priv;
        struct drm_i915_private *dev_priv;
        i915_reg_t offset, l3_offset;
        u32 old_v, new_v;
@@ -407,7 +406,7 @@ static void switch_mocs(struct intel_vgpu *pre, struct intel_vgpu *next,
        int i;
 
        dev_priv = pre ? pre->gvt->dev_priv : next->gvt->dev_priv;
-       if (drm_WARN_ON(&i915->drm, ring_id >= ARRAY_SIZE(regs)))
+       if (drm_WARN_ON(&dev_priv->drm, ring_id >= ARRAY_SIZE(regs)))
                return;
 
        if (ring_id == RCS0 && IS_GEN(dev_priv, 9))
@@ -552,10 +551,9 @@ static void switch_mmio(struct intel_vgpu *pre,
 void intel_gvt_switch_mmio(struct intel_vgpu *pre,
                           struct intel_vgpu *next, int ring_id)
 {
-       struct drm_i915_private *i915 = pre->gvt->dev_priv;
        struct drm_i915_private *dev_priv;
 
-       if (drm_WARN_ON(&i915->drm, !pre && !next))
+       if (WARN(!pre && !next, "switch ring %d from host to HOST\n", ring_id))
                return;
 
        gvt_dbg_render("switch ring %d from %s to %s\n", ring_id,