diff options
author | Michal Wajdeczko <michal.wajdeczko@intel.com> | 2018-09-03 16:46:47 +0200 |
---|---|---|
committer | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2019-05-01 10:40:21 +0100 |
commit | c722d750c85de37e204222bf0a400de107fe5812 (patch) | |
tree | f215b9435d961ffb3392709b9b11a540c6e73ab9 | |
parent | 4519b2001b7f3ecbb0f19681f234080ffd3758e6 (diff) |
drm/i915/huc: New HuC status register for Gen11
Gen11 defines new register for checking HuC authentication status.
Look into the right register and bit.
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: Michel Thierry <michel.thierry@intel.com>
Cc: John Spotswood <john.a.spotswood@intel.com>
Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
Reviewed-by: John Spotswood <john.a.spotswood@intel.com>
-rw-r--r-- | drivers/gpu/drm/i915/intel_guc_reg.h | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_huc.c | 59 |
2 files changed, 53 insertions, 9 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..35c6ed6f3062 100644 --- a/drivers/gpu/drm/i915/intel_huc.c +++ b/drivers/gpu/drm/i915/intel_huc.c @@ -95,6 +95,47 @@ void intel_huc_fini(struct intel_huc *huc) intel_huc_rsa_data_destroy(huc); } +static int gen8_huc_wait_verified(struct intel_huc *huc) +{ + struct drm_i915_private *i915 = huc_to_i915(huc); + u32 status; + int ret; + + ret = __intel_wait_for_register(&i915->uncore, + HUC_STATUS2, + HUC_FW_VERIFIED, + HUC_FW_VERIFIED, + 2, 50, &status); + if (ret) + DRM_ERROR("HuC: status %#x\n", status); + return ret; +} + +static int gen11_huc_wait_verified(struct intel_huc *huc) +{ + struct drm_i915_private *i915 = huc_to_i915(huc); + int ret; + + ret = __intel_wait_for_register(&i915->uncore, + GEN11_HUC_KERNEL_LOAD_INFO, + HUC_LOAD_SUCCESSFUL, + HUC_LOAD_SUCCESSFUL, + 2, 50, NULL); + return ret; +} + +static int huc_wait_verified(struct intel_huc *huc) +{ + struct drm_i915_private *i915 = huc_to_i915(huc); + int ret; + + if (INTEL_GEN(i915) >= 11) + ret = gen11_huc_wait_verified(huc); + else + ret = gen8_huc_wait_verified(huc); + return ret; +} + /** * intel_huc_auth() - Authenticate HuC uCode * @huc: intel_huc structure @@ -110,7 +151,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) @@ -124,13 +164,9 @@ 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); + ret = huc_wait_verified(huc); if (ret) { - DRM_ERROR("HuC: Firmware not verified %#x\n", status); + DRM_ERROR("HuC: Firmware not verified %d\n", ret); goto fail; } @@ -163,8 +199,13 @@ int intel_huc_check_status(struct intel_huc *huc) if (!HAS_HUC(dev_priv)) return -ENODEV; - with_intel_runtime_pm(dev_priv, wakeref) - status = I915_READ(HUC_STATUS2) & HUC_FW_VERIFIED; + with_intel_runtime_pm(dev_priv, wakeref) { + if (INTEL_GEN(dev_priv) >= 11) + status = I915_READ(GEN11_HUC_KERNEL_LOAD_INFO) & + HUC_LOAD_SUCCESSFUL; + else + status = I915_READ(HUC_STATUS2) & HUC_FW_VERIFIED; + } return status; } |