@@ -2400,6 +2400,19 @@ static void i915_gem_reset_ring_cleanup(struct drm_i915_private *dev_priv,
i915_gem_free_request(request);
}
+ if (dev_priv->lrc_enabled) {
+ while (!list_empty(&ring->execlist_queue)) {
+ struct drm_i915_gem_request *request;
+
+ request = list_first_entry(&ring->execlist_queue,
+ struct drm_i915_gem_request,
+ execlist_link);
+ list_del(&request->execlist_link);
+ i915_gem_context_unreference(request->ctx);
+ kfree(request);
+ }
+ }
+
/* These may not have been flush before the reset, do so now */
kfree(ring->preallocated_lazy_request);
ring->preallocated_lazy_request = NULL;
@@ -700,17 +700,9 @@ int gen8_gem_context_init(struct drm_device *dev)
goto err_out;
}
- for_each_ring(ring, dev_priv, ring_id) {
+ for_each_ring(ring, dev_priv, ring_id)
ring->default_context = ctx;
- I915_WRITE(RING_MODE_GEN7(ring),
- _MASKED_BIT_DISABLE(GFX_REPLAY_MODE) |
- _MASKED_BIT_ENABLE(GFX_RUN_LIST_ENABLE));
- POSTING_READ(RING_MODE_GEN7(ring));
- DRM_DEBUG_DRIVER("Execlists enabled for %s\n",
- ring->name);
- }
-
DRM_DEBUG_DRIVER("LR context support initialized\n");
return 0;
@@ -573,6 +573,14 @@ static int init_ring_common_lrc(struct intel_engine *ring)
struct drm_device *dev = ring->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
+ I915_WRITE(RING_MODE_GEN7(ring),
+ _MASKED_BIT_DISABLE(GFX_REPLAY_MODE) |
+ _MASKED_BIT_ENABLE(GFX_RUN_LIST_ENABLE));
+ POSTING_READ(RING_MODE_GEN7(ring));
+ DRM_DEBUG_DRIVER("Execlists enabled for %s\n", ring->name);
+
+ memset(&ring->hangcheck, 0, sizeof(ring->hangcheck));
+
I915_WRITE_IMR(ring, ~(ring->irq_enable_mask | ring->irq_keep_mask));
I915_WRITE(RING_HWSTAM(ring->mmio_base), 0xffffffff);