dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/pxp/mtl: intel_pxp_init_hw needs runtime-pm inside pm-complete
@ 2023-06-01 15:59 Alan Previn
  2023-06-13 15:34 ` [Intel-gfx] " Belgaumkar, Vinay
  2023-07-27 21:04 ` Ceraolo Spurio, Daniele
  0 siblings, 2 replies; 4+ messages in thread
From: Alan Previn @ 2023-06-01 15:59 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniele Ceraolo Spurio, dri-devel, Alan Previn

In the case of failed suspend flow or cases where the kernel does not go
into full suspend but goes from suspend_prepare back to resume_complete,
we get called for a pm_complete but without runtime_pm guaranteed.

Thus, ensure we take the runtime_pm when calling intel_pxp_init_hw
from within intel_pxp_resume_complete.

Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
---
 drivers/gpu/drm/i915/pxp/intel_pxp_pm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
index 1a04067f61fc..1d184dcd63c7 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
@@ -36,6 +36,8 @@ void intel_pxp_suspend(struct intel_pxp *pxp)
 
 void intel_pxp_resume_complete(struct intel_pxp *pxp)
 {
+	intel_wakeref_t wakeref;
+
 	if (!intel_pxp_is_enabled(pxp))
 		return;
 
@@ -48,7 +50,8 @@ void intel_pxp_resume_complete(struct intel_pxp *pxp)
 	if (!HAS_ENGINE(pxp->ctrl_gt, GSC0) && !pxp->pxp_component)
 		return;
 
-	intel_pxp_init_hw(pxp);
+	with_intel_runtime_pm(&pxp->ctrl_gt->i915->runtime_pm, wakeref)
+		intel_pxp_init_hw(pxp);
 }
 
 void intel_pxp_runtime_suspend(struct intel_pxp *pxp)

base-commit: a66da4c33d8ede541aea9ba6d0d73b556a072d54
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/i915/pxp/mtl: intel_pxp_init_hw needs runtime-pm inside pm-complete
  2023-06-01 15:59 [PATCH] drm/i915/pxp/mtl: intel_pxp_init_hw needs runtime-pm inside pm-complete Alan Previn
@ 2023-06-13 15:34 ` Belgaumkar, Vinay
  2023-07-27 21:04 ` Ceraolo Spurio, Daniele
  1 sibling, 0 replies; 4+ messages in thread
From: Belgaumkar, Vinay @ 2023-06-13 15:34 UTC (permalink / raw)
  To: Alan Previn, intel-gfx; +Cc: dri-devel


On 6/1/2023 8:59 AM, Alan Previn wrote:
> In the case of failed suspend flow or cases where the kernel does not go
> into full suspend but goes from suspend_prepare back to resume_complete,
> we get called for a pm_complete but without runtime_pm guaranteed.
>
> Thus, ensure we take the runtime_pm when calling intel_pxp_init_hw
> from within intel_pxp_resume_complete.

LGTM,

Reviewed-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>

>
> Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
> ---
>   drivers/gpu/drm/i915/pxp/intel_pxp_pm.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
> index 1a04067f61fc..1d184dcd63c7 100644
> --- a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
> +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
> @@ -36,6 +36,8 @@ void intel_pxp_suspend(struct intel_pxp *pxp)
>   
>   void intel_pxp_resume_complete(struct intel_pxp *pxp)
>   {
> +	intel_wakeref_t wakeref;
> +
>   	if (!intel_pxp_is_enabled(pxp))
>   		return;
>   
> @@ -48,7 +50,8 @@ void intel_pxp_resume_complete(struct intel_pxp *pxp)
>   	if (!HAS_ENGINE(pxp->ctrl_gt, GSC0) && !pxp->pxp_component)
>   		return;
>   
> -	intel_pxp_init_hw(pxp);
> +	with_intel_runtime_pm(&pxp->ctrl_gt->i915->runtime_pm, wakeref)
> +		intel_pxp_init_hw(pxp);
>   }
>   
>   void intel_pxp_runtime_suspend(struct intel_pxp *pxp)
>
> base-commit: a66da4c33d8ede541aea9ba6d0d73b556a072d54

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915/pxp/mtl: intel_pxp_init_hw needs runtime-pm inside pm-complete
  2023-06-01 15:59 [PATCH] drm/i915/pxp/mtl: intel_pxp_init_hw needs runtime-pm inside pm-complete Alan Previn
  2023-06-13 15:34 ` [Intel-gfx] " Belgaumkar, Vinay
@ 2023-07-27 21:04 ` Ceraolo Spurio, Daniele
  2023-08-02 18:35   ` Teres Alexis, Alan Previn
  1 sibling, 1 reply; 4+ messages in thread
From: Ceraolo Spurio, Daniele @ 2023-07-27 21:04 UTC (permalink / raw)
  To: Alan Previn, intel-gfx; +Cc: dri-devel



On 6/1/2023 8:59 AM, Alan Previn wrote:
> In the case of failed suspend flow or cases where the kernel does not go
> into full suspend but goes from suspend_prepare back to resume_complete,
> we get called for a pm_complete but without runtime_pm guaranteed.
>
> Thus, ensure we take the runtime_pm when calling intel_pxp_init_hw
> from within intel_pxp_resume_complete.
>
> Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
> ---
>   drivers/gpu/drm/i915/pxp/intel_pxp_pm.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
> index 1a04067f61fc..1d184dcd63c7 100644
> --- a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
> +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
> @@ -36,6 +36,8 @@ void intel_pxp_suspend(struct intel_pxp *pxp)
>   
>   void intel_pxp_resume_complete(struct intel_pxp *pxp)
>   {
> +	intel_wakeref_t wakeref;
> +
>   	if (!intel_pxp_is_enabled(pxp))
>   		return;
>   
> @@ -48,7 +50,8 @@ void intel_pxp_resume_complete()
>   	if (!HAS_ENGINE(pxp->ctrl_gt, GSC0) && !pxp->pxp_component)
>   		return;
>   
> -	intel_pxp_init_hw(pxp);
> +	with_intel_runtime_pm(&pxp->ctrl_gt->i915->runtime_pm, wakeref)

This is called from within the rpm resume path, so you can't do an rpm 
get or it will deadlock. Maybe have:

__pxp_resume_complete(struct intel_pxp *pxp, bool needs_rpm);

intel_pxp_resume_complete(..)
{
     return __pxp_resume_complete(pxp, true);
}

intel_pxp_runtime_resume(..)
{
     return __pxp_resume_complete(pxp, false);
}


or something like that.
Daniele

> +		intel_pxp_init_hw(pxp);
>   }
>   
>   void intel_pxp_runtime_suspend(struct intel_pxp *pxp)
>
> base-commit: a66da4c33d8ede541aea9ba6d0d73b556a072d54


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915/pxp/mtl: intel_pxp_init_hw needs runtime-pm inside pm-complete
  2023-07-27 21:04 ` Ceraolo Spurio, Daniele
@ 2023-08-02 18:35   ` Teres Alexis, Alan Previn
  0 siblings, 0 replies; 4+ messages in thread
From: Teres Alexis, Alan Previn @ 2023-08-02 18:35 UTC (permalink / raw)
  To: Ceraolo Spurio, Daniele, intel-gfx@lists.freedesktop.org
  Cc: dri-devel@lists.freedesktop.org

> > 
> > 
alan:snip

Thanks Vinay and Daniele - i'll respin with below fix.


> > @@ -48,7 +50,8 @@ void intel_pxp_resume_complete()
> >   	if (!HAS_ENGINE(pxp->ctrl_gt, GSC0) && !pxp->pxp_component)
> >   		return;
> >   
> > -	intel_pxp_init_hw(pxp);
> > +	with_intel_runtime_pm(&pxp->ctrl_gt->i915->runtime_pm, wakeref)
> 
> This is called from within the rpm resume path, so you can't do an rpm 
> get or it will deadlock. Maybe have:
> 
> __pxp_resume_complete(struct intel_pxp *pxp, bool needs_rpm);
> 
> intel_pxp_resume_complete(..)
> {
>      return __pxp_resume_complete(pxp, true);
> }
> 
> intel_pxp_runtime_resume(..)
> {
>      return __pxp_resume_complete(pxp, false);
> }
> 
> 
> or something like that.
> Daniele


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-02 18:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-01 15:59 [PATCH] drm/i915/pxp/mtl: intel_pxp_init_hw needs runtime-pm inside pm-complete Alan Previn
2023-06-13 15:34 ` [Intel-gfx] " Belgaumkar, Vinay
2023-07-27 21:04 ` Ceraolo Spurio, Daniele
2023-08-02 18:35   ` Teres Alexis, Alan Previn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox