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 v4 15/22] drm/i915/huc: New HuC status register for Gen11
Date: Thu, 23 May 2019 23:30:42 +0000	[thread overview]
Message-ID: <20190523233049.28020-16-michal.wajdeczko@intel.com> (raw)
In-Reply-To: <20190523233049.28020-1-michal.wajdeczko@intel.com>

Gen11 defines new register for checking HuC authentication status.
Look into the right register and bit.

v2: use reg/mask/value instead of dedicated functions (Daniele)

BSpec: 19686

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Tony Ye <tony.ye@intel.com>
Cc: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
Cc: John Spotswood <john.a.spotswood@intel.com>
Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
---
 drivers/gpu/drm/i915/intel_guc_reg.h |  3 +++
 drivers/gpu/drm/i915/intel_huc.c     | 26 +++++++++++++++++++-------
 drivers/gpu/drm/i915/intel_huc.h     |  7 +++++++
 3 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_guc_reg.h b/drivers/gpu/drm/i915/intel_guc_reg.h
index d26de5193568..7eba65795b58 100644
--- a/drivers/gpu/drm/i915/intel_guc_reg.h
+++ b/drivers/gpu/drm/i915/intel_guc_reg.h
@@ -79,6 +79,9 @@
 #define HUC_STATUS2             _MMIO(0xD3B0)
 #define   HUC_FW_VERIFIED       (1<<7)
 
+#define GEN11_HUC_KERNEL_LOAD_INFO	_MMIO(0xC1DC)
+#define   HUC_LOAD_SUCCESSFUL		  (1 << 0)
+
 #define GUC_WOPCM_SIZE			_MMIO(0xc050)
 #define   GUC_WOPCM_SIZE_LOCKED		  (1<<0)
 #define   GUC_WOPCM_SIZE_SHIFT		12
diff --git a/drivers/gpu/drm/i915/intel_huc.c b/drivers/gpu/drm/i915/intel_huc.c
index 1ff1fb015e58..8572a0588efc 100644
--- a/drivers/gpu/drm/i915/intel_huc.c
+++ b/drivers/gpu/drm/i915/intel_huc.c
@@ -29,7 +29,19 @@
 
 void intel_huc_init_early(struct intel_huc *huc)
 {
+	struct drm_i915_private *i915 = huc_to_i915(huc);
+
 	intel_huc_fw_init_early(huc);
+
+	if (INTEL_GEN(i915) >= 11) {
+		huc->status.reg = GEN11_HUC_KERNEL_LOAD_INFO;
+		huc->status.mask = HUC_LOAD_SUCCESSFUL;
+		huc->status.value = HUC_LOAD_SUCCESSFUL;
+	} else {
+		huc->status.reg = HUC_STATUS2;
+		huc->status.mask = HUC_FW_VERIFIED;
+		huc->status.value = HUC_FW_VERIFIED;
+	}
 }
 
 int intel_huc_init_misc(struct intel_huc *huc)
@@ -110,7 +122,6 @@ int intel_huc_auth(struct intel_huc *huc)
 {
 	struct drm_i915_private *i915 = huc_to_i915(huc);
 	struct intel_guc *guc = &i915->guc;
-	u32 status;
 	int ret;
 
 	if (huc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
@@ -125,12 +136,12 @@ int intel_huc_auth(struct intel_huc *huc)
 
 	/* Check authentication status, it should be done by now */
 	ret = __intel_wait_for_register(&i915->uncore,
-					HUC_STATUS2,
-					HUC_FW_VERIFIED,
-					HUC_FW_VERIFIED,
-					2, 50, &status);
+					huc->status.reg,
+					huc->status.mask,
+					huc->status.value,
+					2, 50, NULL);
 	if (ret) {
-		DRM_ERROR("HuC: Firmware not verified %#x\n", status);
+		DRM_ERROR("HuC: Firmware not verified %d\n", ret);
 		goto fail;
 	}
 
@@ -164,7 +175,8 @@ int intel_huc_check_status(struct intel_huc *huc)
 		return -ENODEV;
 
 	with_intel_runtime_pm(dev_priv, wakeref)
-		status = I915_READ(HUC_STATUS2) & HUC_FW_VERIFIED;
+		status = (I915_READ(huc->status.reg) & huc->status.mask) ==
+			  huc->status.value;
 
 	return status;
 }
diff --git a/drivers/gpu/drm/i915/intel_huc.h b/drivers/gpu/drm/i915/intel_huc.h
index a0c21ae02a99..2a6c94e79f17 100644
--- a/drivers/gpu/drm/i915/intel_huc.h
+++ b/drivers/gpu/drm/i915/intel_huc.h
@@ -25,6 +25,7 @@
 #ifndef _INTEL_HUC_H_
 #define _INTEL_HUC_H_
 
+#include "i915_reg.h"
 #include "intel_uc_fw.h"
 #include "intel_huc_fw.h"
 
@@ -35,6 +36,12 @@ struct intel_huc {
 	/* HuC-specific additions */
 	struct i915_vma *rsa_data;
 	void *rsa_data_vaddr;
+
+	struct {
+		i915_reg_t reg;
+		u32 mask;
+		u32 value;
+	} status;
 };
 
 void intel_huc_init_early(struct intel_huc *huc);
-- 
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-23 23:31 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-23 23:30 [PATCH v4 00/22] GuC 32.0.3 Michal Wajdeczko
2019-05-23 23:30 ` [PATCH v4 01/22] drm/i915/guc: Change platform default GuC mode Michal Wajdeczko
2019-05-27 11:36   ` Joonas Lahtinen
2019-05-23 23:30 ` [PATCH v4 02/22] drm/i915/guc: Don't allow GuC submission Michal Wajdeczko
2019-05-27 11:40   ` Joonas Lahtinen
2019-05-27 11:59     ` Michal Wajdeczko
2019-05-23 23:30 ` [PATCH v4 03/22] drm/i915/guc: Update GuC firmware versions and names Michal Wajdeczko
2019-05-23 23:30 ` [PATCH v4 04/22] drm/i915/guc: Update GuC firmware CSS header Michal Wajdeczko
2019-05-23 23:30 ` [PATCH v4 05/22] drm/i915/guc: Update GuC boot parameters Michal Wajdeczko
2019-05-23 23:30 ` [PATCH v4 06/22] drm/i915/guc: Update suspend/resume protocol Michal Wajdeczko
2019-05-23 23:30 ` [PATCH v4 07/22] drm/i915/guc: Update GuC sample-forcewake command Michal Wajdeczko
2019-05-23 23:30 ` [PATCH v4 08/22] drm/i915/guc: Update GuC ADS object definition Michal Wajdeczko
2019-05-23 23:30 ` [PATCH v4 09/22] drm/i915/guc: Reset GuC ADS during sanitize Michal Wajdeczko
2019-05-23 23:30 ` [PATCH v4 10/22] drm/i915/guc: Always ask GuC to update power domain states Michal Wajdeczko
2019-05-23 23:30 ` [PATCH v4 11/22] drm/i915/guc: Define GuC firmware version for Geminilake Michal Wajdeczko
2019-05-24 17:36   ` Srivatsa, Anusha
2019-05-23 23:30 ` [PATCH v4 12/22] drm/i915/huc: Define HuC " Michal Wajdeczko
2019-05-24 17:39   ` Srivatsa, Anusha
2019-05-23 23:30 ` [PATCH v4 13/22] drm/i915/guc: New GuC interrupt register for Gen11 Michal Wajdeczko
2019-05-23 23:30 ` [PATCH v4 14/22] drm/i915/guc: New GuC scratch registers " Michal Wajdeczko
2019-05-23 23:30 ` Michal Wajdeczko [this message]
2019-05-23 23:30 ` [PATCH v4 16/22] drm/i915/guc: Create vfuncs for the GuC interrupts control functions Michal Wajdeczko
2019-05-23 23:30 ` [PATCH v4 17/22] drm/i915/guc: Correctly handle GuC interrupts on Gen11 Michal Wajdeczko
2019-05-27 14:30   ` Michał Winiarski
2019-05-23 23:30 ` [PATCH v4 18/22] drm/i915/guc: Update GuC CTB response definition Michal Wajdeczko
2019-05-23 23:30 ` [PATCH v4 19/22] drm/i915/guc: Enable GuC CTB communication on Gen11 Michal Wajdeczko
2019-05-23 23:30 ` [PATCH v4 20/22] drm/i915/guc: Define GuC firmware version for Icelake Michal Wajdeczko
2019-05-23 23:30 ` [PATCH v4 21/22] drm/i915/huc: Define HuC " Michal Wajdeczko
2019-05-25  0:58   ` Ye, Tony
2019-05-23 23:30 ` [PATCH v4 22/22] HAX: turn on GuC/HuC auto mode Michal Wajdeczko
2019-05-23 23:51 ` ✗ Fi.CI.CHECKPATCH: warning for GuC 32.0.3 (rev5) Patchwork
2019-05-24  0:09 ` ✓ Fi.CI.BAT: success " Patchwork
2019-05-25 10:39 ` ✗ Fi.CI.IGT: failure " Patchwork
2019-05-25 11:47   ` Michal Wajdeczko

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=20190523233049.28020-16-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.