All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 2/3] drm/i915/huc: Check HuC firmware status only once
Date: Wed, 22 May 2019 19:00:56 +0000	[thread overview]
Message-ID: <20190522190057.848-3-michal.wajdeczko@intel.com> (raw)
In-Reply-To: <20190522190057.848-1-michal.wajdeczko@intel.com>

During driver load we checked that HuC firmware was verified, and once
verified it stays verified, so there is no need to check that again.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tony Ye <tony.ye@intel.com>
---
 drivers/gpu/drm/i915/intel_huc.c | 17 ++++++-----------
 drivers/gpu/drm/i915/intel_huc.h |  2 ++
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_huc.c b/drivers/gpu/drm/i915/intel_huc.c
index 1ff1fb015e58..aac17916e130 100644
--- a/drivers/gpu/drm/i915/intel_huc.c
+++ b/drivers/gpu/drm/i915/intel_huc.c
@@ -113,6 +113,8 @@ int intel_huc_auth(struct intel_huc *huc)
 	u32 status;
 	int ret;
 
+	GEM_BUG_ON(huc->verified);
+
 	if (huc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
 		return -ENOEXEC;
 
@@ -134,6 +136,7 @@ int intel_huc_auth(struct intel_huc *huc)
 		goto fail;
 	}
 
+	huc->verified = true;
 	return 0;
 
 fail:
@@ -147,24 +150,16 @@ int intel_huc_auth(struct intel_huc *huc)
  * intel_huc_check_status() - check HuC status
  * @huc: intel_huc structure
  *
- * This function reads status register to verify if HuC
- * firmware was successfully loaded.
- *
  * Returns: 1 if HuC firmware is loaded and verified,
  * 0 if HuC firmware is not loaded and -ENODEV if HuC
  * is not present on this platform.
  */
 int intel_huc_check_status(struct intel_huc *huc)
 {
-	struct drm_i915_private *dev_priv = huc_to_i915(huc);
-	intel_wakeref_t wakeref;
-	bool status = false;
+	struct drm_i915_private *i915 = huc_to_i915(huc);
 
-	if (!HAS_HUC(dev_priv))
+	if (!HAS_HUC(i915))
 		return -ENODEV;
 
-	with_intel_runtime_pm(dev_priv, wakeref)
-		status = I915_READ(HUC_STATUS2) & HUC_FW_VERIFIED;
-
-	return status;
+	return huc->verified;
 }
diff --git a/drivers/gpu/drm/i915/intel_huc.h b/drivers/gpu/drm/i915/intel_huc.h
index a0c21ae02a99..8c2b6c8f179c 100644
--- a/drivers/gpu/drm/i915/intel_huc.h
+++ b/drivers/gpu/drm/i915/intel_huc.h
@@ -31,6 +31,7 @@
 struct intel_huc {
 	/* Generic uC firmware management */
 	struct intel_uc_fw fw;
+	bool verified;
 
 	/* HuC-specific additions */
 	struct i915_vma *rsa_data;
@@ -52,6 +53,7 @@ static inline void intel_huc_fini_misc(struct intel_huc *huc)
 static inline int intel_huc_sanitize(struct intel_huc *huc)
 {
 	intel_uc_fw_sanitize(&huc->fw);
+	huc->verified = false;
 	return 0;
 }
 
-- 
2.19.2

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

  parent reply	other threads:[~2019-05-22 19:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-22 19:00 [PATCH 0/3] drm/i915: HuC updates Michal Wajdeczko
2019-05-22 19:00 ` [PATCH 1/3] drm/i915/uc: Make uc_sanitize part of gt_sanitize Michal Wajdeczko
2019-05-22 20:11   ` Chris Wilson
2019-05-22 19:00 ` Michal Wajdeczko [this message]
2019-05-22 20:13   ` [PATCH 2/3] drm/i915/huc: Check HuC firmware status only once Chris Wilson
2019-05-23 11:58     ` Ye, Tony
2019-05-22 19:00 ` [PATCH 3/3] drm/i915/huc: Update HuC status codes Michal Wajdeczko
2019-05-22 20:19   ` Chris Wilson
2019-05-22 22:25     ` Michal Wajdeczko
2019-05-31 10:13       ` Joonas Lahtinen
2019-05-31 19:06         ` Michal Wajdeczko
2019-05-22 19:50 ` ✓ Fi.CI.BAT: success for drm/i915: HuC updates Patchwork
2019-05-23 15:56 ` ✗ Fi.CI.IGT: failure " Patchwork

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=20190522190057.848-3-michal.wajdeczko@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.