[2/2] drm/i915/huc: Add HuC Load time to dmesg log.
diff mbox

Message ID 1507077693-3636-2-git-send-email-anusha.srivatsa@intel.com
State New
Headers show

Commit Message

Srivatsa, Anusha Oct. 4, 2017, 12:41 a.m. UTC
This patch uses jiffies to calculate the huc
load time.This information can be useful for testing
to know how much time huc takes to load.

v2: Remove debugfs entry. Remove local variable
    huc_finish_load. (Daniel, Tvrtko)
v3: Use ktime_get() for more accurate timings.
    Ensure the load is successful, before load times
    is printed. (Tvrtko, Michal)

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Sujaritha Sundaresan <sujaritha.sundaresan@intel.com>
Cc: Oscar Mateo Lozano <oscar.mateo@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
 drivers/gpu/drm/i915/intel_huc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff mbox

diff --git a/drivers/gpu/drm/i915/intel_huc.c b/drivers/gpu/drm/i915/intel_huc.c
index 8b4b535..972ae63 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;
+	ktime_t start_load;
 	ret = i915_gem_object_set_to_gtt_domain(huc_fw->obj, false);
 	if (ret) {
@@ -121,11 +122,14 @@  static int huc_ucode_xfer(struct drm_i915_private *dev_priv)
 	I915_WRITE(DMA_COPY_SIZE, size);
 	/* Start the DMA */
+	start_load = ktime_get();
 	/* Wait for DMA to finish */
 	ret = wait_for((I915_READ(DMA_CTRL) & START_DMA) == 0, 100);
+	huc_fw->load_time = ktime_ms_delta(ktime_get(), start_load);
 	DRM_DEBUG_DRIVER("HuC DMA transfer wait over with ret %d\n", ret);
 	/* Disable the bits once DMA is over */
@@ -220,6 +224,9 @@  void intel_huc_init_hw(struct intel_huc *huc)
 	if (huc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
 		DRM_ERROR("Failed to complete HuC uCode load with ret %d\n", err);
+	else
+		DRM_DEBUG_DRIVER("Time taken to load HuC %lld ms\n",
+			 huc->fw.load_time);