[Intel-gfx] [PATCH 1/5] drm/i915/uc: Rename intel_?uc_{setup, load}() to _init_hw()

Michal Wajdeczko michal.wajdeczko at intel.com
Tue Feb 14 19:14:20 UTC 2017


On Tue, Feb 14, 2017 at 05:15:37PM +0100, Arkadiusz Hiler wrote:
> GuC historically has two "startup" functions called _init() and _setup()
> 
> Then HuC came with it's _init() and _load().
> 
> To make naming more consistent this commit renames intel_guc_setup() and
> intel_huc_load() to *uc_init_hw() as it it seams more fitting - they are
> called from the i915_gem_init_hw().
> 
> Cc: Anusha Srivatsa <anusha.srivatsa at intel.com>
> Cc: Michal Winiarski <michal.winiarski at intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem.c         |  2 +-
>  drivers/gpu/drm/i915/intel_guc_loader.c | 14 +++++++-------
>  drivers/gpu/drm/i915/intel_huc.c        |  6 +++---
>  drivers/gpu/drm/i915/intel_uc.h         |  4 ++--
>  4 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 7129792..5234c76 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -4478,7 +4478,7 @@ int i915_gem_init_hw(struct drm_i915_private *dev_priv)
>  	intel_mocs_init_l3cc_table(dev_priv);
>  
>  	/* We can't enable contexts until all firmware is loaded */
> -	ret = intel_guc_setup(dev_priv);
> +	ret = intel_guc_init_hw(dev_priv);
>  	if (ret)
>  		goto out;
>  
> diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c
> index 8ef33d8..f5efe28 100644
> --- a/drivers/gpu/drm/i915/intel_guc_loader.c
> +++ b/drivers/gpu/drm/i915/intel_guc_loader.c
> @@ -428,19 +428,19 @@ static int guc_hw_reset(struct drm_i915_private *dev_priv)
>  }
>  
>  /**
> - * intel_guc_setup() - finish preparing the GuC for activity
> + * intel_guc_init_hw() - finish preparing the GuC for activity
>   * @dev_priv:	i915 device private
>   *
> - * Called from gem_init_hw() during driver loading and also after a GPU reset.
> + * Called during driver loading and also after a GPU reset.
>   *
>   * The main action required here it to load the GuC uCode into the device.
>   * The firmware image should have already been fetched into memory by the
> - * earlier call to intel_guc_init(), so here we need only check that worked,
> - * and then transfer the image to the h/w.
> + * earlier call to intel_guc_init(), so here we need only check that
> + * worked, and then transfer the image to the h/w.
>   *
>   * Return:	non-zero code on error
>   */
> -int intel_guc_setup(struct drm_i915_private *dev_priv)
> +int intel_guc_init_hw(struct drm_i915_private *dev_priv)
>  {
>  	struct intel_uc_fw *guc_fw = &dev_priv->guc.fw;
>  	const char *fw_path = guc_fw->path;
> @@ -506,7 +506,7 @@ int intel_guc_setup(struct drm_i915_private *dev_priv)
>  		if (err)
>  			goto fail;
>  
> -		intel_huc_load(dev_priv);
> +		intel_huc_init_hw(dev_priv);
>  		err = guc_ucode_xfer(dev_priv);
>  		if (!err)
>  			break;
> @@ -732,7 +732,7 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv,
>   * Called early during driver load, but after GEM is initialised.
>   *
>   * The firmware will be transferred to the GuC's memory later,
> - * when intel_guc_setup() is called.
> + * when intel_guc_init_hw() is called.
>   */
>  void intel_guc_init(struct drm_i915_private *dev_priv)

Can we also pick better name for this function?
Hint: it operates mostly on fw struct, so maybe:

	void intel_guc_fw_init(struct drm_i915_private *dev_priv)

Then we can use new intel_guc_init[early]() to hold initialization code that
now is in intel_uc_init_early() which also breaks consistency


>  {
> diff --git a/drivers/gpu/drm/i915/intel_huc.c b/drivers/gpu/drm/i915/intel_huc.c
> index c144609..94d369b 100644
> --- a/drivers/gpu/drm/i915/intel_huc.c
> +++ b/drivers/gpu/drm/i915/intel_huc.c
> @@ -150,7 +150,7 @@ static int huc_ucode_xfer(struct drm_i915_private *dev_priv)
>   * is not capable or driver yet support it. And there will be no error message
>   * for INTEL_UC_FIRMWARE_NONE cases.
>   *
> - * The DMA-copying to HW is done later when intel_huc_load() is called.
> + * The DMA-copying to HW is done later when intel_huc_init_hw() is called.
>   */
>  void intel_huc_init(struct drm_i915_private *dev_priv)
>  {
> @@ -191,7 +191,7 @@ void intel_huc_init(struct drm_i915_private *dev_priv)
>  }
>  
>  /**
> - * intel_huc_load() - load HuC uCode to device
> + * intel_huc_init_hw() - load HuC uCode to device
>   * @dev_priv: the drm_i915_private device
>   *
>   * Called from guc_setup() during driver loading and also after a GPU reset.
> @@ -203,7 +203,7 @@ void intel_huc_init(struct drm_i915_private *dev_priv)
>   *
>   * Return:	non-zero code on error
>   */
> -int intel_huc_load(struct drm_i915_private *dev_priv)
> +int intel_huc_init_hw(struct drm_i915_private *dev_priv)
>  {
>  	struct intel_uc_fw *huc_fw = &dev_priv->huc.fw;
>  	int err;
> diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
> index d74f4d3..dd34a1b 100644
> --- a/drivers/gpu/drm/i915/intel_uc.h
> +++ b/drivers/gpu/drm/i915/intel_uc.h
> @@ -190,7 +190,7 @@ int intel_guc_sample_forcewake(struct intel_guc *guc);
>  
>  /* intel_guc_loader.c */
>  extern void intel_guc_init(struct drm_i915_private *dev_priv);
> -extern int intel_guc_setup(struct drm_i915_private *dev_priv);
> +extern int intel_guc_init_hw(struct drm_i915_private *dev_priv);
>  extern void intel_guc_fini(struct drm_i915_private *dev_priv);
>  extern const char *intel_uc_fw_status_repr(enum intel_uc_fw_status status);
>  extern int intel_guc_suspend(struct drm_i915_private *dev_priv);
> @@ -225,7 +225,7 @@ static inline u32 guc_ggtt_offset(struct i915_vma *vma)
>  /* intel_huc.c */
>  void intel_huc_init(struct drm_i915_private *dev_priv);
>  void intel_huc_fini(struct drm_i915_private  *dev_priv);
> -int intel_huc_load(struct drm_i915_private *dev_priv);
> +int intel_huc_init_hw(struct drm_i915_private *dev_priv);

btw, for some functions we are using explicit "extern" (see above)
can we also unify this (one way or another)


Regards,
Michal  

>  void intel_guc_auth_huc(struct drm_i915_private *dev_priv);
>  
>  #endif
> -- 
> 2.9.3
> 


More information about the Intel-gfx mailing list