[Intel-gfx] [PATCH 5/8] Drm/i915/rpm: Add intel_runtime_idle

Rodrigo Vivi rodrigo.vivi at intel.com
Wed Aug 3 20:52:03 UTC 2022


On Thu, Jul 21, 2022 at 03:29:52PM +0530, tilak.tangudu at intel.com wrote:
> From: Anshuman Gupta <anshuman.gupta at intel.com>
> 
> Adding intel_runtime_idle (runtime_idle callback) to prepare the
> tageted D3 state.
> 
> Since we have introduced i915 runtime_idle callback.
> It need to be warranted that Runtime PM Core invokes runtime_idle
> callback when runtime usages count becomes zero. That requires
> to use pm_runtime_put instead of pm_runtime_put_autosuspend.
> 
> Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
> Cc: Chris Wilson <chris.p.wilson at intel.com>
> Signed-off-by: Anshuman Gupta <anshuman.gupta at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_driver.c      | 12 ++++++++++++
>  drivers/gpu/drm/i915/intel_runtime_pm.c |  3 +--
>  2 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
> index deb8a8b76965..4c36554567fd 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -1576,6 +1576,17 @@ static int i915_pm_restore(struct device *kdev)
>  	return i915_pm_resume(kdev);
>  }
>  
> +static int intel_runtime_idle(struct device *kdev)
> +{
> +	struct drm_i915_private *i915 = kdev_to_i915(kdev);
> +	int ret = 1;
> +
> +	pm_runtime_mark_last_busy(kdev);
> +	pm_runtime_autosuspend(kdev);

oh, I see the ret = 1 like the other drm drivers..
do we really know why this flow and not use the runtime_idle
like the rest of the kernel?

I believe we could use more the runtime_idle to block the
runtime_pm, but following the original documented design of it.

> +
> +	return ret;
> +}
> +
>  static int intel_runtime_suspend(struct device *kdev)
>  {
>  	struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
> @@ -1752,6 +1763,7 @@ const struct dev_pm_ops i915_pm_ops = {
>  	.restore = i915_pm_restore,
>  
>  	/* S0ix (via runtime suspend) event handlers */
> +	.runtime_idle = intel_runtime_idle,
>  	.runtime_suspend = intel_runtime_suspend,
>  	.runtime_resume = intel_runtime_resume,
>  };
> diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
> index 704beeeb560b..1c3ed0c29330 100644
> --- a/drivers/gpu/drm/i915/intel_runtime_pm.c
> +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
> @@ -513,8 +513,7 @@ static void __intel_runtime_pm_put(struct intel_runtime_pm *rpm,
>  
>  	intel_runtime_pm_release(rpm, wakelock);
>  
> -	pm_runtime_mark_last_busy(kdev);
> -	pm_runtime_put_autosuspend(kdev);
> +	pm_runtime_put(kdev);
>  }
>  
>  /**
> -- 
> 2.25.1
> 


More information about the Intel-gfx mailing list