From patchwork Sat Mar 25 01:30:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Thierry X-Patchwork-Id: 9644341 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 B9C6460327 for ; Sat, 25 Mar 2017 01:30:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC0D52654B for ; Sat, 25 Mar 2017 01:30:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A10A4269A3; Sat, 25 Mar 2017 01:30:18 +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 5F27E2654B for ; Sat, 25 Mar 2017 01:30:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 22FB36ECA8; Sat, 25 Mar 2017 01:30:14 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id D1D926E246 for ; Sat, 25 Mar 2017 01:30:12 +0000 (UTC) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP; 24 Mar 2017 18:30:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.36,217,1486454400"; d="scan'208,223"; a="70447260" Received: from relo-linux-11.sc.intel.com ([10.3.160.214]) by orsmga004.jf.intel.com with ESMTP; 24 Mar 2017 18:30:12 -0700 From: Michel Thierry To: intel-gfx@lists.freedesktop.org Date: Fri, 24 Mar 2017 18:30:10 -0700 Message-Id: <20170325013010.36244-19-michel.thierry@intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170325013010.36244-1-michel.thierry@intel.com> References: <20170325013010.36244-1-michel.thierry@intel.com> Subject: [Intel-gfx] [PATCH v5 18/18] drm/i915: Watchdog timeout: Export media reset count from GuC to 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: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From firmware v8.8, GuC provides the count of media engine resets (watchdog timeout). This information is available in the GuC shared context data struct, which resides in the first page of the default (kernel) lrc context. Since GuC handled engine resets are transparent for kernel and user, provide a simple debugfs entry to see the number of times media reset has happened. Signed-off-by: Michel Thierry --- drivers/gpu/drm/i915/i915_debugfs.c | 28 ++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_guc_fwif.h | 18 ++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 8db850541e03..f40a2c84b423 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -1400,6 +1400,32 @@ static int i915_hangcheck_info(struct seq_file *m, void *unused) return 0; } +static u32 i915_watchdog_reset_count(struct drm_i915_private *dev_priv) +{ + struct drm_device *dev = &dev_priv->drm; + struct i915_gem_context *ctx; + struct page *page; + struct guc_shared_ctx_data *guc_shared_data; + u32 guc_media_reset_count; + + if (!i915.enable_guc_submission) + return 0; + + if (mutex_lock_interruptible(&dev->struct_mutex)) + return 0; + + ctx = dev_priv->kernel_context; + page = i915_gem_object_get_dirty_page(ctx->engine[RCS].state->obj, + LRC_GUCSHR_PN); + guc_shared_data = kmap_atomic(page); + guc_media_reset_count = guc_shared_data->media_reset_count; + kunmap_atomic(guc_shared_data); + + mutex_unlock(&dev->struct_mutex); + + return guc_media_reset_count; +} + static int i915_reset_info(struct seq_file *m, void *unused) { struct drm_i915_private *dev_priv = node_to_i915(m->private); @@ -1408,6 +1434,8 @@ static int i915_reset_info(struct seq_file *m, void *unused) enum intel_engine_id id; seq_printf(m, "full gpu reset = %u\n", i915_reset_count(error)); + seq_printf(m, "GuC watchdog/media reset = %u\n", + i915_watchdog_reset_count(dev_priv)); for_each_engine(engine, dev_priv, id) { seq_printf(m, "%s = %u\n", engine->name, diff --git a/drivers/gpu/drm/i915/intel_guc_fwif.h b/drivers/gpu/drm/i915/intel_guc_fwif.h index 5db3def5f74e..d9dc844fcce0 100644 --- a/drivers/gpu/drm/i915/intel_guc_fwif.h +++ b/drivers/gpu/drm/i915/intel_guc_fwif.h @@ -503,6 +503,24 @@ union guc_log_control { u32 value; } __packed; +/* GuC Shared Context Data Struct */ +struct guc_shared_ctx_data { + u32 addr_of_last_preempted_data_low; + u32 addr_of_last_preempted_data_high; + u32 addr_of_last_preempted_data_high_tmp; + u32 padding; + u32 is_mapped_to_proxy; + u32 proxy_ctx_id; + u32 engine_reset_ctx_id; + u32 media_reset_count; + u32 reserved[8]; + u32 uk_last_ctx_switch_reason; + u32 was_reset; + u32 lrca_gpu_addr; + u32 execlist_ctx; + u32 reserved1[32]; +} __packed; + /* This Action will be programmed in C180 - SOFT_SCRATCH_O_REG */ enum intel_guc_action { INTEL_GUC_ACTION_DEFAULT = 0x0,