drm/i915/uc: Fetch GuC/HuC firmwares from guc/huc specific init
We're fetching GuC/HuC firmwares directly from uc level during init_early stage but this breaks guc/huc struct isolation and also strict SW-only initialization rule for init_early. Move fw fetching to init phase and do it separately per guc/huc struct. v2: don't forget to move wopcm_init - Michele v3: fetch in init_misc phase - Michal Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Cc: Michel Thierry <michel.thierry@intel.com> Reviewed-by: Michel Thierry <michel.thierry@intel.com> #2 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Link: https://patchwork.freedesktop.org/patch/msgid/20180628141522.62788-2-michal.wajdeczko@intel.com
This commit is contained in:
parent
c39d2e7e35
commit
f7dc0157e4
@ -5459,14 +5459,14 @@ int i915_gem_init(struct drm_i915_private *dev_priv)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = intel_wopcm_init(&dev_priv->wopcm);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
ret = intel_uc_init_misc(dev_priv);
|
ret = intel_uc_init_misc(dev_priv);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
ret = intel_wopcm_init(&dev_priv->wopcm);
|
||||||
|
if (ret)
|
||||||
|
goto err_uc_misc;
|
||||||
|
|
||||||
/* This is just a security blanket to placate dragons.
|
/* This is just a security blanket to placate dragons.
|
||||||
* On some systems, we very sporadically observe that the first TLBs
|
* On some systems, we very sporadically observe that the first TLBs
|
||||||
* used by the CS may be stale, despite us poking the TLB reset. If
|
* used by the CS may be stale, despite us poking the TLB reset. If
|
||||||
@ -5563,6 +5563,7 @@ err_unlock:
|
|||||||
intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
|
intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
|
||||||
mutex_unlock(&dev_priv->drm.struct_mutex);
|
mutex_unlock(&dev_priv->drm.struct_mutex);
|
||||||
|
|
||||||
|
err_uc_misc:
|
||||||
intel_uc_fini_misc(dev_priv);
|
intel_uc_fini_misc(dev_priv);
|
||||||
|
|
||||||
if (ret != -EIO)
|
if (ret != -EIO)
|
||||||
|
@ -139,6 +139,7 @@ static void guc_fini_wq(struct intel_guc *guc)
|
|||||||
|
|
||||||
int intel_guc_init_misc(struct intel_guc *guc)
|
int intel_guc_init_misc(struct intel_guc *guc)
|
||||||
{
|
{
|
||||||
|
struct drm_i915_private *i915 = guc_to_i915(guc);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
guc_init_ggtt_pin_bias(guc);
|
guc_init_ggtt_pin_bias(guc);
|
||||||
@ -147,11 +148,14 @@ int intel_guc_init_misc(struct intel_guc *guc)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
intel_uc_fw_fetch(i915, &guc->fw);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void intel_guc_fini_misc(struct intel_guc *guc)
|
void intel_guc_fini_misc(struct intel_guc *guc)
|
||||||
{
|
{
|
||||||
|
intel_uc_fw_fini(&guc->fw);
|
||||||
guc_fini_wq(guc);
|
guc_fini_wq(guc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +193,7 @@ int intel_guc_init(struct intel_guc *guc)
|
|||||||
|
|
||||||
ret = guc_shared_data_create(guc);
|
ret = guc_shared_data_create(guc);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
goto err_fetch;
|
||||||
GEM_BUG_ON(!guc->shared_data);
|
GEM_BUG_ON(!guc->shared_data);
|
||||||
|
|
||||||
ret = intel_guc_log_create(&guc->log);
|
ret = intel_guc_log_create(&guc->log);
|
||||||
@ -210,6 +214,8 @@ err_log:
|
|||||||
intel_guc_log_destroy(&guc->log);
|
intel_guc_log_destroy(&guc->log);
|
||||||
err_shared:
|
err_shared:
|
||||||
guc_shared_data_destroy(guc);
|
guc_shared_data_destroy(guc);
|
||||||
|
err_fetch:
|
||||||
|
intel_uc_fw_fini(&guc->fw);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,6 +227,7 @@ void intel_guc_fini(struct intel_guc *guc)
|
|||||||
intel_guc_ads_destroy(guc);
|
intel_guc_ads_destroy(guc);
|
||||||
intel_guc_log_destroy(&guc->log);
|
intel_guc_log_destroy(&guc->log);
|
||||||
guc_shared_data_destroy(guc);
|
guc_shared_data_destroy(guc);
|
||||||
|
intel_uc_fw_fini(&guc->fw);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 guc_ctl_debug_flags(struct intel_guc *guc)
|
static u32 guc_ctl_debug_flags(struct intel_guc *guc)
|
||||||
|
@ -32,6 +32,14 @@ void intel_huc_init_early(struct intel_huc *huc)
|
|||||||
intel_huc_fw_init_early(huc);
|
intel_huc_fw_init_early(huc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int intel_huc_init_misc(struct intel_huc *huc)
|
||||||
|
{
|
||||||
|
struct drm_i915_private *i915 = huc_to_i915(huc);
|
||||||
|
|
||||||
|
intel_uc_fw_fetch(i915, &huc->fw);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* intel_huc_auth() - Authenticate HuC uCode
|
* intel_huc_auth() - Authenticate HuC uCode
|
||||||
* @huc: intel_huc structure
|
* @huc: intel_huc structure
|
||||||
|
@ -36,9 +36,15 @@ struct intel_huc {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void intel_huc_init_early(struct intel_huc *huc);
|
void intel_huc_init_early(struct intel_huc *huc);
|
||||||
|
int intel_huc_init_misc(struct intel_huc *huc);
|
||||||
int intel_huc_auth(struct intel_huc *huc);
|
int intel_huc_auth(struct intel_huc *huc);
|
||||||
int intel_huc_check_status(struct intel_huc *huc);
|
int intel_huc_check_status(struct intel_huc *huc);
|
||||||
|
|
||||||
|
static inline void intel_huc_fini_misc(struct intel_huc *huc)
|
||||||
|
{
|
||||||
|
intel_uc_fw_fini(&huc->fw);
|
||||||
|
}
|
||||||
|
|
||||||
static inline int intel_huc_sanitize(struct intel_huc *huc)
|
static inline int intel_huc_sanitize(struct intel_huc *huc)
|
||||||
{
|
{
|
||||||
intel_uc_fw_sanitize(&huc->fw);
|
intel_uc_fw_sanitize(&huc->fw);
|
||||||
|
@ -171,24 +171,11 @@ void intel_uc_init_early(struct drm_i915_private *i915)
|
|||||||
intel_huc_init_early(huc);
|
intel_huc_init_early(huc);
|
||||||
|
|
||||||
sanitize_options_early(i915);
|
sanitize_options_early(i915);
|
||||||
|
|
||||||
if (USES_GUC(i915))
|
|
||||||
intel_uc_fw_fetch(i915, &guc->fw);
|
|
||||||
|
|
||||||
if (USES_HUC(i915))
|
|
||||||
intel_uc_fw_fetch(i915, &huc->fw);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void intel_uc_cleanup_early(struct drm_i915_private *i915)
|
void intel_uc_cleanup_early(struct drm_i915_private *i915)
|
||||||
{
|
{
|
||||||
struct intel_guc *guc = &i915->guc;
|
struct intel_guc *guc = &i915->guc;
|
||||||
struct intel_huc *huc = &i915->huc;
|
|
||||||
|
|
||||||
if (USES_HUC(i915))
|
|
||||||
intel_uc_fw_fini(&huc->fw);
|
|
||||||
|
|
||||||
if (USES_GUC(i915))
|
|
||||||
intel_uc_fw_fini(&guc->fw);
|
|
||||||
|
|
||||||
guc_free_load_err_log(guc);
|
guc_free_load_err_log(guc);
|
||||||
}
|
}
|
||||||
@ -252,6 +239,7 @@ static void guc_disable_communication(struct intel_guc *guc)
|
|||||||
int intel_uc_init_misc(struct drm_i915_private *i915)
|
int intel_uc_init_misc(struct drm_i915_private *i915)
|
||||||
{
|
{
|
||||||
struct intel_guc *guc = &i915->guc;
|
struct intel_guc *guc = &i915->guc;
|
||||||
|
struct intel_huc *huc = &i915->huc;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!USES_GUC(i915))
|
if (!USES_GUC(i915))
|
||||||
@ -261,16 +249,30 @@ int intel_uc_init_misc(struct drm_i915_private *i915)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
if (USES_HUC(i915)) {
|
||||||
|
ret = intel_huc_init_misc(huc);
|
||||||
|
if (ret)
|
||||||
|
goto err_guc;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err_guc:
|
||||||
|
intel_guc_fini_misc(guc);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void intel_uc_fini_misc(struct drm_i915_private *i915)
|
void intel_uc_fini_misc(struct drm_i915_private *i915)
|
||||||
{
|
{
|
||||||
struct intel_guc *guc = &i915->guc;
|
struct intel_guc *guc = &i915->guc;
|
||||||
|
struct intel_huc *huc = &i915->huc;
|
||||||
|
|
||||||
if (!USES_GUC(i915))
|
if (!USES_GUC(i915))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (USES_HUC(i915))
|
||||||
|
intel_huc_fini_misc(huc);
|
||||||
|
|
||||||
intel_guc_fini_misc(guc);
|
intel_guc_fini_misc(guc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user