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 v3 13/19] drm/i915/huc: New HuC status register for Gen11
Date: Wed, 17 Apr 2019 05:39:58 +0000	[thread overview]
Message-ID: <20190417054004.28176-14-michal.wajdeczko@intel.com> (raw)
In-Reply-To: <20190417054004.28176-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>
---
 drivers/gpu/drm/i915/intel_guc_reg.h |  3 +++
 drivers/gpu/drm/i915/intel_huc.c     | 26 +++++++++++++++++++-------
 drivers/gpu/drm/i915/intel_huc.h     |  6 ++++++
 3 files changed, 28 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 94c04f16a2ad..70042f108048 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)
@@ -56,7 +68,6 @@ int intel_huc_auth(struct intel_huc *huc)
 	struct drm_i915_private *i915 = huc_to_i915(huc);
 	struct intel_guc *guc = &i915->guc;
 	struct i915_vma *vma;
-	u32 status;
 	int ret;
 
 	if (huc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
@@ -80,12 +91,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_unpin;
 	}
 
@@ -122,7 +133,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 7e41d870b509..c539794e4bd4 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"
 
@@ -33,6 +34,11 @@ struct intel_huc {
 	struct intel_uc_fw fw;
 
 	/* HuC-specific additions */
+	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-04-17  5:40 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-17  5:39 [PATCH v3 00/19] GuC 32.0.3 Michal Wajdeczko
2019-04-17  5:39 ` [PATCH v3 01/19] drm/i915/guc: Change platform default GuC mode Michal Wajdeczko
2019-04-18 13:59   ` Ye, Tony
2019-04-22 20:29   ` Sujaritha
2019-04-17  5:39 ` [PATCH v3 02/19] drm/i915/guc: Don't allow GuC submission Michal Wajdeczko
2019-04-17  7:14   ` Martin Peres
2019-04-17  5:39 ` [PATCH v3 03/19] drm/i915/guc: Update GuC firmware versions and names Michal Wajdeczko
2019-04-17  5:39 ` [PATCH v3 04/19] drm/i915/guc: Update GuC firmware CSS header Michal Wajdeczko
2019-04-17 17:35   ` Daniele Ceraolo Spurio
2019-04-17  5:39 ` [PATCH v3 05/19] drm/i915/guc: Update GuC boot parameters Michal Wajdeczko
2019-04-17  5:39 ` [PATCH v3 06/19] drm/i915/guc: Update suspend/resume protocol Michal Wajdeczko
2019-04-17  5:39 ` [PATCH v3 07/19] drm/i915/guc: Update GuC sample-forcewake command Michal Wajdeczko
2019-04-17  5:39 ` [PATCH v3 08/19] drm/i915/guc: Update GuC ADS object definition Michal Wajdeczko
2019-04-17 17:37   ` Daniele Ceraolo Spurio
2019-04-17  5:39 ` [PATCH v3 09/19] drm/i915/guc: Reset GuC ADS during sanitize Michal Wajdeczko
2019-04-17  5:39 ` [PATCH v3 10/19] drm/i915/guc: Always ask GuC to update power domain states Michal Wajdeczko
2019-04-17  5:39 ` [PATCH v3 11/19] drm/i915/guc: New GuC interrupt register for Gen11 Michal Wajdeczko
2019-04-17  5:39 ` [PATCH v3 12/19] drm/i915/guc: New GuC scratch registers " Michal Wajdeczko
2019-04-17  5:39 ` Michal Wajdeczko [this message]
2019-04-17 17:39   ` [PATCH v3 13/19] drm/i915/huc: New HuC status register " Daniele Ceraolo Spurio
2019-04-17  5:39 ` [PATCH v3 14/19] drm/i915/guc: Create vfuncs for the GuC interrupts control functions Michal Wajdeczko
2019-04-17  5:40 ` [PATCH v3 15/19] drm/i915/guc: Correctly handle GuC interrupts on Gen11 Michal Wajdeczko
2019-04-17  5:40 ` [PATCH v3 16/19] drm/i915/guc: Update GuC CTB response definition Michal Wajdeczko
2019-04-17  5:40 ` [PATCH v3 17/19] drm/i915/guc: Enable GuC CTB communication on Gen11 Michal Wajdeczko
2019-04-17  5:40 ` [PATCH v3 18/19] drm/i915/guc: Define GuC firmware version for Icelake Michal Wajdeczko
2019-04-17  5:40 ` [PATCH v3 19/19] drm/i915/huc: Define HuC " Michal Wajdeczko
2019-04-17  6:32 ` ✗ Fi.CI.SPARSE: warning for GuC 32.0.3 (rev4) Patchwork
2019-04-17  6:40 ` ✓ Fi.CI.BAT: success " Patchwork
2019-04-17 13:23 ` ✓ Fi.CI.IGT: " Patchwork
2019-04-19 19:53 ` [PATCH v3 00/19] GuC 32.0.3 Chris Wilson

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=20190417054004.28176-14-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.