diff mbox

[v13,06/21] drm/i915/guc: Pass intel_guc struct parameter to intel_guc_suspend/resume

Message ID 1507712056-25030-7-git-send-email-sagar.a.kamble@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

sagar.a.kamble@intel.com Oct. 11, 2017, 8:54 a.m. UTC
intel_guc_suspend and intel_guc_resume are GuC specific functions hence
update the parameter from dev_priv to intel_guc struct. While at it do
s/dev_priv/i915 in suspend/resume functions.

Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Michał Winiarski <michal.winiarski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c  |  6 +++---
 drivers/gpu/drm/i915/i915_gem.c  |  2 +-
 drivers/gpu/drm/i915/intel_guc.c | 20 ++++++++++----------
 drivers/gpu/drm/i915/intel_guc.h |  4 ++--
 4 files changed, 16 insertions(+), 16 deletions(-)

Comments

Michal Wajdeczko Oct. 11, 2017, 3:50 p.m. UTC | #1
On Wed, 11 Oct 2017 10:54:01 +0200, Sagar Arun Kamble  
<sagar.a.kamble@intel.com> wrote:

> intel_guc_suspend and intel_guc_resume are GuC specific functions hence
> update the parameter from dev_priv to intel_guc struct. While at it do
> s/dev_priv/i915 in suspend/resume functions.
>
> Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Michał Winiarski <michal.winiarski@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.c  |  6 +++---
>  drivers/gpu/drm/i915/i915_gem.c  |  2 +-
>  drivers/gpu/drm/i915/intel_guc.c | 20 ++++++++++----------
>  drivers/gpu/drm/i915/intel_guc.h |  4 ++--
>  4 files changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c  
> b/drivers/gpu/drm/i915/i915_drv.c
> index 8e25846..a500a81 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -1710,7 +1710,7 @@ static int i915_drm_resume(struct drm_device *dev)
>  	}
>  	mutex_unlock(&dev->struct_mutex);
> -	intel_guc_resume(dev_priv);
> +	intel_guc_resume(&dev_priv->guc);
> 	intel_modeset_init_hw(dev);
> @@ -2518,7 +2518,7 @@ static int intel_runtime_suspend(struct device  
> *kdev)
>  	 */
>  	i915_gem_runtime_suspend(dev_priv);
> -	intel_guc_suspend(dev_priv);
> +	intel_guc_suspend(&dev_priv->guc);
> 	intel_runtime_pm_disable_interrupts(dev_priv);
> @@ -2603,7 +2603,7 @@ static int intel_runtime_resume(struct device  
> *kdev)
>  	if (intel_uncore_unclaimed_mmio(dev_priv))
>  		DRM_DEBUG_DRIVER("Unclaimed access during suspend, bios?\n");
> -	intel_guc_resume(dev_priv);
> +	intel_guc_resume(&dev_priv->guc);
> 	if (IS_GEN9_LP(dev_priv)) {
>  		bxt_disable_dc9(dev_priv);
> diff --git a/drivers/gpu/drm/i915/i915_gem.c  
> b/drivers/gpu/drm/i915/i915_gem.c
> index e829e8c..276166d 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -4645,7 +4645,7 @@ int i915_gem_suspend(struct drm_i915_private  
> *dev_priv)
>  	i915_gem_contexts_lost(dev_priv);
>  	mutex_unlock(&dev->struct_mutex);
> -	intel_guc_suspend(dev_priv);
> +	intel_guc_suspend(&dev_priv->guc);
> 	cancel_delayed_work_sync(&dev_priv->gpu_error.hangcheck_work);
>  	cancel_delayed_work_sync(&dev_priv->gt.retire_work);
> diff --git a/drivers/gpu/drm/i915/intel_guc.c  
> b/drivers/gpu/drm/i915/intel_guc.c
> index bbe4c32..9a2df69 100644
> --- a/drivers/gpu/drm/i915/intel_guc.c
> +++ b/drivers/gpu/drm/i915/intel_guc.c
> @@ -169,20 +169,20 @@ int intel_guc_auth_huc(struct intel_guc *guc, u32  
> rsa_offset)
> /**
>   * intel_guc_suspend() - notify GuC entering suspend state
> - * @dev_priv:	i915 device private
> + * @guc: intel_guc struct
>   */
> -int intel_guc_suspend(struct drm_i915_private *dev_priv)
> +int intel_guc_suspend(struct intel_guc *guc)
>  {
> -	struct intel_guc *guc = &dev_priv->guc;
> +	struct drm_i915_private *i915 = guc_to_i915(guc);
>  	struct i915_gem_context *ctx;
>  	u32 data[3];
> 	if (guc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
>  		return 0;
> -	gen9_disable_guc_interrupts(dev_priv);
> +	gen9_disable_guc_interrupts(i915);
> -	ctx = dev_priv->kernel_context;
> +	ctx = i915->kernel_context;
> 	data[0] = INTEL_GUC_ACTION_ENTER_S_STATE;
>  	/* any value greater than GUC_POWER_D0 */
> @@ -196,11 +196,11 @@ int intel_guc_suspend(struct drm_i915_private  
> *dev_priv)
> /**
>   * intel_guc_resume() - notify GuC resuming from suspend state
> - * @dev_priv:	i915 device private
> + * @guc: intel_guc struct
>   */
> -int intel_guc_resume(struct drm_i915_private *dev_priv)
> +int intel_guc_resume(struct intel_guc *guc)
>  {
> -	struct intel_guc *guc = &dev_priv->guc;
> +	struct drm_i915_private *i915 = guc_to_i915(guc);
>  	struct i915_gem_context *ctx;
>  	u32 data[3];
> @@ -208,9 +208,9 @@ int intel_guc_resume(struct drm_i915_private  
> *dev_priv)
>  		return 0;
> 	if (i915_modparams.guc_log_level >= 0)
> -		gen9_enable_guc_interrupts(dev_priv);
> +		gen9_enable_guc_interrupts(i915);
> -	ctx = dev_priv->kernel_context;
> +	ctx = i915->kernel_context;
> 	data[0] = INTEL_GUC_ACTION_EXIT_S_STATE;
>  	data[1] = GUC_POWER_D0;
> diff --git a/drivers/gpu/drm/i915/intel_guc.h  
> b/drivers/gpu/drm/i915/intel_guc.h
> index 5046264f..a587210 100644
> --- a/drivers/gpu/drm/i915/intel_guc.h
> +++ b/drivers/gpu/drm/i915/intel_guc.h
> @@ -113,8 +113,8 @@ static inline bool  
> i915_guc_submission_enabled(struct intel_guc *guc)
>  int intel_guc_send_mmio(struct intel_guc *guc, const u32 *action, u32  
> len);
>  int intel_guc_sample_forcewake(struct intel_guc *guc);
>  int intel_guc_auth_huc(struct intel_guc *guc, u32 rsa_offset);
> -int intel_guc_suspend(struct drm_i915_private *dev_priv);
> -int intel_guc_resume(struct drm_i915_private *dev_priv);
> +int intel_guc_suspend(struct intel_guc *guc);
> +int intel_guc_resume(struct intel_guc *guc);
>  struct i915_vma *intel_guc_allocate_vma(struct intel_guc *guc, u32  
> size);
> int intel_guc_select_fw(struct intel_guc *guc);

I'm afraid some may prefer to do s/dev_priv/i915 in separate step,
but anyway

Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
sagar.a.kamble@intel.com Oct. 12, 2017, 6:18 a.m. UTC | #2
On 10/11/2017 9:20 PM, Michal Wajdeczko wrote:
> On Wed, 11 Oct 2017 10:54:01 +0200, Sagar Arun Kamble 
> <sagar.a.kamble@intel.com> wrote:
>
>> intel_guc_suspend and intel_guc_resume are GuC specific functions hence
>> update the parameter from dev_priv to intel_guc struct. While at it do
>> s/dev_priv/i915 in suspend/resume functions.
>>
>> Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@intel.com>
>> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
>> Cc: Michał Winiarski <michal.winiarski@intel.com>
>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
>> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>> ---
>>  drivers/gpu/drm/i915/i915_drv.c  |  6 +++---
>>  drivers/gpu/drm/i915/i915_gem.c  |  2 +-
>>  drivers/gpu/drm/i915/intel_guc.c | 20 ++++++++++----------
>>  drivers/gpu/drm/i915/intel_guc.h |  4 ++--
>>  4 files changed, 16 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_drv.c 
>> b/drivers/gpu/drm/i915/i915_drv.c
>> index 8e25846..a500a81 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.c
>> +++ b/drivers/gpu/drm/i915/i915_drv.c
>> @@ -1710,7 +1710,7 @@ static int i915_drm_resume(struct drm_device *dev)
>>      }
>>      mutex_unlock(&dev->struct_mutex);
>> -    intel_guc_resume(dev_priv);
>> +    intel_guc_resume(&dev_priv->guc);
>>     intel_modeset_init_hw(dev);
>> @@ -2518,7 +2518,7 @@ static int intel_runtime_suspend(struct device 
>> *kdev)
>>       */
>>      i915_gem_runtime_suspend(dev_priv);
>> -    intel_guc_suspend(dev_priv);
>> +    intel_guc_suspend(&dev_priv->guc);
>>     intel_runtime_pm_disable_interrupts(dev_priv);
>> @@ -2603,7 +2603,7 @@ static int intel_runtime_resume(struct device 
>> *kdev)
>>      if (intel_uncore_unclaimed_mmio(dev_priv))
>>          DRM_DEBUG_DRIVER("Unclaimed access during suspend, bios?\n");
>> -    intel_guc_resume(dev_priv);
>> +    intel_guc_resume(&dev_priv->guc);
>>     if (IS_GEN9_LP(dev_priv)) {
>>          bxt_disable_dc9(dev_priv);
>> diff --git a/drivers/gpu/drm/i915/i915_gem.c 
>> b/drivers/gpu/drm/i915/i915_gem.c
>> index e829e8c..276166d 100644
>> --- a/drivers/gpu/drm/i915/i915_gem.c
>> +++ b/drivers/gpu/drm/i915/i915_gem.c
>> @@ -4645,7 +4645,7 @@ int i915_gem_suspend(struct drm_i915_private 
>> *dev_priv)
>>      i915_gem_contexts_lost(dev_priv);
>>      mutex_unlock(&dev->struct_mutex);
>> -    intel_guc_suspend(dev_priv);
>> +    intel_guc_suspend(&dev_priv->guc);
>>     cancel_delayed_work_sync(&dev_priv->gpu_error.hangcheck_work);
>>      cancel_delayed_work_sync(&dev_priv->gt.retire_work);
>> diff --git a/drivers/gpu/drm/i915/intel_guc.c 
>> b/drivers/gpu/drm/i915/intel_guc.c
>> index bbe4c32..9a2df69 100644
>> --- a/drivers/gpu/drm/i915/intel_guc.c
>> +++ b/drivers/gpu/drm/i915/intel_guc.c
>> @@ -169,20 +169,20 @@ int intel_guc_auth_huc(struct intel_guc *guc, 
>> u32 rsa_offset)
>> /**
>>   * intel_guc_suspend() - notify GuC entering suspend state
>> - * @dev_priv:    i915 device private
>> + * @guc: intel_guc struct
>>   */
>> -int intel_guc_suspend(struct drm_i915_private *dev_priv)
>> +int intel_guc_suspend(struct intel_guc *guc)
>>  {
>> -    struct intel_guc *guc = &dev_priv->guc;
>> +    struct drm_i915_private *i915 = guc_to_i915(guc);
>>      struct i915_gem_context *ctx;
>>      u32 data[3];
>>     if (guc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
>>          return 0;
>> -    gen9_disable_guc_interrupts(dev_priv);
>> +    gen9_disable_guc_interrupts(i915);
>> -    ctx = dev_priv->kernel_context;
>> +    ctx = i915->kernel_context;
>>     data[0] = INTEL_GUC_ACTION_ENTER_S_STATE;
>>      /* any value greater than GUC_POWER_D0 */
>> @@ -196,11 +196,11 @@ int intel_guc_suspend(struct drm_i915_private 
>> *dev_priv)
>> /**
>>   * intel_guc_resume() - notify GuC resuming from suspend state
>> - * @dev_priv:    i915 device private
>> + * @guc: intel_guc struct
>>   */
>> -int intel_guc_resume(struct drm_i915_private *dev_priv)
>> +int intel_guc_resume(struct intel_guc *guc)
>>  {
>> -    struct intel_guc *guc = &dev_priv->guc;
>> +    struct drm_i915_private *i915 = guc_to_i915(guc);
>>      struct i915_gem_context *ctx;
>>      u32 data[3];
>> @@ -208,9 +208,9 @@ int intel_guc_resume(struct drm_i915_private 
>> *dev_priv)
>>          return 0;
>>     if (i915_modparams.guc_log_level >= 0)
>> -        gen9_enable_guc_interrupts(dev_priv);
>> +        gen9_enable_guc_interrupts(i915);
>> -    ctx = dev_priv->kernel_context;
>> +    ctx = i915->kernel_context;
>>     data[0] = INTEL_GUC_ACTION_EXIT_S_STATE;
>>      data[1] = GUC_POWER_D0;
>> diff --git a/drivers/gpu/drm/i915/intel_guc.h 
>> b/drivers/gpu/drm/i915/intel_guc.h
>> index 5046264f..a587210 100644
>> --- a/drivers/gpu/drm/i915/intel_guc.h
>> +++ b/drivers/gpu/drm/i915/intel_guc.h
>> @@ -113,8 +113,8 @@ static inline bool 
>> i915_guc_submission_enabled(struct intel_guc *guc)
>>  int intel_guc_send_mmio(struct intel_guc *guc, const u32 *action, 
>> u32 len);
>>  int intel_guc_sample_forcewake(struct intel_guc *guc);
>>  int intel_guc_auth_huc(struct intel_guc *guc, u32 rsa_offset);
>> -int intel_guc_suspend(struct drm_i915_private *dev_priv);
>> -int intel_guc_resume(struct drm_i915_private *dev_priv);
>> +int intel_guc_suspend(struct intel_guc *guc);
>> +int intel_guc_resume(struct intel_guc *guc);
>>  struct i915_vma *intel_guc_allocate_vma(struct intel_guc *guc, u32 
>> size);
>> int intel_guc_select_fw(struct intel_guc *guc);
>
> I'm afraid some may prefer to do s/dev_priv/i915 in separate step,
> but anyway
>
> Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Thanks Michal. Will remove the substitution. Can be taken up later.
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 8e25846..a500a81 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1710,7 +1710,7 @@  static int i915_drm_resume(struct drm_device *dev)
 	}
 	mutex_unlock(&dev->struct_mutex);
 
-	intel_guc_resume(dev_priv);
+	intel_guc_resume(&dev_priv->guc);
 
 	intel_modeset_init_hw(dev);
 
@@ -2518,7 +2518,7 @@  static int intel_runtime_suspend(struct device *kdev)
 	 */
 	i915_gem_runtime_suspend(dev_priv);
 
-	intel_guc_suspend(dev_priv);
+	intel_guc_suspend(&dev_priv->guc);
 
 	intel_runtime_pm_disable_interrupts(dev_priv);
 
@@ -2603,7 +2603,7 @@  static int intel_runtime_resume(struct device *kdev)
 	if (intel_uncore_unclaimed_mmio(dev_priv))
 		DRM_DEBUG_DRIVER("Unclaimed access during suspend, bios?\n");
 
-	intel_guc_resume(dev_priv);
+	intel_guc_resume(&dev_priv->guc);
 
 	if (IS_GEN9_LP(dev_priv)) {
 		bxt_disable_dc9(dev_priv);
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index e829e8c..276166d 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4645,7 +4645,7 @@  int i915_gem_suspend(struct drm_i915_private *dev_priv)
 	i915_gem_contexts_lost(dev_priv);
 	mutex_unlock(&dev->struct_mutex);
 
-	intel_guc_suspend(dev_priv);
+	intel_guc_suspend(&dev_priv->guc);
 
 	cancel_delayed_work_sync(&dev_priv->gpu_error.hangcheck_work);
 	cancel_delayed_work_sync(&dev_priv->gt.retire_work);
diff --git a/drivers/gpu/drm/i915/intel_guc.c b/drivers/gpu/drm/i915/intel_guc.c
index bbe4c32..9a2df69 100644
--- a/drivers/gpu/drm/i915/intel_guc.c
+++ b/drivers/gpu/drm/i915/intel_guc.c
@@ -169,20 +169,20 @@  int intel_guc_auth_huc(struct intel_guc *guc, u32 rsa_offset)
 
 /**
  * intel_guc_suspend() - notify GuC entering suspend state
- * @dev_priv:	i915 device private
+ * @guc: intel_guc struct
  */
-int intel_guc_suspend(struct drm_i915_private *dev_priv)
+int intel_guc_suspend(struct intel_guc *guc)
 {
-	struct intel_guc *guc = &dev_priv->guc;
+	struct drm_i915_private *i915 = guc_to_i915(guc);
 	struct i915_gem_context *ctx;
 	u32 data[3];
 
 	if (guc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
 		return 0;
 
-	gen9_disable_guc_interrupts(dev_priv);
+	gen9_disable_guc_interrupts(i915);
 
-	ctx = dev_priv->kernel_context;
+	ctx = i915->kernel_context;
 
 	data[0] = INTEL_GUC_ACTION_ENTER_S_STATE;
 	/* any value greater than GUC_POWER_D0 */
@@ -196,11 +196,11 @@  int intel_guc_suspend(struct drm_i915_private *dev_priv)
 
 /**
  * intel_guc_resume() - notify GuC resuming from suspend state
- * @dev_priv:	i915 device private
+ * @guc: intel_guc struct
  */
-int intel_guc_resume(struct drm_i915_private *dev_priv)
+int intel_guc_resume(struct intel_guc *guc)
 {
-	struct intel_guc *guc = &dev_priv->guc;
+	struct drm_i915_private *i915 = guc_to_i915(guc);
 	struct i915_gem_context *ctx;
 	u32 data[3];
 
@@ -208,9 +208,9 @@  int intel_guc_resume(struct drm_i915_private *dev_priv)
 		return 0;
 
 	if (i915_modparams.guc_log_level >= 0)
-		gen9_enable_guc_interrupts(dev_priv);
+		gen9_enable_guc_interrupts(i915);
 
-	ctx = dev_priv->kernel_context;
+	ctx = i915->kernel_context;
 
 	data[0] = INTEL_GUC_ACTION_EXIT_S_STATE;
 	data[1] = GUC_POWER_D0;
diff --git a/drivers/gpu/drm/i915/intel_guc.h b/drivers/gpu/drm/i915/intel_guc.h
index 5046264f..a587210 100644
--- a/drivers/gpu/drm/i915/intel_guc.h
+++ b/drivers/gpu/drm/i915/intel_guc.h
@@ -113,8 +113,8 @@  static inline bool i915_guc_submission_enabled(struct intel_guc *guc)
 int intel_guc_send_mmio(struct intel_guc *guc, const u32 *action, u32 len);
 int intel_guc_sample_forcewake(struct intel_guc *guc);
 int intel_guc_auth_huc(struct intel_guc *guc, u32 rsa_offset);
-int intel_guc_suspend(struct drm_i915_private *dev_priv);
-int intel_guc_resume(struct drm_i915_private *dev_priv);
+int intel_guc_suspend(struct intel_guc *guc);
+int intel_guc_resume(struct intel_guc *guc);
 struct i915_vma *intel_guc_allocate_vma(struct intel_guc *guc, u32 size);
 
 int intel_guc_select_fw(struct intel_guc *guc);