[4/6] drm/i915/gt: introduce intel_gt_runtime_suspend/resume
diff mbox series

Message ID 20190729234727.28286-5-daniele.ceraolospurio@intel.com
State New
Headers show
Series
  • Call uC functions from GT ones
Related show

Commit Message

Daniele Ceraolo Spurio July 29, 2019, 11:47 p.m. UTC
To be called from the top level runtime functions, to hide the
gt-specific bits (mainly related to intel_uc).

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
---
 drivers/gpu/drm/i915/gt/intel_gt_pm.c | 12 ++++++++++++
 drivers/gpu/drm/i915/gt/intel_gt_pm.h |  2 ++
 drivers/gpu/drm/i915/i915_drv.c       |  9 +++------
 3 files changed, 17 insertions(+), 6 deletions(-)

Comments

Tvrtko Ursulin July 30, 2019, 7:35 a.m. UTC | #1
On 30/07/2019 00:47, Daniele Ceraolo Spurio wrote:
> To be called from the top level runtime functions, to hide the
> gt-specific bits (mainly related to intel_uc).

Looks okay to me.

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko

P.S. Added Andi and Ram to Cc since PM/RPS task.


> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> ---
>   drivers/gpu/drm/i915/gt/intel_gt_pm.c | 12 ++++++++++++
>   drivers/gpu/drm/i915/gt/intel_gt_pm.h |  2 ++
>   drivers/gpu/drm/i915/i915_drv.c       |  9 +++------
>   3 files changed, 17 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.c b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
> index 65c0d0c9d543..1a32e3e523c0 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_pm.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
> @@ -164,3 +164,15 @@ int intel_gt_resume(struct intel_gt *gt)
>   
>   	return err;
>   }
> +
> +void intel_gt_runtime_suspend(struct intel_gt *gt)
> +{
> +	intel_uc_runtime_suspend(&gt->uc);
> +}
> +
> +int intel_gt_runtime_resume(struct intel_gt *gt)
> +{
> +	intel_gt_init_swizzling(gt);
> +
> +	return intel_uc_resume(&gt->uc);
> +}
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.h b/drivers/gpu/drm/i915/gt/intel_gt_pm.h
> index ba960e1fc209..527894fe1345 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_pm.h
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.h
> @@ -23,5 +23,7 @@ void intel_gt_pm_init_early(struct intel_gt *gt);
>   
>   void intel_gt_sanitize(struct intel_gt *gt, bool force);
>   int intel_gt_resume(struct intel_gt *gt);
> +void intel_gt_runtime_suspend(struct intel_gt *gt);
> +int intel_gt_runtime_resume(struct intel_gt *gt);
>   
>   #endif /* INTEL_GT_PM_H */
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 3cd3be69dbad..bc7ffda10e5c 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -2925,7 +2925,7 @@ static int intel_runtime_suspend(struct device *kdev)
>   	 */
>   	i915_gem_runtime_suspend(dev_priv);
>   
> -	intel_uc_runtime_suspend(&dev_priv->gt.uc);
> +	intel_gt_runtime_suspend(&dev_priv->gt);
>   
>   	intel_runtime_pm_disable_interrupts(dev_priv);
>   
> @@ -2950,9 +2950,8 @@ static int intel_runtime_suspend(struct device *kdev)
>   
>   		intel_runtime_pm_enable_interrupts(dev_priv);
>   
> -		intel_uc_resume(&dev_priv->gt.uc);
> +		intel_gt_runtime_resume(&dev_priv->gt);
>   
> -		intel_gt_init_swizzling(&dev_priv->gt);
>   		i915_gem_restore_fences(dev_priv);
>   
>   		enable_rpm_wakeref_asserts(rpm);
> @@ -3047,13 +3046,11 @@ static int intel_runtime_resume(struct device *kdev)
>   
>   	intel_runtime_pm_enable_interrupts(dev_priv);
>   
> -	intel_uc_resume(&dev_priv->gt.uc);
> -
>   	/*
>   	 * No point of rolling back things in case of an error, as the best
>   	 * we can do is to hope that things will still work (and disable RPM).
>   	 */
> -	intel_gt_init_swizzling(&dev_priv->gt);
> +	intel_gt_runtime_resume(&dev_priv->gt);
>   	i915_gem_restore_fences(dev_priv);
>   
>   	/*
>

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.c b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
index 65c0d0c9d543..1a32e3e523c0 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_pm.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
@@ -164,3 +164,15 @@  int intel_gt_resume(struct intel_gt *gt)
 
 	return err;
 }
+
+void intel_gt_runtime_suspend(struct intel_gt *gt)
+{
+	intel_uc_runtime_suspend(&gt->uc);
+}
+
+int intel_gt_runtime_resume(struct intel_gt *gt)
+{
+	intel_gt_init_swizzling(gt);
+
+	return intel_uc_resume(&gt->uc);
+}
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.h b/drivers/gpu/drm/i915/gt/intel_gt_pm.h
index ba960e1fc209..527894fe1345 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_pm.h
+++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.h
@@ -23,5 +23,7 @@  void intel_gt_pm_init_early(struct intel_gt *gt);
 
 void intel_gt_sanitize(struct intel_gt *gt, bool force);
 int intel_gt_resume(struct intel_gt *gt);
+void intel_gt_runtime_suspend(struct intel_gt *gt);
+int intel_gt_runtime_resume(struct intel_gt *gt);
 
 #endif /* INTEL_GT_PM_H */
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 3cd3be69dbad..bc7ffda10e5c 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -2925,7 +2925,7 @@  static int intel_runtime_suspend(struct device *kdev)
 	 */
 	i915_gem_runtime_suspend(dev_priv);
 
-	intel_uc_runtime_suspend(&dev_priv->gt.uc);
+	intel_gt_runtime_suspend(&dev_priv->gt);
 
 	intel_runtime_pm_disable_interrupts(dev_priv);
 
@@ -2950,9 +2950,8 @@  static int intel_runtime_suspend(struct device *kdev)
 
 		intel_runtime_pm_enable_interrupts(dev_priv);
 
-		intel_uc_resume(&dev_priv->gt.uc);
+		intel_gt_runtime_resume(&dev_priv->gt);
 
-		intel_gt_init_swizzling(&dev_priv->gt);
 		i915_gem_restore_fences(dev_priv);
 
 		enable_rpm_wakeref_asserts(rpm);
@@ -3047,13 +3046,11 @@  static int intel_runtime_resume(struct device *kdev)
 
 	intel_runtime_pm_enable_interrupts(dev_priv);
 
-	intel_uc_resume(&dev_priv->gt.uc);
-
 	/*
 	 * No point of rolling back things in case of an error, as the best
 	 * we can do is to hope that things will still work (and disable RPM).
 	 */
-	intel_gt_init_swizzling(&dev_priv->gt);
+	intel_gt_runtime_resume(&dev_priv->gt);
 	i915_gem_restore_fences(dev_priv);
 
 	/*