diff mbox

[4/5] drm/i915/guc: group initialization of GuC objects

Message ID 1507071420-23339-1-git-send-email-sujaritha.sundaresan@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sundaresan, Sujaritha Oct. 3, 2017, 10:57 p.m. UTC
The previous patch has split up the initialization of some of the GuC
objects in 2 different functions, let's pull them back together.

v3: Group initialization of GuC objects

v2: Decoupling ADS together with logs (Daniele)

v3: Rebase

v4: Rebase

v5: Separated from previous patch

Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Oscar Mateo <oscar.mateo@intel.com>
Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>
Signed-off-by: Sujaritha Sundaresan <sujaritha.sundaresan@intel.com>
---
 drivers/gpu/drm/i915/i915_guc_submission.c |  7 ++---
 drivers/gpu/drm/i915/intel_uc.c            | 41 +++++++++++++++++-------------
 drivers/gpu/drm/i915/intel_uc.h            |  4 +--
 3 files changed, 28 insertions(+), 24 deletions(-)

Comments

sagar.a.kamble@intel.com Oct. 4, 2017, 7:02 a.m. UTC | #1
On 10/4/2017 4:27 AM, Sujaritha Sundaresan wrote:
> The previous patch has split up the initialization of some of the GuC
> objects in 2 different functions, let's pull them back together.
>
> v3: Group initialization of GuC objects
>
> v2: Decoupling ADS together with logs (Daniele)
>
> v3: Rebase
>
> v4: Rebase
>
> v5: Separated from previous patch
>
> Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Oscar Mateo <oscar.mateo@intel.com>
> Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>
> Signed-off-by: Sujaritha Sundaresan <sujaritha.sundaresan@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_guc_submission.c |  7 ++---
>   drivers/gpu/drm/i915/intel_uc.c            | 41 +++++++++++++++++-------------
>   drivers/gpu/drm/i915/intel_uc.h            |  4 +--
>   3 files changed, 28 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
> index c456c55..a351339 100644
> --- a/drivers/gpu/drm/i915/i915_guc_submission.c
> +++ b/drivers/gpu/drm/i915/i915_guc_submission.c
> @@ -920,9 +920,8 @@ void i915_guc_policies_init(struct guc_policies *policies)
>    * Set up the memory resources to be shared with the GuC (via the GGTT)
>    * at firmware loading time.
>    */
> -int i915_guc_submission_init(struct drm_i915_private *dev_priv)
> +int i915_guc_submission_shared_objects_init(struct intel_guc *guc)
Squash next patch into this. Argument dev_priv fits here.
>   {
> -	struct intel_guc *guc = &dev_priv->guc;
>   	struct i915_vma *vma;
>   	void *vaddr;
>   
> @@ -950,10 +949,8 @@ int i915_guc_submission_init(struct drm_i915_private *dev_priv)
>   	return 0;
>   }
>   
> -void i915_guc_submission_fini(struct drm_i915_private *dev_priv)
> +void i915_guc_submission_shared_objects_fini(struct intel_guc *guc)
>   {
> -	struct intel_guc *guc = &dev_priv->guc;
> -
>   	ida_destroy(&guc->stage_ids);
>   	i915_gem_object_unpin_map(guc->stage_desc_pool->obj);
>   	i915_vma_unpin_and_release(&guc->stage_desc_pool);
> diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c
> index 732f188..69239e4 100644
> --- a/drivers/gpu/drm/i915/intel_uc.c
> +++ b/drivers/gpu/drm/i915/intel_uc.c
> @@ -423,13 +423,33 @@ static int guc_shared_objects_init(struct intel_guc *guc)
>   
>   	ret = guc_ads_create(guc);
>   	if (ret < 0)
> -		intel_guc_log_destroy(guc);
> +		goto err_logs;
> +
> +	if (i915_modparams.enable_guc_submission) {
> +		/*
> +		 * This is stuff we need to have available at fw load time
> +		 * if we are planning to enable submission later
> +		 */
> +		ret = i915_guc_submission_shared_objects_init(guc);
> +		if (ret)
> +			goto err_ads;
> +	}
> +
> +	return 0;
> +
> +err_ads:
> +	guc_ads_destroy(guc);
> +err_logs:
> +	intel_guc_log_destroy(guc);
>   
>   	return ret;
>   }
>   
>   static void guc_shared_objects_fini(struct intel_guc *guc)
>   {
> +	if (i915_modparams.enable_guc_submission)
> +		i915_guc_submission_shared_objects_fini(guc);
> +
>   	guc_ads_destroy(guc);
>   	intel_guc_log_destroy(guc);
>   }
> @@ -452,16 +472,6 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
>   	if (ret)
>   		goto err_guc;
>   
> -	if (i915_modparams.enable_guc_submission) {
> -		/*
> -		 * This is stuff we need to have available at fw load time
> -		 * if we are planning to enable submission later
> -		 */
> -		ret = i915_guc_submission_init(dev_priv);
> -		if (ret)
> -			goto err_shared;
> -	}
> -
>   	/* init WOPCM */
>   	I915_WRITE(GUC_WOPCM_SIZE, intel_guc_wopcm_size(dev_priv));
>   	I915_WRITE(DMA_GUC_WOPCM_OFFSET,
> @@ -481,7 +491,7 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
>   		 */
>   		ret = __intel_uc_reset_hw(dev_priv);
>   		if (ret)
> -			goto err_submission;
> +			goto err_shared;
>   
>   		intel_huc_init_hw(&dev_priv->huc);
>   		ret = intel_guc_init_hw(&dev_priv->guc);
> @@ -526,11 +536,8 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
>   	gen9_disable_guc_interrupts(dev_priv);
>   err_log_capture:
>   	guc_capture_load_err_log(guc);
> -err_submission:
> -	if (i915_modparams.enable_guc_submission)
> -		i915_guc_submission_fini(dev_priv);
>   err_shared:
> -		guc_shared_objects_fini(guc);
> +	guc_shared_objects_fini(guc);
>   err_guc:
>   	i915_ggtt_disable_guc(dev_priv);
>   
> @@ -567,7 +574,7 @@ void intel_uc_fini_hw(struct drm_i915_private *dev_priv)
>   
>   	if (i915_modparams.enable_guc_submission) {
>   		gen9_disable_guc_interrupts(dev_priv);
> -		i915_guc_submission_fini(dev_priv);
> +		i915_guc_submission_shared_objects_fini(dev_priv);
>   	}
>   
>   	guc_shared_objects_fini(&dev_priv->guc);
> diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
> index 0d12ff4..5106046 100644
> --- a/drivers/gpu/drm/i915/intel_uc.h
> +++ b/drivers/gpu/drm/i915/intel_uc.h
> @@ -230,10 +230,10 @@ static inline void intel_guc_notify(struct intel_guc *guc)
>   u32 intel_guc_wopcm_size(struct drm_i915_private *dev_priv);
>   
>   /* i915_guc_submission.c */
> -int i915_guc_submission_init(struct drm_i915_private *dev_priv);
> +int i915_guc_submission_shared_objects_init(struct intel_guc *guc);
>   int i915_guc_submission_enable(struct drm_i915_private *dev_priv);
>   void i915_guc_submission_disable(struct drm_i915_private *dev_priv);
> -void i915_guc_submission_fini(struct drm_i915_private *dev_priv);
> +void i915_guc_submission_shared_objects_fini(struct intel_guc *guc);
>   struct i915_vma *intel_guc_allocate_vma(struct intel_guc *guc, u32 size);
>   void i915_guc_policies_init(struct guc_policies *policies);
>
Michal Wajdeczko Oct. 4, 2017, 1:58 p.m. UTC | #2
On Wed, 04 Oct 2017 00:57:00 +0200, Sujaritha Sundaresan  
<sujaritha.sundaresan@intel.com> wrote:

> The previous patch has split up the initialization of some of the GuC
> objects in 2 different functions, let's pull them back together.
>
> v3: Group initialization of GuC objects
>
> v2: Decoupling ADS together with logs (Daniele)
>
> v3: Rebase
>
> v4: Rebase
>
> v5: Separated from previous patch
>
> Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Oscar Mateo <oscar.mateo@intel.com>
> Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>
> Signed-off-by: Sujaritha Sundaresan <sujaritha.sundaresan@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_guc_submission.c |  7 ++---
>  drivers/gpu/drm/i915/intel_uc.c            | 41  
> +++++++++++++++++-------------
>  drivers/gpu/drm/i915/intel_uc.h            |  4 +--
>  3 files changed, 28 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c  
> b/drivers/gpu/drm/i915/i915_guc_submission.c
> index c456c55..a351339 100644
> --- a/drivers/gpu/drm/i915/i915_guc_submission.c
> +++ b/drivers/gpu/drm/i915/i915_guc_submission.c
> @@ -920,9 +920,8 @@ void i915_guc_policies_init(struct guc_policies  
> *policies)
>   * Set up the memory resources to be shared with the GuC (via the GGTT)
>   * at firmware loading time.
>   */
> -int i915_guc_submission_init(struct drm_i915_private *dev_priv)
> +int i915_guc_submission_shared_objects_init(struct intel_guc *guc)

Hmm, is "stage_ids" also considered as "shared object" ?
See ida_init(&guc->stage_ids); later in this function.

also, since function starts with "i915" there is no reason to change
parameter from dev_priv to guc

>  {
> -	struct intel_guc *guc = &dev_priv->guc;
>  	struct i915_vma *vma;
>  	void *vaddr;
> @@ -950,10 +949,8 @@ int i915_guc_submission_init(struct  
> drm_i915_private *dev_priv)
>  	return 0;
>  }
> -void i915_guc_submission_fini(struct drm_i915_private *dev_priv)
> +void i915_guc_submission_shared_objects_fini(struct intel_guc *guc)
>  {
> -	struct intel_guc *guc = &dev_priv->guc;
> -
>  	ida_destroy(&guc->stage_ids);
>  	i915_gem_object_unpin_map(guc->stage_desc_pool->obj);
>  	i915_vma_unpin_and_release(&guc->stage_desc_pool);
> diff --git a/drivers/gpu/drm/i915/intel_uc.c  
> b/drivers/gpu/drm/i915/intel_uc.c
> index 732f188..69239e4 100644
> --- a/drivers/gpu/drm/i915/intel_uc.c
> +++ b/drivers/gpu/drm/i915/intel_uc.c
> @@ -423,13 +423,33 @@ static int guc_shared_objects_init(struct  
> intel_guc *guc)
> 	ret = guc_ads_create(guc);
>  	if (ret < 0)
> -		intel_guc_log_destroy(guc);
> +		goto err_logs;
> +
> +	if (i915_modparams.enable_guc_submission) {
> +		/*
> +		 * This is stuff we need to have available at fw load time
> +		 * if we are planning to enable submission later
> +		 */
> +		ret = i915_guc_submission_shared_objects_init(guc);
> +		if (ret)
> +			goto err_ads;
> +	}
> +
> +	return 0;
> +
> +err_ads:
> +	guc_ads_destroy(guc);
> +err_logs:
> +	intel_guc_log_destroy(guc);
> 	return ret;
>  }
> static void guc_shared_objects_fini(struct intel_guc *guc)
>  {
> +	if (i915_modparams.enable_guc_submission)
> +		i915_guc_submission_shared_objects_fini(guc);
> +
>  	guc_ads_destroy(guc);
>  	intel_guc_log_destroy(guc);
>  }
> @@ -452,16 +472,6 @@ int intel_uc_init_hw(struct drm_i915_private  
> *dev_priv)
>  	if (ret)
>  		goto err_guc;
> -	if (i915_modparams.enable_guc_submission) {
> -		/*
> -		 * This is stuff we need to have available at fw load time
> -		 * if we are planning to enable submission later
> -		 */
> -		ret = i915_guc_submission_init(dev_priv);
> -		if (ret)
> -			goto err_shared;
> -	}
> -
>  	/* init WOPCM */
>  	I915_WRITE(GUC_WOPCM_SIZE, intel_guc_wopcm_size(dev_priv));
>  	I915_WRITE(DMA_GUC_WOPCM_OFFSET,
> @@ -481,7 +491,7 @@ int intel_uc_init_hw(struct drm_i915_private  
> *dev_priv)
>  		 */
>  		ret = __intel_uc_reset_hw(dev_priv);
>  		if (ret)
> -			goto err_submission;
> +			goto err_shared;
> 		intel_huc_init_hw(&dev_priv->huc);
>  		ret = intel_guc_init_hw(&dev_priv->guc);
> @@ -526,11 +536,8 @@ int intel_uc_init_hw(struct drm_i915_private  
> *dev_priv)
>  	gen9_disable_guc_interrupts(dev_priv);
>  err_log_capture:
>  	guc_capture_load_err_log(guc);
> -err_submission:
> -	if (i915_modparams.enable_guc_submission)
> -		i915_guc_submission_fini(dev_priv);
>  err_shared:
> -		guc_shared_objects_fini(guc);
> +	guc_shared_objects_fini(guc);

???

>  err_guc:
>  	i915_ggtt_disable_guc(dev_priv);
> @@ -567,7 +574,7 @@ void intel_uc_fini_hw(struct drm_i915_private  
> *dev_priv)
> 	if (i915_modparams.enable_guc_submission) {
>  		gen9_disable_guc_interrupts(dev_priv);
> -		i915_guc_submission_fini(dev_priv);
> +		i915_guc_submission_shared_objects_fini(dev_priv);
>  	}
> 	guc_shared_objects_fini(&dev_priv->guc);
> diff --git a/drivers/gpu/drm/i915/intel_uc.h  
> b/drivers/gpu/drm/i915/intel_uc.h
> index 0d12ff4..5106046 100644
> --- a/drivers/gpu/drm/i915/intel_uc.h
> +++ b/drivers/gpu/drm/i915/intel_uc.h
> @@ -230,10 +230,10 @@ static inline void intel_guc_notify(struct  
> intel_guc *guc)
>  u32 intel_guc_wopcm_size(struct drm_i915_private *dev_priv);
> /* i915_guc_submission.c */
> -int i915_guc_submission_init(struct drm_i915_private *dev_priv);
> +int i915_guc_submission_shared_objects_init(struct intel_guc *guc);
>  int i915_guc_submission_enable(struct drm_i915_private *dev_priv);
>  void i915_guc_submission_disable(struct drm_i915_private *dev_priv);
> -void i915_guc_submission_fini(struct drm_i915_private *dev_priv);
> +void i915_guc_submission_shared_objects_fini(struct intel_guc *guc);
>  struct i915_vma *intel_guc_allocate_vma(struct intel_guc *guc, u32  
> size);
>  void i915_guc_policies_init(struct guc_policies *policies);
Sundaresan, Sujaritha Oct. 6, 2017, 10:13 p.m. UTC | #3
On 10/04/2017 06:58 AM, Michal Wajdeczko wrote:
> On Wed, 04 Oct 2017 00:57:00 +0200, Sujaritha Sundaresan 
> <sujaritha.sundaresan@intel.com> wrote:
>
>> The previous patch has split up the initialization of some of the GuC
>> objects in 2 different functions, let's pull them back together.
>>
>> v3: Group initialization of GuC objects
>>
>> v2: Decoupling ADS together with logs (Daniele)
>>
>> v3: Rebase
>>
>> v4: Rebase
>>
>> v5: Separated from previous patch
>>
>> Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
>> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
>> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
>> Cc: Oscar Mateo <oscar.mateo@intel.com>
>> Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>
>> Signed-off-by: Sujaritha Sundaresan <sujaritha.sundaresan@intel.com>
>> ---
>>  drivers/gpu/drm/i915/i915_guc_submission.c |  7 ++---
>>  drivers/gpu/drm/i915/intel_uc.c            | 41 
>> +++++++++++++++++-------------
>>  drivers/gpu/drm/i915/intel_uc.h            |  4 +--
>>  3 files changed, 28 insertions(+), 24 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c 
>> b/drivers/gpu/drm/i915/i915_guc_submission.c
>> index c456c55..a351339 100644
>> --- a/drivers/gpu/drm/i915/i915_guc_submission.c
>> +++ b/drivers/gpu/drm/i915/i915_guc_submission.c
>> @@ -920,9 +920,8 @@ void i915_guc_policies_init(struct guc_policies 
>> *policies)
>>   * Set up the memory resources to be shared with the GuC (via the GGTT)
>>   * at firmware loading time.
>>   */
>> -int i915_guc_submission_init(struct drm_i915_private *dev_priv)
>> +int i915_guc_submission_shared_objects_init(struct intel_guc *guc)
>
> Hmm, is "stage_ids" also considered as "shared object" ?
> See ida_init(&guc->stage_ids); later in this function.
>
> also, since function starts with "i915" there is no reason to change
> parameter from dev_priv to guc
>

I was actually undecided if this change was worth doing. It seems to be 
a better
idea to keep the guc_submission stuff separate at an higher level.

Sujaritha
>>  {
>> -    struct intel_guc *guc = &dev_priv->guc;
>>      struct i915_vma *vma;
>>      void *vaddr;
>> @@ -950,10 +949,8 @@ int i915_guc_submission_init(struct 
>> drm_i915_private *dev_priv)
>>      return 0;
>>  }
>> -void i915_guc_submission_fini(struct drm_i915_private *dev_priv)
>> +void i915_guc_submission_shared_objects_fini(struct intel_guc *guc)
>>  {
>> -    struct intel_guc *guc = &dev_priv->guc;
>> -
>>      ida_destroy(&guc->stage_ids);
>>      i915_gem_object_unpin_map(guc->stage_desc_pool->obj);
>>      i915_vma_unpin_and_release(&guc->stage_desc_pool);
>> diff --git a/drivers/gpu/drm/i915/intel_uc.c 
>> b/drivers/gpu/drm/i915/intel_uc.c
>> index 732f188..69239e4 100644
>> --- a/drivers/gpu/drm/i915/intel_uc.c
>> +++ b/drivers/gpu/drm/i915/intel_uc.c
>> @@ -423,13 +423,33 @@ static int guc_shared_objects_init(struct 
>> intel_guc *guc)
>>     ret = guc_ads_create(guc);
>>      if (ret < 0)
>> -        intel_guc_log_destroy(guc);
>> +        goto err_logs;
>> +
>> +    if (i915_modparams.enable_guc_submission) {
>> +        /*
>> +         * This is stuff we need to have available at fw load time
>> +         * if we are planning to enable submission later
>> +         */
>> +        ret = i915_guc_submission_shared_objects_init(guc);
>> +        if (ret)
>> +            goto err_ads;
>> +    }
>> +
>> +    return 0;
>> +
>> +err_ads:
>> +    guc_ads_destroy(guc);
>> +err_logs:
>> +    intel_guc_log_destroy(guc);
>>     return ret;
>>  }
>> static void guc_shared_objects_fini(struct intel_guc *guc)
>>  {
>> +    if (i915_modparams.enable_guc_submission)
>> +        i915_guc_submission_shared_objects_fini(guc);
>> +
>>      guc_ads_destroy(guc);
>>      intel_guc_log_destroy(guc);
>>  }
>> @@ -452,16 +472,6 @@ int intel_uc_init_hw(struct drm_i915_private 
>> *dev_priv)
>>      if (ret)
>>          goto err_guc;
>> -    if (i915_modparams.enable_guc_submission) {
>> -        /*
>> -         * This is stuff we need to have available at fw load time
>> -         * if we are planning to enable submission later
>> -         */
>> -        ret = i915_guc_submission_init(dev_priv);
>> -        if (ret)
>> -            goto err_shared;
>> -    }
>> -
>>      /* init WOPCM */
>>      I915_WRITE(GUC_WOPCM_SIZE, intel_guc_wopcm_size(dev_priv));
>>      I915_WRITE(DMA_GUC_WOPCM_OFFSET,
>> @@ -481,7 +491,7 @@ int intel_uc_init_hw(struct drm_i915_private 
>> *dev_priv)
>>           */
>>          ret = __intel_uc_reset_hw(dev_priv);
>>          if (ret)
>> -            goto err_submission;
>> +            goto err_shared;
>>         intel_huc_init_hw(&dev_priv->huc);
>>          ret = intel_guc_init_hw(&dev_priv->guc);
>> @@ -526,11 +536,8 @@ int intel_uc_init_hw(struct drm_i915_private 
>> *dev_priv)
>>      gen9_disable_guc_interrupts(dev_priv);
>>  err_log_capture:
>>      guc_capture_load_err_log(guc);
>> -err_submission:
>> -    if (i915_modparams.enable_guc_submission)
>> -        i915_guc_submission_fini(dev_priv);
>>  err_shared:
>> -        guc_shared_objects_fini(guc);
>> +    guc_shared_objects_fini(guc);
>
> ???
>
>>  err_guc:
>>      i915_ggtt_disable_guc(dev_priv);
>> @@ -567,7 +574,7 @@ void intel_uc_fini_hw(struct drm_i915_private 
>> *dev_priv)
>>     if (i915_modparams.enable_guc_submission) {
>>          gen9_disable_guc_interrupts(dev_priv);
>> -        i915_guc_submission_fini(dev_priv);
>> +        i915_guc_submission_shared_objects_fini(dev_priv);
>>      }
>>     guc_shared_objects_fini(&dev_priv->guc);
>> diff --git a/drivers/gpu/drm/i915/intel_uc.h 
>> b/drivers/gpu/drm/i915/intel_uc.h
>> index 0d12ff4..5106046 100644
>> --- a/drivers/gpu/drm/i915/intel_uc.h
>> +++ b/drivers/gpu/drm/i915/intel_uc.h
>> @@ -230,10 +230,10 @@ static inline void intel_guc_notify(struct 
>> intel_guc *guc)
>>  u32 intel_guc_wopcm_size(struct drm_i915_private *dev_priv);
>> /* i915_guc_submission.c */
>> -int i915_guc_submission_init(struct drm_i915_private *dev_priv);
>> +int i915_guc_submission_shared_objects_init(struct intel_guc *guc);
>>  int i915_guc_submission_enable(struct drm_i915_private *dev_priv);
>>  void i915_guc_submission_disable(struct drm_i915_private *dev_priv);
>> -void i915_guc_submission_fini(struct drm_i915_private *dev_priv);
>> +void i915_guc_submission_shared_objects_fini(struct intel_guc *guc);
>>  struct i915_vma *intel_guc_allocate_vma(struct intel_guc *guc, u32 
>> size);
>>  void i915_guc_policies_init(struct guc_policies *policies);

Thanks for the review.

Regards,

Sujaritha
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
index c456c55..a351339 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -920,9 +920,8 @@  void i915_guc_policies_init(struct guc_policies *policies)
  * Set up the memory resources to be shared with the GuC (via the GGTT)
  * at firmware loading time.
  */
-int i915_guc_submission_init(struct drm_i915_private *dev_priv)
+int i915_guc_submission_shared_objects_init(struct intel_guc *guc)
 {
-	struct intel_guc *guc = &dev_priv->guc;
 	struct i915_vma *vma;
 	void *vaddr;
 
@@ -950,10 +949,8 @@  int i915_guc_submission_init(struct drm_i915_private *dev_priv)
 	return 0;
 }
 
-void i915_guc_submission_fini(struct drm_i915_private *dev_priv)
+void i915_guc_submission_shared_objects_fini(struct intel_guc *guc)
 {
-	struct intel_guc *guc = &dev_priv->guc;
-
 	ida_destroy(&guc->stage_ids);
 	i915_gem_object_unpin_map(guc->stage_desc_pool->obj);
 	i915_vma_unpin_and_release(&guc->stage_desc_pool);
diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c
index 732f188..69239e4 100644
--- a/drivers/gpu/drm/i915/intel_uc.c
+++ b/drivers/gpu/drm/i915/intel_uc.c
@@ -423,13 +423,33 @@  static int guc_shared_objects_init(struct intel_guc *guc)
 
 	ret = guc_ads_create(guc);
 	if (ret < 0)
-		intel_guc_log_destroy(guc);
+		goto err_logs;
+
+	if (i915_modparams.enable_guc_submission) {
+		/*
+		 * This is stuff we need to have available at fw load time
+		 * if we are planning to enable submission later
+		 */
+		ret = i915_guc_submission_shared_objects_init(guc);
+		if (ret)
+			goto err_ads;
+	}
+
+	return 0;
+
+err_ads:
+	guc_ads_destroy(guc);
+err_logs:
+	intel_guc_log_destroy(guc);
 
 	return ret;
 }
 
 static void guc_shared_objects_fini(struct intel_guc *guc)
 {
+	if (i915_modparams.enable_guc_submission)
+		i915_guc_submission_shared_objects_fini(guc);
+
 	guc_ads_destroy(guc);
 	intel_guc_log_destroy(guc);
 }
@@ -452,16 +472,6 @@  int intel_uc_init_hw(struct drm_i915_private *dev_priv)
 	if (ret)
 		goto err_guc;
 
-	if (i915_modparams.enable_guc_submission) {
-		/*
-		 * This is stuff we need to have available at fw load time
-		 * if we are planning to enable submission later
-		 */
-		ret = i915_guc_submission_init(dev_priv);
-		if (ret)
-			goto err_shared;
-	}
-
 	/* init WOPCM */
 	I915_WRITE(GUC_WOPCM_SIZE, intel_guc_wopcm_size(dev_priv));
 	I915_WRITE(DMA_GUC_WOPCM_OFFSET,
@@ -481,7 +491,7 @@  int intel_uc_init_hw(struct drm_i915_private *dev_priv)
 		 */
 		ret = __intel_uc_reset_hw(dev_priv);
 		if (ret)
-			goto err_submission;
+			goto err_shared;
 
 		intel_huc_init_hw(&dev_priv->huc);
 		ret = intel_guc_init_hw(&dev_priv->guc);
@@ -526,11 +536,8 @@  int intel_uc_init_hw(struct drm_i915_private *dev_priv)
 	gen9_disable_guc_interrupts(dev_priv);
 err_log_capture:
 	guc_capture_load_err_log(guc);
-err_submission:
-	if (i915_modparams.enable_guc_submission)
-		i915_guc_submission_fini(dev_priv);
 err_shared:
-		guc_shared_objects_fini(guc);
+	guc_shared_objects_fini(guc);
 err_guc:
 	i915_ggtt_disable_guc(dev_priv);
 
@@ -567,7 +574,7 @@  void intel_uc_fini_hw(struct drm_i915_private *dev_priv)
 
 	if (i915_modparams.enable_guc_submission) {
 		gen9_disable_guc_interrupts(dev_priv);
-		i915_guc_submission_fini(dev_priv);
+		i915_guc_submission_shared_objects_fini(dev_priv);
 	}
 
 	guc_shared_objects_fini(&dev_priv->guc);
diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
index 0d12ff4..5106046 100644
--- a/drivers/gpu/drm/i915/intel_uc.h
+++ b/drivers/gpu/drm/i915/intel_uc.h
@@ -230,10 +230,10 @@  static inline void intel_guc_notify(struct intel_guc *guc)
 u32 intel_guc_wopcm_size(struct drm_i915_private *dev_priv);
 
 /* i915_guc_submission.c */
-int i915_guc_submission_init(struct drm_i915_private *dev_priv);
+int i915_guc_submission_shared_objects_init(struct intel_guc *guc);
 int i915_guc_submission_enable(struct drm_i915_private *dev_priv);
 void i915_guc_submission_disable(struct drm_i915_private *dev_priv);
-void i915_guc_submission_fini(struct drm_i915_private *dev_priv);
+void i915_guc_submission_shared_objects_fini(struct intel_guc *guc);
 struct i915_vma *intel_guc_allocate_vma(struct intel_guc *guc, u32 size);
 void i915_guc_policies_init(struct guc_policies *policies);