diff mbox series

[2/2] drm/i915/guc: Calling guc_disable_communication in all suspend paths

Message ID 20190214214511.15826-3-sujaritha.sundaresan@intel.com (mailing list archive)
State New, archived
Headers show
Series GuC suspend paths cleanup | expand

Commit Message

Sundaresan, Sujaritha Feb. 14, 2019, 9:45 p.m. UTC
This aim of this patch is to call guc_disable_communication in all
suspend paths. The reason to introduce this is to resolve a bug that
occured due to suspend late not being called in the hibernate devices
path.

Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Sujaritha Sundaresan <sujaritha.sundaresan@intel.com>
---
 drivers/gpu/drm/i915/i915_reset.c |  2 +-
 drivers/gpu/drm/i915/intel_uc.c   | 23 +++++++++++++++++++----
 drivers/gpu/drm/i915/intel_uc.h   |  1 +
 3 files changed, 21 insertions(+), 5 deletions(-)

Comments

Daniele Ceraolo Spurio Feb. 16, 2019, 1:28 a.m. UTC | #1
On 2/14/19 1:45 PM, Sujaritha Sundaresan wrote:
> This aim of this patch is to call guc_disable_communication in all
> suspend paths. The reason to introduce this is to resolve a bug that
> occured due to suspend late not being called in the hibernate devices
> path.
> 

And we shouldn't anyway talk to guc after telling it to prepare for suspend.

Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

Daniele

> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Signed-off-by: Sujaritha Sundaresan <sujaritha.sundaresan@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_reset.c |  2 +-
>   drivers/gpu/drm/i915/intel_uc.c   | 23 +++++++++++++++++++----
>   drivers/gpu/drm/i915/intel_uc.h   |  1 +
>   3 files changed, 21 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_reset.c b/drivers/gpu/drm/i915/i915_reset.c
> index 12e74decd7a2..36e5c9c64285 100644
> --- a/drivers/gpu/drm/i915/i915_reset.c
> +++ b/drivers/gpu/drm/i915/i915_reset.c
> @@ -673,7 +673,7 @@ static void reset_prepare(struct drm_i915_private *i915)
>   	for_each_engine(engine, i915, id)
>   		reset_prepare_engine(engine);
>   
> -	intel_uc_sanitize(i915);
> +	intel_uc_reset_prepare(i915);
>   	revoke_mmaps(i915);
>   }
>   
> diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c
> index e711eb3268bc..2d360d53757f 100644
> --- a/drivers/gpu/drm/i915/intel_uc.c
> +++ b/drivers/gpu/drm/i915/intel_uc.c
> @@ -332,8 +332,6 @@ void intel_uc_sanitize(struct drm_i915_private *i915)
>   
>   	GEM_BUG_ON(!HAS_GUC(i915));
>   
> -	guc_disable_communication(guc);
> -
>   	intel_huc_sanitize(huc);
>   	intel_guc_sanitize(guc);
>   
> @@ -451,6 +449,23 @@ void intel_uc_fini_hw(struct drm_i915_private *i915)
>   	guc_disable_communication(guc);
>   }
>   
> +/**
> + * intel_uc_reset_prepare - Prepare for reset
> + * @i915: device private
> + *
> + * Preparing for full gpu reset.
> + */
> +void intel_uc_reset_prepare(struct drm_i915_private *i915)
> +{
> +	struct intel_guc *guc = &i915->guc;
> +
> +	if (!USES_GUC(i915))
> +		return;
> +
> +	guc_disable_communication(guc);
> +	intel_uc_sanitize(i915);
> +}
> +
>   int intel_uc_suspend(struct drm_i915_private *i915)
>   {
>   	struct intel_guc *guc = &i915->guc;
> @@ -468,7 +483,7 @@ int intel_uc_suspend(struct drm_i915_private *i915)
>   		return err;
>   	}
>   
> -	gen9_disable_guc_interrupts(i915);
> +	guc_disable_communication(guc);
>   
>   	return 0;
>   }
> @@ -484,7 +499,7 @@ int intel_uc_resume(struct drm_i915_private *i915)
>   	if (guc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
>   		return 0;
>   
> -	gen9_enable_guc_interrupts(i915);
> +	guc_enable_communication(guc);
>   
>   	err = intel_guc_resume(guc);
>   	if (err) {
> diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
> index 870faf9011b9..c14729786652 100644
> --- a/drivers/gpu/drm/i915/intel_uc.h
> +++ b/drivers/gpu/drm/i915/intel_uc.h
> @@ -38,6 +38,7 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv);
>   void intel_uc_fini_hw(struct drm_i915_private *dev_priv);
>   int intel_uc_init(struct drm_i915_private *dev_priv);
>   void intel_uc_fini(struct drm_i915_private *dev_priv);
> +void intel_uc_reset_prepare(struct drm_i915_private *i915);
>   int intel_uc_suspend(struct drm_i915_private *dev_priv);
>   int intel_uc_resume(struct drm_i915_private *dev_priv);
>   
>
Sundaresan, Sujaritha Feb. 19, 2019, 10:28 p.m. UTC | #2
On 2/15/19 5:28 PM, Daniele Ceraolo Spurio wrote:
>
>
> On 2/14/19 1:45 PM, Sujaritha Sundaresan wrote:
>> This aim of this patch is to call guc_disable_communication in all
>> suspend paths. The reason to introduce this is to resolve a bug that
>> occured due to suspend late not being called in the hibernate devices
>> path.
>>
>
> And we shouldn't anyway talk to guc after telling it to prepare for 
> suspend.
>
> Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
>
> Daniele


Will include this in the commit message. Thanks for the review.

Sujaritha

>
>> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
>> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
>> Signed-off-by: Sujaritha Sundaresan <sujaritha.sundaresan@intel.com>
>> ---
>>   drivers/gpu/drm/i915/i915_reset.c |  2 +-
>>   drivers/gpu/drm/i915/intel_uc.c   | 23 +++++++++++++++++++----
>>   drivers/gpu/drm/i915/intel_uc.h   |  1 +
>>   3 files changed, 21 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_reset.c 
>> b/drivers/gpu/drm/i915/i915_reset.c
>> index 12e74decd7a2..36e5c9c64285 100644
>> --- a/drivers/gpu/drm/i915/i915_reset.c
>> +++ b/drivers/gpu/drm/i915/i915_reset.c
>> @@ -673,7 +673,7 @@ static void reset_prepare(struct drm_i915_private 
>> *i915)
>>       for_each_engine(engine, i915, id)
>>           reset_prepare_engine(engine);
>>   -    intel_uc_sanitize(i915);
>> +    intel_uc_reset_prepare(i915);
>>       revoke_mmaps(i915);
>>   }
>>   diff --git a/drivers/gpu/drm/i915/intel_uc.c 
>> b/drivers/gpu/drm/i915/intel_uc.c
>> index e711eb3268bc..2d360d53757f 100644
>> --- a/drivers/gpu/drm/i915/intel_uc.c
>> +++ b/drivers/gpu/drm/i915/intel_uc.c
>> @@ -332,8 +332,6 @@ void intel_uc_sanitize(struct drm_i915_private 
>> *i915)
>>         GEM_BUG_ON(!HAS_GUC(i915));
>>   -    guc_disable_communication(guc);
>> -
>>       intel_huc_sanitize(huc);
>>       intel_guc_sanitize(guc);
>>   @@ -451,6 +449,23 @@ void intel_uc_fini_hw(struct drm_i915_private 
>> *i915)
>>       guc_disable_communication(guc);
>>   }
>>   +/**
>> + * intel_uc_reset_prepare - Prepare for reset
>> + * @i915: device private
>> + *
>> + * Preparing for full gpu reset.
>> + */
>> +void intel_uc_reset_prepare(struct drm_i915_private *i915)
>> +{
>> +    struct intel_guc *guc = &i915->guc;
>> +
>> +    if (!USES_GUC(i915))
>> +        return;
>> +
>> +    guc_disable_communication(guc);
>> +    intel_uc_sanitize(i915);
>> +}
>> +
>>   int intel_uc_suspend(struct drm_i915_private *i915)
>>   {
>>       struct intel_guc *guc = &i915->guc;
>> @@ -468,7 +483,7 @@ int intel_uc_suspend(struct drm_i915_private *i915)
>>           return err;
>>       }
>>   -    gen9_disable_guc_interrupts(i915);
>> +    guc_disable_communication(guc);
>>         return 0;
>>   }
>> @@ -484,7 +499,7 @@ int intel_uc_resume(struct drm_i915_private *i915)
>>       if (guc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
>>           return 0;
>>   -    gen9_enable_guc_interrupts(i915);
>> +    guc_enable_communication(guc);
>>         err = intel_guc_resume(guc);
>>       if (err) {
>> diff --git a/drivers/gpu/drm/i915/intel_uc.h 
>> b/drivers/gpu/drm/i915/intel_uc.h
>> index 870faf9011b9..c14729786652 100644
>> --- a/drivers/gpu/drm/i915/intel_uc.h
>> +++ b/drivers/gpu/drm/i915/intel_uc.h
>> @@ -38,6 +38,7 @@ int intel_uc_init_hw(struct drm_i915_private 
>> *dev_priv);
>>   void intel_uc_fini_hw(struct drm_i915_private *dev_priv);
>>   int intel_uc_init(struct drm_i915_private *dev_priv);
>>   void intel_uc_fini(struct drm_i915_private *dev_priv);
>> +void intel_uc_reset_prepare(struct drm_i915_private *i915);
>>   int intel_uc_suspend(struct drm_i915_private *dev_priv);
>>   int intel_uc_resume(struct drm_i915_private *dev_priv);
>>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_reset.c b/drivers/gpu/drm/i915/i915_reset.c
index 12e74decd7a2..36e5c9c64285 100644
--- a/drivers/gpu/drm/i915/i915_reset.c
+++ b/drivers/gpu/drm/i915/i915_reset.c
@@ -673,7 +673,7 @@  static void reset_prepare(struct drm_i915_private *i915)
 	for_each_engine(engine, i915, id)
 		reset_prepare_engine(engine);
 
-	intel_uc_sanitize(i915);
+	intel_uc_reset_prepare(i915);
 	revoke_mmaps(i915);
 }
 
diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c
index e711eb3268bc..2d360d53757f 100644
--- a/drivers/gpu/drm/i915/intel_uc.c
+++ b/drivers/gpu/drm/i915/intel_uc.c
@@ -332,8 +332,6 @@  void intel_uc_sanitize(struct drm_i915_private *i915)
 
 	GEM_BUG_ON(!HAS_GUC(i915));
 
-	guc_disable_communication(guc);
-
 	intel_huc_sanitize(huc);
 	intel_guc_sanitize(guc);
 
@@ -451,6 +449,23 @@  void intel_uc_fini_hw(struct drm_i915_private *i915)
 	guc_disable_communication(guc);
 }
 
+/**
+ * intel_uc_reset_prepare - Prepare for reset
+ * @i915: device private
+ *
+ * Preparing for full gpu reset.
+ */
+void intel_uc_reset_prepare(struct drm_i915_private *i915)
+{
+	struct intel_guc *guc = &i915->guc;
+
+	if (!USES_GUC(i915))
+		return;
+
+	guc_disable_communication(guc);
+	intel_uc_sanitize(i915);
+}
+
 int intel_uc_suspend(struct drm_i915_private *i915)
 {
 	struct intel_guc *guc = &i915->guc;
@@ -468,7 +483,7 @@  int intel_uc_suspend(struct drm_i915_private *i915)
 		return err;
 	}
 
-	gen9_disable_guc_interrupts(i915);
+	guc_disable_communication(guc);
 
 	return 0;
 }
@@ -484,7 +499,7 @@  int intel_uc_resume(struct drm_i915_private *i915)
 	if (guc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
 		return 0;
 
-	gen9_enable_guc_interrupts(i915);
+	guc_enable_communication(guc);
 
 	err = intel_guc_resume(guc);
 	if (err) {
diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
index 870faf9011b9..c14729786652 100644
--- a/drivers/gpu/drm/i915/intel_uc.h
+++ b/drivers/gpu/drm/i915/intel_uc.h
@@ -38,6 +38,7 @@  int intel_uc_init_hw(struct drm_i915_private *dev_priv);
 void intel_uc_fini_hw(struct drm_i915_private *dev_priv);
 int intel_uc_init(struct drm_i915_private *dev_priv);
 void intel_uc_fini(struct drm_i915_private *dev_priv);
+void intel_uc_reset_prepare(struct drm_i915_private *i915);
 int intel_uc_suspend(struct drm_i915_private *dev_priv);
 int intel_uc_resume(struct drm_i915_private *dev_priv);