[PATCH 12/20] drm/i915: Augment i915 error state to include the dump of GuC log buffer

akash.goel at intel.com akash.goel at intel.com
Sun Aug 7 03:59:26 UTC 2016


From: Akash Goel <akash.goel at intel.com>

Added the dump of GuC log buffer to i915 error state, as the contents of
GuC log buffer would also be useful to determine that why the GPU reset
was triggered.

Suggested-by: Chris Wilson <chris at chris-wilson.co.uk>
Signed-off-by: Akash Goel <akash.goel at intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h       |  1 +
 drivers/gpu/drm/i915/i915_gpu_error.c | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index fec6285..e00b929 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -509,6 +509,7 @@ struct drm_i915_error_state {
 	struct intel_overlay_error_state *overlay;
 	struct intel_display_error_state *display;
 	struct drm_i915_error_object *semaphore_obj;
+	struct drm_i915_error_object *guc_log_obj;
 
 	struct drm_i915_error_engine {
 		int engine_id;
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index eecb870..561b523 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -546,6 +546,21 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
 		}
 	}
 
+	if ((obj = error->guc_log_obj)) {
+		err_printf(m, "GuC log buffer = 0x%08x\n",
+			   lower_32_bits(obj->gtt_offset));
+		for (i = 0; i < obj->page_count; i++) {
+			for (elt = 0; elt < PAGE_SIZE/4; elt += 4) {
+				err_printf(m, "[%08x] %08x %08x %08x %08x\n",
+					   (u32)(i*PAGE_SIZE) + elt*4,
+					   obj->pages[i][elt],
+					   obj->pages[i][elt+1],
+					   obj->pages[i][elt+2],
+					   obj->pages[i][elt+3]);
+			}
+		}
+	}
+
 	if (error->overlay)
 		intel_overlay_print_error_state(m, error->overlay);
 
@@ -625,6 +640,7 @@ static void i915_error_state_free(struct kref *error_ref)
 	}
 
 	i915_error_object_free(error->semaphore_obj);
+	i915_error_object_free(error->guc_log_obj);
 
 	for (i = 0; i < error->vm_count; i++)
 		kfree(error->active_bo[i]);
@@ -1210,6 +1226,16 @@ static void i915_gem_record_rings(struct drm_i915_private *dev_priv,
 	}
 }
 
+static void i915_gem_capture_guc_log_buffer(struct drm_i915_private *dev_priv,
+				     struct drm_i915_error_state *error)
+{
+	if (!dev_priv->guc.log.obj)
+		return;
+
+	error->guc_log_obj = i915_error_ggtt_object_create(dev_priv,
+						dev_priv->guc.log.obj);
+}
+
 /* FIXME: Since pin count/bound list is global, we duplicate what we capture per
  * VM.
  */
@@ -1439,6 +1465,7 @@ void i915_capture_error_state(struct drm_i915_private *dev_priv,
 	i915_gem_capture_buffers(dev_priv, error);
 	i915_gem_record_fences(dev_priv, error);
 	i915_gem_record_rings(dev_priv, error);
+	i915_gem_capture_guc_log_buffer(dev_priv, error);
 
 	do_gettimeofday(&error->time);
 
-- 
1.9.2



More information about the Intel-gfx-trybot mailing list