From patchwork Fri Jul 12 14:02:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kuoppala X-Patchwork-Id: 2826973 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2EBDCC0AB2 for ; Fri, 12 Jul 2013 14:02:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 03375201B3 for ; Fri, 12 Jul 2013 14:02:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 66918201B7 for ; Fri, 12 Jul 2013 14:02:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6137BE60B3 for ; Fri, 12 Jul 2013 07:02:50 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id 2D650E5EF3 for ; Fri, 12 Jul 2013 07:02:34 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 12 Jul 2013 07:04:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.89,653,1367996400"; d="scan'208";a="369253384" Received: from rosetta.fi.intel.com (HELO rosetta) ([10.237.72.67]) by fmsmga002.fm.intel.com with ESMTP; 12 Jul 2013 07:02:05 -0700 Received: by rosetta (Postfix, from userid 1000) id 209708007A; Fri, 12 Jul 2013 17:02:06 +0300 (EEST) From: Mika Kuoppala To: intel-gfx@lists.freedesktop.org Date: Fri, 12 Jul 2013 17:02:04 +0300 Message-Id: <1373637724-19407-1-git-send-email-mika.kuoppala@intel.com> X-Mailer: git-send-email 1.7.9.5 Cc: miku@iki.fi Subject: [Intel-gfx] [PATCH] tools/inter_error_decode: decode for ctl and acthd X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.5 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 Signed-off-by: Mika Kuoppala --- tools/intel_error_decode.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/tools/intel_error_decode.c b/tools/intel_error_decode.c index 434c13a..b3d7efb 100644 --- a/tools/intel_error_decode.c +++ b/tools/intel_error_decode.c @@ -62,6 +62,31 @@ print_head(unsigned int reg) return reg & (0x7ffff<<2); } +static uint32_t +print_ctl(unsigned int reg) +{ + uint32_t ring_length = (((reg & (0x1ff << 12)) >> 12) + 1) * 4096; + +#define BIT_STR(reg, x, on, off) ((1 << (x)) & reg) ? on : off + + printf(" len=%d%s%s%s\n", ring_length, + BIT_STR(reg, 0, ", enabled", ", disabled"), + BIT_STR(reg, 10, ", semaphore wait ", ""), + BIT_STR(reg, 11, ", rb wait ", "") + ); +#undef BIT_STR + return ring_length; +} + +static void +print_acthd(unsigned int reg, unsigned int ring_length) +{ + if ((reg & (0x7ffff << 2)) < ring_length) + printf(" at ring: 0x%08x\n", reg & (0x7ffff << 2)); + else + printf(" at batch: 0x%08x\n", reg); +} + static void print_instdone(uint32_t devid, unsigned int instdone, unsigned int instdone1) { @@ -304,7 +329,7 @@ read_data_file(FILE *file) int data_size = 0, count = 0, line_number = 0, matched; char *line = NULL; size_t line_size; - uint32_t offset, value; + uint32_t offset, value, ring_length = 0; uint32_t gtt_offset = 0, new_gtt_offset; char *ring_name = NULL; int is_batch = 1; @@ -391,14 +416,20 @@ read_data_file(FILE *file) decode_ctx = drm_intel_decode_context_alloc(devid); } + matched = sscanf(line, " CTL: 0x%08x\n", ®); + if (matched == 1) + ring_length = print_ctl(reg); + matched = sscanf(line, " HEAD: 0x%08x\n", ®); if (matched == 1) { head[head_ndx++] = print_head(reg); } matched = sscanf(line, " ACTHD: 0x%08x\n", ®); - if (matched == 1) + if (matched == 1) { + print_acthd(reg, ring_length); drm_intel_decode_set_head_tail(decode_ctx, reg, 0xffffffff); + } matched = sscanf(line, " PGTBL_ER: 0x%08x\n", ®); if (matched == 1 && reg)