From patchwork Mon Oct 30 20:17:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: oscar.mateo@intel.com X-Patchwork-Id: 10033083 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7BDF06039A for ; Mon, 30 Oct 2017 20:18:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7020227FB1 for ; Mon, 30 Oct 2017 20:18:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64C7628854; Mon, 30 Oct 2017 20:18:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0C0BA27FB1 for ; Mon, 30 Oct 2017 20:18:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 910456E50F; Mon, 30 Oct 2017 20:18:01 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4AD056E3AF for ; Mon, 30 Oct 2017 20:17:57 +0000 (UTC) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP; 30 Oct 2017 13:17:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,321,1505804400"; d="scan'208";a="169689617" Received: from omateolo-linux.fm.intel.com ([10.1.27.13]) by fmsmga006.fm.intel.com with ESMTP; 30 Oct 2017 13:17:16 -0700 From: Oscar Mateo To: intel-gfx@lists.freedesktop.org Date: Mon, 30 Oct 2017 13:17:15 -0700 Message-Id: <1509394647-23209-9-git-send-email-oscar.mateo@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1509394647-23209-1-git-send-email-oscar.mateo@intel.com> References: <1509394647-23209-1-git-send-email-oscar.mateo@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 08/20] drm/i915: Print all workaround types correctly in debugfs 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Let's try to make sure that all WAs are applied correctly and survive resumes, resets, etc... (with some help from a companion i-g-t patch). v2: - Rebased - Print display WAs as well (Ville) v3: - Grab the forcewake once for everyone, so that all reads are from the same powercontext (Chris) Signed-off-by: Oscar Mateo Cc: Chris Wilson Cc: Mika Kuoppala Cc: Ville Syrjälä --- drivers/gpu/drm/i915/i915_debugfs.c | 59 ++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 2890c02..03ae750 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -3355,6 +3355,22 @@ static int i915_shared_dplls_info(struct seq_file *m, void *unused) return 0; } +static void check_wa_register(struct seq_file *m, struct i915_wa_reg *wa_reg) +{ + struct drm_i915_private *dev_priv = node_to_i915(m->private); + u32 read; + bool ok; + + assert_forcewakes_active(dev_priv, FORCEWAKE_ALL); + + read = I915_READ_FW(wa_reg->addr); + ok = (wa_reg->value & wa_reg->mask) == (read & wa_reg->mask); + seq_printf(m, "0x%X: 0x%08x, mask: 0x%08x, read: 0x%08x, status: %s\n", + i915_mmio_reg_offset(wa_reg->addr), + wa_reg->value, wa_reg->mask, read, + ok ? "OK" : "FAIL"); +} + static int i915_wa_registers(struct seq_file *m, void *unused) { int i; @@ -3364,6 +3380,7 @@ static int i915_wa_registers(struct seq_file *m, void *unused) struct drm_device *dev = &dev_priv->drm; struct i915_workarounds *workarounds = &dev_priv->workarounds; enum intel_engine_id id; + u32 whitelist_wa_count = 0; ret = mutex_lock_interruptible(&dev->struct_mutex); if (ret) @@ -3372,22 +3389,36 @@ static int i915_wa_registers(struct seq_file *m, void *unused) intel_runtime_pm_get(dev_priv); seq_printf(m, "Context workarounds applied: %d\n", workarounds->ctx_wa_count); - for_each_engine(engine, dev_priv, id) - seq_printf(m, "HW whitelist count for %s: %d\n", - engine->name, workarounds->whitelist_wa_count[id]); for (i = 0; i < workarounds->ctx_wa_count; ++i) { - i915_reg_t addr; - u32 mask, value, read; - bool ok; - - addr = workarounds->ctx_wa_reg[i].addr; - mask = workarounds->ctx_wa_reg[i].mask; - value = workarounds->ctx_wa_reg[i].value; - read = I915_READ(addr); - ok = (value & mask) == (read & mask); - seq_printf(m, "0x%X: 0x%08X, mask: 0x%08X, read: 0x%08x, status: %s\n", - i915_mmio_reg_offset(addr), value, mask, read, ok ? "OK" : "FAIL"); + struct i915_wa_reg *wa_reg = &workarounds->ctx_wa_reg[i]; + + seq_printf(m, "0x%X: 0x%08x, mask: 0x%08x\n", + i915_mmio_reg_offset(wa_reg->addr), + wa_reg->value, wa_reg->mask); } + seq_putc(m, '\n'); + + intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL); + + seq_printf(m, "GT workarounds applied: %d\n", workarounds->gt_wa_count); + for (i = 0; i < workarounds->gt_wa_count; ++i) + check_wa_register(m, &workarounds->gt_wa_reg[i]); + seq_putc(m, '\n'); + + seq_printf(m, "Display workarounds applied: %d\n", workarounds->display_wa_count); + for (i = 0; i < workarounds->display_wa_count; ++i) + check_wa_register(m, &workarounds->display_wa_reg[i]); + seq_putc(m, '\n'); + + for_each_engine(engine, dev_priv, id) + whitelist_wa_count += workarounds->whitelist_wa_count[id]; + seq_printf(m, "Whitelist workarounds applied: %d\n", whitelist_wa_count); + for_each_engine(engine, dev_priv, id) + for (i = 0; i < workarounds->whitelist_wa_count[id]; ++i) + check_wa_register(m, &workarounds->whitelist_wa_reg[id][i]); + seq_putc(m, '\n'); + + intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL); intel_runtime_pm_put(dev_priv); mutex_unlock(&dev->struct_mutex);