[Intel-gfx] [PATCH v3 7/8] drm/i915/huc: Load HuC only if requested

Sagar Arun Kamble sagar.a.kamble at intel.com
Wed Dec 6 09:12:07 UTC 2017



On 12/5/2017 10:08 PM, Michal Wajdeczko wrote:
> Our new "enable_guc" modparam allows to control whenever HuC
> should be loaded. However existing code will try load and
> authenticate HuC always when we use the GuC. This patch is
> trying to enforce modparam selection.
>
> v2: no need to cast PTR_ERR (Chris)
>      fetch/fini only if required (Michal)
>      fix wrong break (Sagar)
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> Cc: Sagar Arun Kamble <sagar.a.kamble at intel.com>

<snip>

>   /**
> @@ -186,6 +190,7 @@ static void guc_disable_communication(struct intel_guc *guc)
>   int intel_uc_init_hw(struct drm_i915_private *dev_priv)
>   {
>   	struct intel_guc *guc = &dev_priv->guc;
> +	struct intel_huc *huc = &dev_priv->huc;
>   	int ret, attempts;
>   
>   	if (!USES_GUC(dev_priv))
> @@ -233,7 +238,12 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
>   		if (ret)
>   			goto err_submission;
>   
> -		intel_huc_init_hw(&dev_priv->huc);
> +		if (USES_HUC(dev_priv)) {
> +			ret = intel_huc_init_hw(huc);
> +			if (ret)
> +				goto err_submission;
> +		}
> +
>   		intel_guc_init_params(guc);
>   		ret = intel_guc_fw_upload(guc);
>   		if (ret == 0 || ret != -EAGAIN)
> @@ -251,7 +261,12 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
>   	if (ret)
>   		goto err_log_capture;
>   
> -	intel_huc_auth(&dev_priv->huc);
> +	if (USES_HUC(dev_priv)) {
> +		ret = intel_huc_auth(huc);
> +		if (ret)
> +			goto err_interrupts;

I think we need to create new label "err_communication" and jump there since interrupts are not yet enabled.
Planning to move interrupts enabling before enabling communication in the other series - https://patchwork.freedesktop.org/patch/183349/

With that updated patch looks good to me.
Reviewed-by: Sagar Arun Kamble <sagar.a.kamble at intel.com>

> +	}
> +
>   	if (USES_GUC_SUBMISSION(dev_priv)) {
>   		if (i915_modparams.guc_log_level >= 0)
>   			gen9_enable_guc_interrupts(dev_priv);
> @@ -265,6 +280,8 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
>   		 guc->fw.major_ver_found, guc->fw.minor_ver_found);
>   	dev_info(dev_priv->drm.dev, "GuC submission %s\n",
>   		 enableddisabled(USES_GUC_SUBMISSION(dev_priv)));
> +	dev_info(dev_priv->drm.dev, "HuC %s\n",
> +		 enableddisabled(USES_HUC(dev_priv)));
>   
>   	return 0;
>   



More information about the Intel-gfx mailing list