drm/i915/tdr: Initialize hangcheck struct for each engine
authorTomas Elf <tomas.elf@intel.com>
Mon, 21 Mar 2016 16:26:59 +0000 (16:26 +0000)
committerMika Kuoppala <mika.kuoppala@intel.com>
Tue, 22 Mar 2016 11:52:42 +0000 (13:52 +0200)
Initialize hangcheck struct during driver load. Since we do the same after
recovering from a reset, this is extracted into a helper function.

v2: remove redundant hangcheck init during load as this is done when
engines are initialized (Chris)

Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Tomas Elf <tomas.elf@intel.com>
Signed-off-by: Arun Siluvery <arun.siluvery@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1458577619-12006-1-git-send-email-arun.siluvery@linux.intel.com
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_lrc.c
drivers/gpu/drm/i915/intel_ringbuffer.c

index 050d860115f120d91c256adaf9be76e410d78dc4..56eb5f0d9f388173b43910a2b37afee83ff29481 100644 (file)
@@ -2740,6 +2740,7 @@ extern long i915_compat_ioctl(struct file *filp, unsigned int cmd,
 extern int intel_gpu_reset(struct drm_device *dev, u32 engine_mask);
 extern bool intel_has_gpu_reset(struct drm_device *dev);
 extern int i915_reset(struct drm_device *dev);
+extern void intel_engine_init_hangcheck(struct intel_engine_cs *engine);
 extern unsigned long i915_chipset_val(struct drm_i915_private *dev_priv);
 extern unsigned long i915_mch_val(struct drm_i915_private *dev_priv);
 extern unsigned long i915_gfx_val(struct drm_i915_private *dev_priv);
index 3a23b9549f7bc2115a3e246262a1df31f5467184..40ef4eaf580f9e0bf89572edd5904409d22e3e3d 100644 (file)
@@ -1606,7 +1606,7 @@ static int gen8_init_common_ring(struct intel_engine_cs *engine)
        engine->next_context_status_buffer = next_context_status_buffer_hw;
        DRM_DEBUG_DRIVER("Execlists enabled for %s\n", engine->name);
 
-       memset(&engine->hangcheck, 0, sizeof(engine->hangcheck));
+       intel_engine_init_hangcheck(engine);
 
        return 0;
 }
index df0ef5bba8e573f5b28c8a763939d5cbe6a30045..ce59850f7e73bb8e0a6ab0ff0aed12b6406749ae 100644 (file)
@@ -555,6 +555,11 @@ static bool stop_ring(struct intel_engine_cs *engine)
        return (I915_READ_HEAD(engine) & HEAD_ADDR) == 0;
 }
 
+void intel_engine_init_hangcheck(struct intel_engine_cs *engine)
+{
+       memset(&engine->hangcheck, 0, sizeof(engine->hangcheck));
+}
+
 static int init_ring_common(struct intel_engine_cs *engine)
 {
        struct drm_device *dev = engine->dev;
@@ -634,7 +639,7 @@ static int init_ring_common(struct intel_engine_cs *engine)
        ringbuf->tail = I915_READ_TAIL(engine) & TAIL_ADDR;
        intel_ring_update_space(ringbuf);
 
-       memset(&engine->hangcheck, 0, sizeof(engine->hangcheck));
+       intel_engine_init_hangcheck(engine);
 
 out:
        intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);