public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Anusha Srivatsa <anusha.srivatsa@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Sujaritha Sundaresan <sujaritha.sundaresan@intel.com>,
	Oscar Mateo Lozano <oscar.mateo.lozano@intel.com>
Subject: [PATCH 2/2] drm/i915/huc: Add HuC Load time to debugfs
Date: Wed,  6 Sep 2017 17:37:40 -0700	[thread overview]
Message-ID: <20170907003740.3016-2-anusha.srivatsa@intel.com> (raw)
In-Reply-To: <20170907003740.3016-1-anusha.srivatsa@intel.com>

This patch uses jiffies to calculate the huc
load time and add it as a field to debugfs.
This information can be useful for testing
to know how much time huc takes to load.

Cc: Sujaritha Sundaresan <sujaritha.sundaresan@intel.com>
Cc: Oscar Mateo Lozano <oscar.mateo.lozano@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 2 ++
 drivers/gpu/drm/i915/intel_huc.c    | 8 ++++++++
 drivers/gpu/drm/i915/intel_uc.h     | 1 +
 3 files changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index e0b99dbc6608..a8a8a210a97c 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2349,6 +2349,8 @@ static int i915_huc_load_status_info(struct seq_file *m, void *data)
 		huc_fw->header_offset, huc_fw->header_size);
 	seq_printf(m, "\tuCode: offset is %d; size = %d\n",
 		huc_fw->ucode_offset, huc_fw->ucode_size);
+	seq_printf(m, "\tHuC load time is %lu ms\n",
+		   jiffies_to_msecs(huc_fw->huc_load_time));
 	seq_printf(m, "\tRSA: offset is %d; size = %d\n",
 		huc_fw->rsa_offset, huc_fw->rsa_size);
 
diff --git a/drivers/gpu/drm/i915/intel_huc.c b/drivers/gpu/drm/i915/intel_huc.c
index 6145fa0d6773..798dec9bd2c8 100644
--- a/drivers/gpu/drm/i915/intel_huc.c
+++ b/drivers/gpu/drm/i915/intel_huc.c
@@ -90,6 +90,7 @@ static int huc_ucode_xfer(struct drm_i915_private *dev_priv)
 	unsigned long offset = 0;
 	u32 size;
 	int ret;
+	unsigned long huc_start_load, huc_finish_load;
 
 	ret = i915_gem_object_set_to_gtt_domain(huc_fw->obj, false);
 	if (ret) {
@@ -121,11 +122,15 @@ static int huc_ucode_xfer(struct drm_i915_private *dev_priv)
 	I915_WRITE(DMA_COPY_SIZE, size);
 
 	/* Start the DMA */
+	huc_start_load = jiffies;
 	I915_WRITE(DMA_CTRL, _MASKED_BIT_ENABLE(HUC_UKERNEL | START_DMA));
 
 	/* Wait for DMA to finish */
 	ret = wait_for((I915_READ(DMA_CTRL) & START_DMA) == 0, 100);
 
+	huc_finish_load = jiffies;
+	huc_fw->huc_load_time = huc_finish_load - huc_start_load;
+
 	DRM_DEBUG_DRIVER("HuC DMA transfer wait over with ret %d\n", ret);
 
 	/* Disable the bits once DMA is over */
@@ -218,6 +223,9 @@ void intel_huc_init_hw(struct intel_huc *huc)
 		intel_uc_fw_status_repr(huc->fw.fetch_status),
 		intel_uc_fw_status_repr(huc->fw.load_status));
 
+	DRM_DEBUG_DRIVER("Time taken to load HuC %lu",
+			 huc->fw.huc_load_time);
+
 	if (huc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
 		DRM_ERROR("Failed to complete HuC uCode load with ret %d\n", err);
 
diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
index 52aa05d13863..1ef685d7095e 100644
--- a/drivers/gpu/drm/i915/intel_uc.h
+++ b/drivers/gpu/drm/i915/intel_uc.h
@@ -155,6 +155,7 @@ struct intel_uc_fw {
 	uint32_t ucode_size;
 	uint32_t ucode_offset;
 	unsigned long guc_load_time;
+	unsigned long huc_load_time;
 };
 
 struct intel_guc_log {
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-09-07  0:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-07  0:37 [PATCH 1/2] drm/i915/guc: Add GuC Load time to debugfs Anusha Srivatsa
2017-09-07  0:37 ` Anusha Srivatsa [this message]
2017-09-07  0:40 ` ✗ Fi.CI.BAT: failure for series starting with [1/2] " Patchwork
2017-09-07  8:49 ` [PATCH 1/2] " Tvrtko Ursulin
2017-09-07 10:23   ` Michal Wajdeczko
2017-09-07 17:07     ` Srivatsa, Anusha
2017-09-07 17:07   ` Srivatsa, Anusha
2017-09-11 15:53     ` Tvrtko Ursulin
2017-09-07 22:08   ` Chris Wilson
2017-09-08 17:58     ` Srivatsa, Anusha
2017-09-08 18:04       ` Chris Wilson
2017-09-08  7:17   ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170907003740.3016-2-anusha.srivatsa@intel.com \
    --to=anusha.srivatsa@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=oscar.mateo.lozano@intel.com \
    --cc=sujaritha.sundaresan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox