From patchwork Wed Feb 10 15:50:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: arun.siluvery@linux.intel.com X-Patchwork-Id: 8272981 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C652CBEEED for ; Wed, 10 Feb 2016 15:50:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CB62220270 for ; Wed, 10 Feb 2016 15:50:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A3B67203E3 for ; Wed, 10 Feb 2016 15:50:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 42B506E722; Wed, 10 Feb 2016 07:50:28 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTP id 7D41E6E71F for ; Wed, 10 Feb 2016 07:50:27 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP; 10 Feb 2016 07:50:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,426,1449561600"; d="scan'208";a="45646781" Received: from asiluver-linux.isw.intel.com ([10.102.226.117]) by fmsmga004.fm.intel.com with ESMTP; 10 Feb 2016 07:50:26 -0800 From: Arun Siluvery To: intel-gfx@lists.freedesktop.org Date: Wed, 10 Feb 2016 15:50:09 +0000 Message-Id: <1455119410-17283-9-git-send-email-arun.siluvery@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1455119410-17283-1-git-send-email-arun.siluvery@linux.intel.com> References: <1455119410-17283-1-git-send-email-arun.siluvery@linux.intel.com> Cc: Mika Kuoppala Subject: [Intel-gfx] [PATCH v2 8/9] drm/i915/error: add GuC state error capture & decode X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dave Gordon For: VIZ-2021 Signed-off-by: Dave Gordon Signed-off-by: Arun Siluvery --- drivers/gpu/drm/i915/i915_drv.h | 4 ++ drivers/gpu/drm/i915/i915_gpu_error.c | 107 ++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index ed991bf..f7808d3 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -611,6 +611,10 @@ struct drm_i915_error_state { u32 *active_bo_count, *pinned_bo_count; u32 vm_count; + + struct intel_guc guc; + struct i915_guc_client execbuf_client; + struct i915_guc_client preempt_client; }; struct intel_connector; diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index 03485ca..f426538 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c @@ -361,6 +361,96 @@ static void i915_ring_error_state(struct drm_i915_error_state_buf *m, } } +static void i915_guc_firmware_info(struct drm_i915_error_state_buf *m, + struct drm_i915_private *dev_priv, + struct intel_guc_fw *guc_fw) +{ + err_printf(m, "GuC firmware status:\n"); + err_printf(m, "\tpath: %s\n", + guc_fw->guc_fw_path); + err_printf(m, "\tfetch: %s\n", + intel_guc_fw_status_repr(guc_fw->guc_fw_fetch_status)); + err_printf(m, "\tload: %s\n", + intel_guc_fw_status_repr(guc_fw->guc_fw_load_status)); + err_printf(m, "\tversion wanted: %d.%d\n", + guc_fw->guc_fw_major_wanted, guc_fw->guc_fw_minor_wanted); + err_printf(m, "\tversion found: %d.%d\n", + guc_fw->guc_fw_major_found, guc_fw->guc_fw_minor_found); +} + +static void i915_guc_action_info(struct drm_i915_error_state_buf *m, + struct drm_i915_private *dev_priv, + struct intel_guc *guc) +{ + struct intel_engine_cs *ring; + u64 total = 0; + int i; + + err_printf(m, "GuC action status:\n"); + err_printf(m, "\ttotal action count: %llu\n", guc->action_count); + err_printf(m, "\tlast action command: 0x%x\n", guc->action_cmd); + err_printf(m, "\tlast action status: 0x%x\n", guc->action_status); + + err_printf(m, "\taction failure count: %u\n", guc->action_fail_count); + err_printf(m, "\tlast failed action: 0x%x\n", guc->action_fail_cmd); + err_printf(m, "\tlast failed status: 0x%x\n", guc->action_fail_status); + err_printf(m, "\tlast error code: %d\n", guc->action_err); + + err_printf(m, "GuC submissions:\n"); + for_each_ring(ring, dev_priv, i) { + err_printf(m, "\t%-24s: %10llu, last %-8s 0x%08x %9d\n", + ring->name, guc->submissions[i], "seqno", + guc->last_seqno[i], guc->last_seqno[i]); + total += guc->submissions[i]; + } + err_printf(m, "\t%s: %10llu\n", "Total regular", total); +} + +static void i915_guc_client_info(struct drm_i915_error_state_buf *m, + struct drm_i915_private *dev_priv, + struct i915_guc_client *client) +{ + struct intel_engine_cs *ring; + uint64_t tot = 0; + uint32_t i; + + err_printf(m, "\tPriority %d, GuC ctx index: %u, PD offset 0x%x\n", + client->priority, client->ctx_index, client->proc_desc_offset); + err_printf(m, "\tDoorbell id %d, offset: 0x%x, cookie 0x%x\n", + client->doorbell_id, client->doorbell_offset, client->cookie); + err_printf(m, "\tWQ size %d, offset: 0x%x, tail %d\n", + client->wq_size, client->wq_offset, client->wq_tail); + + err_printf(m, "\tFailed to queue: %u\n", client->q_fail); + err_printf(m, "\tFailed doorbell: %u\n", client->b_fail); + err_printf(m, "\tLast submission result: %d\n", client->retcode); + + for_each_ring(ring, dev_priv, i) { + err_printf(m, "\tSubmissions: %llu %s\n", + client->submissions[i], + ring->name); + tot += client->submissions[i]; + } + err_printf(m, "\tTotal: %llu\n", tot); +} + +static void i915_guc_error_state(struct drm_i915_error_state_buf *m, + struct drm_i915_private *dev_priv, + struct drm_i915_error_state *error) +{ + struct intel_guc *guc; + + if (!i915.enable_guc_submission) + return; + + guc = &error->guc; + i915_guc_firmware_info(m, dev_priv, &guc->guc_fw); + i915_guc_action_info(m, dev_priv, guc); + + err_printf(m, "GuC execbuf client @ %p:\n", guc->execbuf_client); + i915_guc_client_info(m, dev_priv, &error->execbuf_client); +} + void i915_error_printf(struct drm_i915_error_state_buf *e, const char *f, ...) { va_list args; @@ -470,6 +560,9 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m, if (INTEL_INFO(dev)->gen == 7) err_printf(m, "ERR_INT: 0x%08x\n", error->err_int); + if (HAS_GUC_UCODE(dev) || HAS_GUC_SCHED(dev)) + i915_guc_error_state(m, dev_priv, error); + for (i = 0; i < ARRAY_SIZE(error->ring); i++) i915_ring_error_state(m, dev, error, i); @@ -1382,6 +1475,19 @@ static void i915_capture_reg_state(struct drm_i915_private *dev_priv, i915_get_extra_instdone(dev, error->extra_instdone); } +/* Capture information about GuC loading and submission, where enabled */ +static void i915_capture_guc_state(struct drm_i915_private *dev_priv, + struct drm_i915_error_state *error) +{ + if (!i915.enable_guc_submission) + return; + + /* Just copy the state of the device for now */ + error->guc = dev_priv->guc; + if (error->guc.execbuf_client) + error->execbuf_client = *error->guc.execbuf_client; +} + static void i915_error_capture_msg(struct drm_device *dev, struct drm_i915_error_state *error, bool wedged, @@ -1449,6 +1555,7 @@ void i915_capture_error_state(struct drm_device *dev, bool wedged, i915_capture_gen_state(dev_priv, error); i915_capture_reg_state(dev_priv, error); + i915_capture_guc_state(dev_priv, error); i915_gem_capture_buffers(dev_priv, error); i915_gem_record_fences(dev, error); i915_gem_record_rings(dev, error);