From patchwork Thu Jan 28 19:01:20 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: 8153171 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7657B9F440 for ; Thu, 28 Jan 2016 19:01:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9B3B220328 for ; Thu, 28 Jan 2016 19:01:44 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 8AAAC202FE for ; Thu, 28 Jan 2016 19:01:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B07FE6E8E1; Thu, 28 Jan 2016 11:01:42 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id BA02A6E3BE for ; Thu, 28 Jan 2016 11:01:41 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP; 28 Jan 2016 11:01:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,359,1449561600"; d="scan'208";a="871019870" Received: from asiluver-linux.isw.intel.com ([10.102.226.117]) by orsmga001.jf.intel.com with ESMTP; 28 Jan 2016 11:01:29 -0800 From: Arun Siluvery To: intel-gfx@lists.freedesktop.org Date: Thu, 28 Jan 2016 19:01:20 +0000 Message-Id: <1454007684-16777-2-git-send-email-arun.siluvery@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1454007684-16777-1-git-send-email-arun.siluvery@linux.intel.com> References: <1454007684-16777-1-git-send-email-arun.siluvery@linux.intel.com> Subject: [Intel-gfx] [PATCH 1/5] drm/i915/error: capture execlist state on error 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.2 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 At present, execlist status/ctx_id and CSBs, not the submission queue For: VIZ-2021 Signed-off-by: Dave Gordon --- drivers/gpu/drm/i915/i915_drv.h | 9 +++++++++ drivers/gpu/drm/i915/i915_gpu_error.c | 38 +++++++++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 01cc982..8b30242 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -552,6 +552,15 @@ struct drm_i915_error_state { u32 rc_psmi; /* sleep state */ u32 semaphore_mboxes[I915_NUM_RINGS - 1]; + /* Execlists */ + u32 execlist_status; + u32 execlist_ctx_id; + u32 execlist_csb_raw_pointer; + u32 execlist_csb_write_pointer; + u32 execlist_csb_read_pointer; + u32 execlist_csb[6]; + u32 execlist_ctx[6]; + struct drm_i915_error_object { int page_count; u64 gtt_offset; diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index 978c026..bf53c2b 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c @@ -247,6 +247,7 @@ static void i915_ring_error_state(struct drm_i915_error_state_buf *m, int ring_idx) { struct drm_i915_error_ring *ring = &error->ring[ring_idx]; + int i; if (!ring->valid) return; @@ -288,7 +289,6 @@ static void i915_ring_error_state(struct drm_i915_error_state_buf *m, err_printf(m, " GFX_MODE: 0x%08x\n", ring->vm_info.gfx_mode); if (INTEL_INFO(dev)->gen >= 8) { - int i; for (i = 0; i < 4; i++) err_printf(m, " PDP%d: 0x%016llx\n", i, ring->vm_info.pdp[i]); @@ -304,6 +304,17 @@ static void i915_ring_error_state(struct drm_i915_error_state_buf *m, err_printf(m, " hangcheck: %s [%d]\n", hangcheck_action_to_str(ring->hangcheck_action), ring->hangcheck_score); + + err_printf(m, " EXECLIST_STATUS: 0x%08x\n", ring->execlist_status); + err_printf(m, " EXECLIST_CTX_ID: 0x%08x\n", ring->execlist_ctx_id); + err_printf(m, " EXECLIST_CSBPTR: 0x%08x\n", ring->execlist_csb_raw_pointer); + err_printf(m, " EXECLIST_CSB_WR: 0x%08x\n", ring->execlist_csb_write_pointer); + err_printf(m, " EXECLIST_CSB_RD: 0x%08x\n", ring->execlist_csb_read_pointer); + + for (i = 0; i < 6; i++) { + err_printf(m, " EXECLIST_CSB[%d]: 0x%08x\n", i, ring->execlist_csb[i]); + err_printf(m, " EXECLIST_CTX[%d]: 0x%08x\n", i, ring->execlist_ctx[i]); + } } void i915_error_printf(struct drm_i915_error_state_buf *e, const char *f, ...) @@ -965,8 +976,27 @@ static void i915_record_ring_state(struct drm_device *dev, I915_READ(GEN8_RING_PDP_LDW(ring, i)); } } -} + if (i915.enable_execlists) { + int i; + u32 status_pointer = I915_READ(RING_CONTEXT_STATUS_PTR(ring)); + u8 write_pointer = status_pointer & 0x07; + u8 read_pointer = ring->next_context_status_buffer; + if (read_pointer > write_pointer) + write_pointer += 6; + + ering->execlist_status = I915_READ(RING_EXECLIST_STATUS_LO(ring)); + ering->execlist_ctx_id = I915_READ(RING_EXECLIST_STATUS_HI(ring)); + ering->execlist_csb_raw_pointer = status_pointer; + ering->execlist_csb_write_pointer = write_pointer; + ering->execlist_csb_read_pointer = read_pointer; + + for (i = 0; i < 6; i++) { + ering->execlist_csb[i] = I915_READ(RING_CONTEXT_STATUS_BUF_LO(ring, i)); + ering->execlist_ctx[i] = I915_READ(RING_CONTEXT_STATUS_BUF_HI(ring, i)); + } + } +} static void i915_gem_record_active_context(struct intel_engine_cs *ring, struct drm_i915_error_state *error, @@ -1252,6 +1282,10 @@ static void i915_capture_reg_state(struct drm_i915_private *dev_priv, if (HAS_HW_CONTEXTS(dev)) error->ccid = I915_READ(CCID); + if (HAS_LOGICAL_RING_CONTEXTS(dev)) { + // Surely something to capture here ... + } + if (INTEL_INFO(dev)->gen >= 8) { error->ier = I915_READ(GEN8_DE_MISC_IER); for (i = 0; i < 4; i++)