提交 9a2cbf2d 编写于 作者: S Sagar Arun Kamble 提交者: Joonas Lahtinen

drm/i915/huc: Reorganize HuC authentication

Prepared intel_auth_huc to separate HuC specific functionality
from GuC send action. Created new header intel_huc.h to group
HuC specific declarations.

v2: Changed argument preparation for AUTHENTICATE_HUC.
s/intel_auth_huc/intel_huc_auth. Deferred creation of intel_huc.h
to later patch.

v3: Rebase as intel_guc.h is removed. Added param description to
intel_huc_auth. (Michal)

v4: Rebase as intel_guc.h is added again. :)

v5: Rebase w.r.t removal of GuC code restructuring.

v6-v7: Rebase.

v8: Tagged subject as drm/i915/huc. (Michal Wajdeczko)
Added kernel-doc description to intel_huc_auth and intel_guc_auth_huc.
s/dev_priv/i915 and removed unnecessary variable offset. (Joonas)

v9: Rebase. Had conflict with i915_modparams change.
Signed-off-by: NSagar Arun Kamble <sagar.a.kamble@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Michał Winiarski <michal.winiarski@intel.com>
Reviewed-by: NMichal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1506410236-17926-1-git-send-email-sagar.a.kamble@intel.com
上级 ad0c1672
...@@ -225,19 +225,22 @@ void intel_huc_init_hw(struct intel_huc *huc) ...@@ -225,19 +225,22 @@ void intel_huc_init_hw(struct intel_huc *huc)
} }
/** /**
* intel_guc_auth_huc() - authenticate ucode * intel_huc_auth() - Authenticate HuC uCode
* @dev_priv: the drm_i915_device * @huc: intel_huc structure
*
* Called after HuC and GuC firmware loading during intel_uc_init_hw().
* *
* Triggers a HuC fw authentication request to the GuC via intel_guc_action_ * This function pins HuC firmware image object into GGTT.
* authenticate_huc interface. * Then it invokes GuC action to authenticate passing the offset to RSA
* signature through intel_guc_auth_huc(). It then waits for 50ms for
* firmware verification ACK and unpins the object.
*/ */
void intel_guc_auth_huc(struct drm_i915_private *dev_priv) void intel_huc_auth(struct intel_huc *huc)
{ {
struct intel_guc *guc = &dev_priv->guc; struct drm_i915_private *i915 = huc_to_i915(huc);
struct intel_huc *huc = &dev_priv->huc; struct intel_guc *guc = &i915->guc;
struct i915_vma *vma; struct i915_vma *vma;
int ret; int ret;
u32 data[2];
if (huc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS) if (huc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
return; return;
...@@ -250,23 +253,19 @@ void intel_guc_auth_huc(struct drm_i915_private *dev_priv) ...@@ -250,23 +253,19 @@ void intel_guc_auth_huc(struct drm_i915_private *dev_priv)
return; return;
} }
/* Specify auth action and where public signature is. */ ret = intel_guc_auth_huc(guc,
data[0] = INTEL_GUC_ACTION_AUTHENTICATE_HUC; guc_ggtt_offset(vma) + huc->fw.rsa_offset);
data[1] = guc_ggtt_offset(vma) + huc->fw.rsa_offset;
ret = intel_guc_send(guc, data, ARRAY_SIZE(data));
if (ret) { if (ret) {
DRM_ERROR("HuC: GuC did not ack Auth request %d\n", ret); DRM_ERROR("HuC: GuC did not ack Auth request %d\n", ret);
goto out; goto out;
} }
/* Check authentication status, it should be done by now */ /* Check authentication status, it should be done by now */
ret = intel_wait_for_register(dev_priv, ret = intel_wait_for_register(i915,
HUC_STATUS2, HUC_STATUS2,
HUC_FW_VERIFIED, HUC_FW_VERIFIED,
HUC_FW_VERIFIED, HUC_FW_VERIFIED,
50); 50);
if (ret) { if (ret) {
DRM_ERROR("HuC: Authentication failed %d\n", ret); DRM_ERROR("HuC: Authentication failed %d\n", ret);
goto out; goto out;
...@@ -275,4 +274,3 @@ void intel_guc_auth_huc(struct drm_i915_private *dev_priv) ...@@ -275,4 +274,3 @@ void intel_guc_auth_huc(struct drm_i915_private *dev_priv)
out: out:
i915_vma_unpin(vma); i915_vma_unpin(vma);
} }
...@@ -328,6 +328,27 @@ static void guc_disable_communication(struct intel_guc *guc) ...@@ -328,6 +328,27 @@ static void guc_disable_communication(struct intel_guc *guc)
guc->send = intel_guc_send_nop; guc->send = intel_guc_send_nop;
} }
/**
* intel_guc_auth_huc() - Send action to GuC to authenticate HuC ucode
* @guc: intel_guc structure
* @rsa_offset: rsa offset w.r.t ggtt base of huc vma
*
* Triggers a HuC firmware authentication request to the GuC via intel_guc_send
* INTEL_GUC_ACTION_AUTHENTICATE_HUC interface. This function is invoked by
* intel_huc_auth().
*
* Return: non-zero code on error
*/
int intel_guc_auth_huc(struct intel_guc *guc, u32 rsa_offset)
{
u32 action[] = {
INTEL_GUC_ACTION_AUTHENTICATE_HUC,
rsa_offset
};
return intel_guc_send(guc, action, ARRAY_SIZE(action));
}
int intel_uc_init_hw(struct drm_i915_private *dev_priv) int intel_uc_init_hw(struct drm_i915_private *dev_priv)
{ {
struct intel_guc *guc = &dev_priv->guc; struct intel_guc *guc = &dev_priv->guc;
...@@ -390,7 +411,7 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv) ...@@ -390,7 +411,7 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
if (ret) if (ret)
goto err_log_capture; goto err_log_capture;
intel_guc_auth_huc(dev_priv); intel_huc_auth(&dev_priv->huc);
if (i915_modparams.enable_guc_submission) { if (i915_modparams.enable_guc_submission) {
if (i915_modparams.guc_log_level >= 0) if (i915_modparams.guc_log_level >= 0)
gen9_enable_guc_interrupts(dev_priv); gen9_enable_guc_interrupts(dev_priv);
......
...@@ -211,6 +211,7 @@ void intel_uc_fini_hw(struct drm_i915_private *dev_priv); ...@@ -211,6 +211,7 @@ void intel_uc_fini_hw(struct drm_i915_private *dev_priv);
int intel_guc_sample_forcewake(struct intel_guc *guc); int intel_guc_sample_forcewake(struct intel_guc *guc);
int intel_guc_send_nop(struct intel_guc *guc, const u32 *action, u32 len); int intel_guc_send_nop(struct intel_guc *guc, const u32 *action, u32 len);
int intel_guc_send_mmio(struct intel_guc *guc, const u32 *action, u32 len); int intel_guc_send_mmio(struct intel_guc *guc, const u32 *action, u32 len);
int intel_guc_auth_huc(struct intel_guc *guc, u32 rsa_offset);
static inline int intel_guc_send(struct intel_guc *guc, const u32 *action, u32 len) static inline int intel_guc_send(struct intel_guc *guc, const u32 *action, u32 len)
{ {
...@@ -254,6 +255,6 @@ static inline u32 guc_ggtt_offset(struct i915_vma *vma) ...@@ -254,6 +255,6 @@ static inline u32 guc_ggtt_offset(struct i915_vma *vma)
/* intel_huc.c */ /* intel_huc.c */
void intel_huc_select_fw(struct intel_huc *huc); void intel_huc_select_fw(struct intel_huc *huc);
void intel_huc_init_hw(struct intel_huc *huc); void intel_huc_init_hw(struct intel_huc *huc);
void intel_guc_auth_huc(struct drm_i915_private *dev_priv); void intel_huc_auth(struct intel_huc *huc);
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册