From patchwork Wed Oct 4 00:41:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Srivatsa, Anusha" X-Patchwork-Id: 9983687 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 9E94F60237 for ; Wed, 4 Oct 2017 00:43:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CF4D28A29 for ; Wed, 4 Oct 2017 00:43:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8027A28A44; Wed, 4 Oct 2017 00:43:35 +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 1BF4D28A29 for ; Wed, 4 Oct 2017 00:43:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 90EBC6E60F; Wed, 4 Oct 2017 00:43:29 +0000 (UTC) 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 ESMTPS id 0C97D6E60F for ; Wed, 4 Oct 2017 00:43:27 +0000 (UTC) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Oct 2017 17:43:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,475,1500966000"; d="scan'208";a="906434640" Received: from anusha-dev.jf.intel.com ([10.54.75.168]) by FMSMGA003.fm.intel.com with ESMTP; 03 Oct 2017 17:43:27 -0700 From: Anusha Srivatsa To: intel-gfx@lists.freedesktop.org Date: Tue, 3 Oct 2017 17:41:32 -0700 Message-Id: <1507077693-3636-1-git-send-email-anusha.srivatsa@intel.com> X-Mailer: git-send-email 2.7.4 Cc: Sujaritha Sundaresan , Daniel Vetter Subject: [Intel-gfx] [PATCH 1/2] drm/i915/guc: Add GuC Load time to dmesg log. 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 using jiffies. 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. v3: Remove debugfs entry. Remove local variable guc_finish_load. (Daniel, Tvrtko) v4: Use ktime_get() instead of jiffies. Use DRM_NOTE if time taken to load is more than the threshold. On load times within acceptable range, use DRM_DEBUG_DRIVER (Tvrtko) Cc: Chris Wilson Cc: Tvrtko ursulin Cc: Daniel Vetter Cc: Sujaritha Sundaresan Cc: Oscar Mateo Cc: Michal Wajdeczko Signed-off-by: Anusha Srivatsa --- drivers/gpu/drm/i915/intel_guc_loader.c | 10 +++++++++- drivers/gpu/drm/i915/intel_uc.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c index c9e25be..a0b562c 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; + ktime_t start_load; /* where RSA signature starts */ offset = guc_fw->rsa_offset; @@ -225,6 +226,7 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv, I915_WRITE(DMA_ADDR_1_HIGH, DMA_ADDRESS_SPACE_WOPCM); /* Finally start the DMA */ + start_load = ktime_get(); I915_WRITE(DMA_CTRL, _MASKED_BIT_ENABLE(UOS_MOVE | START_DMA)); /* @@ -237,13 +239,17 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv, */ ret = wait_for(guc_ucode_response(dev_priv, &status), 100); + guc_fw->load_time = ktime_ms_delta(ktime_get(), start_load); + DRM_DEBUG_DRIVER("DMA status 0x%x, GuC status 0x%x\n", I915_READ(DMA_CTRL), status); if ((status & GS_BOOTROM_MASK) == GS_BOOTROM_RSA_FAILED) { DRM_ERROR("GuC firmware signature verification failed\n"); ret = -ENOEXEC; - } + } else if (guc_fw->load_time > 20) + DRM_NOTE("Time taken to load GuC is more than the acceptable \ + threshold\n"); DRM_DEBUG_DRIVER("returning %d\n", ret); @@ -373,6 +379,8 @@ 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("GuC is loaded in: %lld ms\n",guc->fw.load_time); + return 0; } diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h index 6966349..65b9674 100644 --- a/drivers/gpu/drm/i915/intel_uc.h +++ b/drivers/gpu/drm/i915/intel_uc.h @@ -136,6 +136,7 @@ struct intel_uc_fw { uint32_t rsa_offset; uint32_t ucode_size; uint32_t ucode_offset; + unsigned long long load_time; }; struct intel_guc_log {