* [PATCH v2 1/1] drm/i915/pxp/mtl: intel_pxp_init_hw needs runtime-pm inside pm-complete
@ 2023-08-02 19:06 Alan Previn
2023-08-03 21:01 ` Ceraolo Spurio, Daniele
0 siblings, 1 reply; 2+ messages in thread
From: Alan Previn @ 2023-08-02 19:06 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.
v2: resume_complete and runtime_resume should abstract a common
helper with different wakeref requirements. (Daniele)
Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
---
drivers/gpu/drm/i915/pxp/intel_pxp_pm.c | 18 +++++++++++++++++-
drivers/gpu/drm/i915/pxp/intel_pxp_pm.h | 5 +++--
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
index 1a04067f61fc..6dfd24918953 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
@@ -34,8 +34,10 @@ void intel_pxp_suspend(struct intel_pxp *pxp)
}
}
-void intel_pxp_resume_complete(struct intel_pxp *pxp)
+static void _pxp_resume(struct intel_pxp *pxp, bool take_wakeref)
{
+ intel_wakeref_t wakeref;
+
if (!intel_pxp_is_enabled(pxp))
return;
@@ -48,7 +50,21 @@ void intel_pxp_resume_complete(struct intel_pxp *pxp)
if (!HAS_ENGINE(pxp->ctrl_gt, GSC0) && !pxp->pxp_component)
return;
+ if (take_wakeref)
+ wakeref = intel_runtime_pm_get(&pxp->ctrl_gt->i915->runtime_pm);
intel_pxp_init_hw(pxp);
+ if (take_wakeref)
+ intel_runtime_pm_put(&pxp->ctrl_gt->i915->runtime_pm, wakeref);
+}
+
+void intel_pxp_resume_complete(struct intel_pxp *pxp)
+{
+ _pxp_resume(pxp, true);
+}
+
+void intel_pxp_runtime_resume(struct intel_pxp *pxp)
+{
+ _pxp_resume(pxp, false);
}
void intel_pxp_runtime_suspend(struct intel_pxp *pxp)
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.h b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.h
index 06b46f535b42..8695889b8380 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.h
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.h
@@ -13,6 +13,7 @@ void intel_pxp_suspend_prepare(struct intel_pxp *pxp);
void intel_pxp_suspend(struct intel_pxp *pxp);
void intel_pxp_resume_complete(struct intel_pxp *pxp);
void intel_pxp_runtime_suspend(struct intel_pxp *pxp);
+void intel_pxp_runtime_resume(struct intel_pxp *pxp);
#else
static inline void intel_pxp_suspend_prepare(struct intel_pxp *pxp)
{
@@ -29,9 +30,9 @@ static inline void intel_pxp_resume_complete(struct intel_pxp *pxp)
static inline void intel_pxp_runtime_suspend(struct intel_pxp *pxp)
{
}
-#endif
+
static inline void intel_pxp_runtime_resume(struct intel_pxp *pxp)
{
- intel_pxp_resume_complete(pxp);
}
+#endif
#endif /* __INTEL_PXP_PM_H__ */
base-commit: d7a437067a2146e1035a5609dae08b9595773a16
--
2.39.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 1/1] drm/i915/pxp/mtl: intel_pxp_init_hw needs runtime-pm inside pm-complete
2023-08-02 19:06 [PATCH v2 1/1] drm/i915/pxp/mtl: intel_pxp_init_hw needs runtime-pm inside pm-complete Alan Previn
@ 2023-08-03 21:01 ` Ceraolo Spurio, Daniele
0 siblings, 0 replies; 2+ messages in thread
From: Ceraolo Spurio, Daniele @ 2023-08-03 21:01 UTC (permalink / raw
To: Alan Previn, intel-gfx; +Cc: dri-devel
On 8/2/2023 12:06 PM, 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.
>
> v2: resume_complete and runtime_resume should abstract a common
> helper with different wakeref requirements. (Daniele)
>
> Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
CI is showing a decent hit to the passrate on DG2, but it looks
unrelated to me. Maybe trigger a re-run to be safe?
Once it's confirmed that the failures are unrelated, this is:
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Daniele
> ---
> drivers/gpu/drm/i915/pxp/intel_pxp_pm.c | 18 +++++++++++++++++-
> drivers/gpu/drm/i915/pxp/intel_pxp_pm.h | 5 +++--
> 2 files changed, 20 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
> index 1a04067f61fc..6dfd24918953 100644
> --- a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
> +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
> @@ -34,8 +34,10 @@ void intel_pxp_suspend(struct intel_pxp *pxp)
> }
> }
>
> -void intel_pxp_resume_complete(struct intel_pxp *pxp)
> +static void _pxp_resume(struct intel_pxp *pxp, bool take_wakeref)
> {
> + intel_wakeref_t wakeref;
> +
> if (!intel_pxp_is_enabled(pxp))
> return;
>
> @@ -48,7 +50,21 @@ void intel_pxp_resume_complete(struct intel_pxp *pxp)
> if (!HAS_ENGINE(pxp->ctrl_gt, GSC0) && !pxp->pxp_component)
> return;
>
> + if (take_wakeref)
> + wakeref = intel_runtime_pm_get(&pxp->ctrl_gt->i915->runtime_pm);
> intel_pxp_init_hw(pxp);
> + if (take_wakeref)
> + intel_runtime_pm_put(&pxp->ctrl_gt->i915->runtime_pm, wakeref);
> +}
> +
> +void intel_pxp_resume_complete(struct intel_pxp *pxp)
> +{
> + _pxp_resume(pxp, true);
> +}
> +
> +void intel_pxp_runtime_resume(struct intel_pxp *pxp)
> +{
> + _pxp_resume(pxp, false);
> }
>
> void intel_pxp_runtime_suspend(struct intel_pxp *pxp)
> diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.h b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.h
> index 06b46f535b42..8695889b8380 100644
> --- a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.h
> +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.h
> @@ -13,6 +13,7 @@ void intel_pxp_suspend_prepare(struct intel_pxp *pxp);
> void intel_pxp_suspend(struct intel_pxp *pxp);
> void intel_pxp_resume_complete(struct intel_pxp *pxp);
> void intel_pxp_runtime_suspend(struct intel_pxp *pxp);
> +void intel_pxp_runtime_resume(struct intel_pxp *pxp);
> #else
> static inline void intel_pxp_suspend_prepare(struct intel_pxp *pxp)
> {
> @@ -29,9 +30,9 @@ static inline void intel_pxp_resume_complete(struct intel_pxp *pxp)
> static inline void intel_pxp_runtime_suspend(struct intel_pxp *pxp)
> {
> }
> -#endif
> +
> static inline void intel_pxp_runtime_resume(struct intel_pxp *pxp)
> {
> - intel_pxp_resume_complete(pxp);
> }
> +#endif
> #endif /* __INTEL_PXP_PM_H__ */
>
> base-commit: d7a437067a2146e1035a5609dae08b9595773a16
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-03 21:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-02 19:06 [PATCH v2 1/1] drm/i915/pxp/mtl: intel_pxp_init_hw needs runtime-pm inside pm-complete Alan Previn
2023-08-03 21:01 ` Ceraolo Spurio, Daniele
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).