From patchwork Thu Sep 7 00:37:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Srivatsa, Anusha" X-Patchwork-Id: 9941525 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 C83906038C for ; Thu, 7 Sep 2017 00:36:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD92926E97 for ; Thu, 7 Sep 2017 00:36:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B29EF274D1; Thu, 7 Sep 2017 00:36:12 +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 56BBE26E97 for ; Thu, 7 Sep 2017 00:36:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 54F716E7E0; Thu, 7 Sep 2017 00:36:11 +0000 (UTC) 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 ESMTPS id 92B996E76D for ; Thu, 7 Sep 2017 00:36:09 +0000 (UTC) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Sep 2017 17:36:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,355,1500966000"; d="scan'208";a="132585888" Received: from anusha-test.jf.intel.com ([10.7.198.157]) by orsmga002.jf.intel.com with ESMTP; 06 Sep 2017 17:36:08 -0700 From: Anusha Srivatsa To: intel-gfx@lists.freedesktop.org Date: Wed, 6 Sep 2017 17:37:39 -0700 Message-Id: <20170907003740.3016-1-anusha.srivatsa@intel.com> X-Mailer: git-send-email 2.11.0 Cc: Sujaritha Sundaresan Subject: [Intel-gfx] [PATCH 1/2] drm/i915/guc: Add GuC Load time 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 Calculate the time that GuC takes to load. This information could be very useful in determining if GuC is taking unreasonably long time to load in a certain platforms. v2: Calculate time before logs are collected. Move the guc_load_time variable as a part of intel_uc_fw struct. Store only final result which is to be exported to debugfs. (Michal) Add the load time in the print message as well. Cc: Sujaritha Sundaresan Cc: Oscar Mateo Cc: Michal Wajdeczko Signed-off-by: Anusha Srivatsa --- drivers/gpu/drm/i915/i915_debugfs.c | 3 +++ drivers/gpu/drm/i915/intel_guc_loader.c | 8 ++++++++ drivers/gpu/drm/i915/intel_uc.h | 1 + 3 files changed, 12 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 48572b157222..e0b99dbc6608 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -2379,6 +2379,9 @@ static int i915_guc_load_status_info(struct seq_file *m, void *data) guc_fw->major_ver_wanted, guc_fw->minor_ver_wanted); seq_printf(m, "\tversion found: %d.%d\n", guc_fw->major_ver_found, guc_fw->minor_ver_found); + seq_printf(m, "\tGuC Load time is %lu ms\n", + jiffies_to_msecs(guc_fw->guc_load_time)); + seq_printf(m, "\theader: offset is %d; size = %d\n", guc_fw->header_offset, guc_fw->header_size); seq_printf(m, "\tuCode: offset is %d; size = %d\n", diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c index 8b0ae7fce7f2..da917f84c471 100644 --- a/drivers/gpu/drm/i915/intel_guc_loader.c +++ b/drivers/gpu/drm/i915/intel_guc_loader.c @@ -199,6 +199,7 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv, struct sg_table *sg = vma->pages; u32 status, rsa[UOS_RSA_SCRATCH_MAX_COUNT]; int i, ret = 0; + unsigned long guc_start_load, guc_finish_load; /* where RSA signature starts */ offset = guc_fw->rsa_offset; @@ -226,6 +227,7 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv, /* Finally start the DMA */ I915_WRITE(DMA_CTRL, _MASKED_BIT_ENABLE(UOS_MOVE | START_DMA)); + guc_start_load = jiffies; /* * Wait for the DMA to complete & the GuC to start up. @@ -237,6 +239,9 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv, */ ret = wait_for(guc_ucode_response(dev_priv, &status), 100); + guc_finish_load = jiffies; + guc_fw->guc_load_time = guc_finish_load - guc_start_load; + DRM_DEBUG_DRIVER("DMA status 0x%x, GuC status 0x%x\n", I915_READ(DMA_CTRL), status); @@ -372,6 +377,9 @@ int intel_guc_init_hw(struct intel_guc *guc) guc->fw.path, guc->fw.major_ver_found, guc->fw.minor_ver_found); + DRM_DEBUG_DRIVER("Time taken to load GuC is %lu\n", + guc->fw.guc_load_time); + return 0; } diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h index 22ae52b17b0f..52aa05d13863 100644 --- a/drivers/gpu/drm/i915/intel_uc.h +++ b/drivers/gpu/drm/i915/intel_uc.h @@ -154,6 +154,7 @@ struct intel_uc_fw { uint32_t rsa_offset; uint32_t ucode_size; uint32_t ucode_offset; + unsigned long guc_load_time; }; struct intel_guc_log {