Skip to content

Commit a8bb49b

Browse files
TinaZhangZWzhenyw
authored andcommitted
drm/i915/gvt: Fix drm_WARN issue where vgpu ptr is unavailable
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: 12d5861 ("drm/i915/gvt: Make WARN* drm specific where vgpu ptr is available") Signed-off-by: Tina Zhang <[email protected]> Reviewed-by: Zhenyu Wang <[email protected]> Signed-off-by: Zhenyu Wang <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 12d5861 commit a8bb49b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/gpu/drm/i915/gvt/mmio_context.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,6 @@ static void handle_tlb_pending_event(struct intel_vgpu *vgpu, int ring_id)
392392
static void switch_mocs(struct intel_vgpu *pre, struct intel_vgpu *next,
393393
int ring_id)
394394
{
395-
struct drm_i915_private *i915 = pre->gvt->dev_priv;
396395
struct drm_i915_private *dev_priv;
397396
i915_reg_t offset, l3_offset;
398397
u32 old_v, new_v;
@@ -407,7 +406,7 @@ static void switch_mocs(struct intel_vgpu *pre, struct intel_vgpu *next,
407406
int i;
408407

409408
dev_priv = pre ? pre->gvt->dev_priv : next->gvt->dev_priv;
410-
if (drm_WARN_ON(&i915->drm, ring_id >= ARRAY_SIZE(regs)))
409+
if (drm_WARN_ON(&dev_priv->drm, ring_id >= ARRAY_SIZE(regs)))
411410
return;
412411

413412
if (ring_id == RCS0 && IS_GEN(dev_priv, 9))
@@ -552,10 +551,9 @@ static void switch_mmio(struct intel_vgpu *pre,
552551
void intel_gvt_switch_mmio(struct intel_vgpu *pre,
553552
struct intel_vgpu *next, int ring_id)
554553
{
555-
struct drm_i915_private *i915 = pre->gvt->dev_priv;
556554
struct drm_i915_private *dev_priv;
557555

558-
if (drm_WARN_ON(&i915->drm, !pre && !next))
556+
if (WARN(!pre && !next, "switch ring %d from host to HOST\n", ring_id))
559557
return;
560558

561559
gvt_dbg_render("switch ring %d from %s to %s\n", ring_id,

0 commit comments

Comments
 (0)