drm/i915/gvt: Fix shadow context descriptor
authorZhenyu Wang <zhenyuw@linux.intel.com>
Mon, 13 Feb 2017 09:07:19 +0000 (17:07 +0800)
committerZhenyu Wang <zhenyuw@linux.intel.com>
Tue, 14 Feb 2017 09:03:42 +0000 (17:03 +0800)
We need to be careful to only update addr mode for gvt shadow context
descriptor but keep other valid config. This fixes GPU hang caused by
invalid descriptor submitted for gvt workload.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
drivers/gpu/drm/i915/gvt/scheduler.c

index 3fbcd9d..d6b6d0e 100644 (file)
@@ -169,7 +169,8 @@ static int dispatch_workload(struct intel_vgpu_workload *workload)
        gvt_dbg_sched("ring id %d prepare to dispatch workload %p\n",
                ring_id, workload);
 
-       shadow_ctx->desc_template = workload->ctx_desc.addressing_mode <<
+       shadow_ctx->desc_template &= ~(0x3 << GEN8_CTX_ADDRESSING_MODE_SHIFT);
+       shadow_ctx->desc_template |= workload->ctx_desc.addressing_mode <<
                                    GEN8_CTX_ADDRESSING_MODE_SHIFT;
 
        mutex_lock(&dev_priv->drm.struct_mutex);