diff mbox

[v4,3/7] drm/i915/uc: Fully sanitize uC in uc_fini_hw

Message ID 20180323151414.62580-3-michal.wajdeczko@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michal Wajdeczko March 23, 2018, 3:14 p.m. UTC
Today uc_fini_hw is subset of uc_sanitize, but remaining
code in sanitize function is also desired for uc_fini_hw.
Instead of duplicating the code, just call uc_sanitize,
but leave as separate function to maintain symmetry with
uc_init_hw.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_uc.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

Comments

sagar.a.kamble@intel.com March 26, 2018, 11:23 a.m. UTC | #1
On 3/23/2018 8:44 PM, Michal Wajdeczko wrote:
> Today uc_fini_hw is subset of uc_sanitize, but remaining
> code in sanitize function is also desired for uc_fini_hw.
> Instead of duplicating the code, just call uc_sanitize,
> but leave as separate function to maintain symmetry with
> uc_init_hw.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
We should drop call to uc_fini_hw from gem_fini as part of this patch as 
GuC won't be available then.
> ---
>   drivers/gpu/drm/i915/intel_uc.c | 14 ++------------
>   1 file changed, 2 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c
> index 2389828..9ff0c5a 100644
> --- a/drivers/gpu/drm/i915/intel_uc.c
> +++ b/drivers/gpu/drm/i915/intel_uc.c
> @@ -434,19 +434,9 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
>   	return ret;
>   }
>   
> -void intel_uc_fini_hw(struct drm_i915_private *dev_priv)
> +void intel_uc_fini_hw(struct drm_i915_private *i915)
>   {
> -	struct intel_guc *guc = &dev_priv->guc;
> -
> -	if (!USES_GUC(dev_priv))
> -		return;
> -
> -	GEM_BUG_ON(!HAS_GUC(dev_priv));
> -
> -	if (USES_GUC_SUBMISSION(dev_priv))
> -		intel_guc_submission_disable(guc);
> -
> -	guc_disable_communication(guc);
> +	intel_uc_sanitize(i915);
>   }
>   
>   int intel_uc_suspend(struct drm_i915_private *i915)
Michal Wajdeczko March 27, 2018, 5:07 p.m. UTC | #2
On Mon, 26 Mar 2018 13:23:21 +0200, Sagar Arun Kamble  
<sagar.a.kamble@intel.com> wrote:

>
>
> On 3/23/2018 8:44 PM, Michal Wajdeczko wrote:
>> Today uc_fini_hw is subset of uc_sanitize, but remaining
>> code in sanitize function is also desired for uc_fini_hw.
>> Instead of duplicating the code, just call uc_sanitize,
>> but leave as separate function to maintain symmetry with
>> uc_init_hw.
>>
>> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
>> Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>
>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> We should drop call to uc_fini_hw from gem_fini as part of this patch as  
> GuC won't be available then.

But we will need it in gem_fini to properly finish our cleanup on unload.

Maybe to keep symmetry, we should add i915_gem_fini_hw and call it from
there ? See cleanup inside i915_gem_init_hw.

/m

>> ---
>>   drivers/gpu/drm/i915/intel_uc.c | 14 ++------------
>>   1 file changed, 2 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_uc.c  
>> b/drivers/gpu/drm/i915/intel_uc.c
>> index 2389828..9ff0c5a 100644
>> --- a/drivers/gpu/drm/i915/intel_uc.c
>> +++ b/drivers/gpu/drm/i915/intel_uc.c
>> @@ -434,19 +434,9 @@ int intel_uc_init_hw(struct drm_i915_private  
>> *dev_priv)
>>   	return ret;
>>   }
>>   -void intel_uc_fini_hw(struct drm_i915_private *dev_priv)
>> +void intel_uc_fini_hw(struct drm_i915_private *i915)
>>   {
>> -	struct intel_guc *guc = &dev_priv->guc;
>> -
>> -	if (!USES_GUC(dev_priv))
>> -		return;
>> -
>> -	GEM_BUG_ON(!HAS_GUC(dev_priv));
>> -
>> -	if (USES_GUC_SUBMISSION(dev_priv))
>> -		intel_guc_submission_disable(guc);
>> -
>> -	guc_disable_communication(guc);
>> +	intel_uc_sanitize(i915);
>>   }
>>     int intel_uc_suspend(struct drm_i915_private *i915)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c
index 2389828..9ff0c5a 100644
--- a/drivers/gpu/drm/i915/intel_uc.c
+++ b/drivers/gpu/drm/i915/intel_uc.c
@@ -434,19 +434,9 @@  int intel_uc_init_hw(struct drm_i915_private *dev_priv)
 	return ret;
 }
 
-void intel_uc_fini_hw(struct drm_i915_private *dev_priv)
+void intel_uc_fini_hw(struct drm_i915_private *i915)
 {
-	struct intel_guc *guc = &dev_priv->guc;
-
-	if (!USES_GUC(dev_priv))
-		return;
-
-	GEM_BUG_ON(!HAS_GUC(dev_priv));
-
-	if (USES_GUC_SUBMISSION(dev_priv))
-		intel_guc_submission_disable(guc);
-
-	guc_disable_communication(guc);
+	intel_uc_sanitize(i915);
 }
 
 int intel_uc_suspend(struct drm_i915_private *i915)