All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/msm/dpu: handle pm_runtime_get_sync() errors in bind path
@ 2022-05-18 22:34 Abhinav Kumar
  2022-05-19  0:31 ` Rob Clark
  2022-05-19  0:40 ` Stephen Boyd
  0 siblings, 2 replies; 4+ messages in thread
From: Abhinav Kumar @ 2022-05-18 22:34 UTC (permalink / raw)
  To: freedreno
  Cc: Abhinav Kumar, dri-devel, swboyd, seanpaul, dmitry.baryshkov,
	quic_jesszhan, quic_aravindh, quic_khsieh

If there are errors while trying to enable the pm in the
bind path, it will lead to unclocked access of hw revision
register thereby crashing the device.

This will not address why the pm_runtime_get_sync() fails
but at the very least we should be able to prevent the
crash by handling the error and bailing out earlier.

changes in v2:
	- use pm_runtime_resume_and_get() instead of
	  pm_runtime_get_sync()

Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 2b9d931474e0..bce47647d891 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -1089,7 +1089,9 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 
 	dpu_kms_parse_data_bus_icc_path(dpu_kms);
 
-	pm_runtime_get_sync(&dpu_kms->pdev->dev);
+	rc = pm_runtime_resume_and_get(&dpu_kms->pdev->dev);
+	if (rc < 0)
+		goto error;
 
 	dpu_kms->core_rev = readl_relaxed(dpu_kms->mmio + 0x0);
 
-- 
2.35.1


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

* Re: [PATCH v2] drm/msm/dpu: handle pm_runtime_get_sync() errors in bind path
  2022-05-18 22:34 [PATCH v2] drm/msm/dpu: handle pm_runtime_get_sync() errors in bind path Abhinav Kumar
@ 2022-05-19  0:31 ` Rob Clark
  2022-05-19  0:40 ` Stephen Boyd
  1 sibling, 0 replies; 4+ messages in thread
From: Rob Clark @ 2022-05-19  0:31 UTC (permalink / raw)
  To: Abhinav Kumar
  Cc: dri-devel, Stephen Boyd, Sean Paul, Dmitry Baryshkov,
	Jessica Zhang, quic_aravindh, Kuogee Hsieh (QUIC),
	freedreno

On Wed, May 18, 2022 at 3:34 PM Abhinav Kumar <quic_abhinavk@quicinc.com> wrote:
>
> If there are errors while trying to enable the pm in the
> bind path, it will lead to unclocked access of hw revision
> register thereby crashing the device.
>
> This will not address why the pm_runtime_get_sync() fails
> but at the very least we should be able to prevent the
> crash by handling the error and bailing out earlier.
>
> changes in v2:
>         - use pm_runtime_resume_and_get() instead of
>           pm_runtime_get_sync()
>
> Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>

Reviewed-by: Rob Clark <robdclark@gmail.com>

> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index 2b9d931474e0..bce47647d891 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -1089,7 +1089,9 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
>
>         dpu_kms_parse_data_bus_icc_path(dpu_kms);
>
> -       pm_runtime_get_sync(&dpu_kms->pdev->dev);
> +       rc = pm_runtime_resume_and_get(&dpu_kms->pdev->dev);
> +       if (rc < 0)
> +               goto error;
>
>         dpu_kms->core_rev = readl_relaxed(dpu_kms->mmio + 0x0);
>
> --
> 2.35.1
>

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

* Re: [PATCH v2] drm/msm/dpu: handle pm_runtime_get_sync() errors in bind path
  2022-05-18 22:34 [PATCH v2] drm/msm/dpu: handle pm_runtime_get_sync() errors in bind path Abhinav Kumar
  2022-05-19  0:31 ` Rob Clark
@ 2022-05-19  0:40 ` Stephen Boyd
  2022-05-19  1:26   ` [Freedreno] " Abhinav Kumar
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Boyd @ 2022-05-19  0:40 UTC (permalink / raw)
  To: Abhinav Kumar, freedreno
  Cc: dri-devel, quic_khsieh, seanpaul, dmitry.baryshkov,
	quic_jesszhan, quic_aravindh

Quoting Abhinav Kumar (2022-05-18 15:34:07)
> If there are errors while trying to enable the pm in the
> bind path, it will lead to unclocked access of hw revision
> register thereby crashing the device.
>
> This will not address why the pm_runtime_get_sync() fails
> but at the very least we should be able to prevent the
> crash by handling the error and bailing out earlier.
>
> changes in v2:
>         - use pm_runtime_resume_and_get() instead of
>           pm_runtime_get_sync()
>
> Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> ---

Any Fixes tag? When did pm errors start happening in the bind path?

Reviewed-by: Stephen Boyd <swboyd@chromium.org>

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

* Re: [Freedreno] [PATCH v2] drm/msm/dpu: handle pm_runtime_get_sync() errors in bind path
  2022-05-19  0:40 ` Stephen Boyd
@ 2022-05-19  1:26   ` Abhinav Kumar
  0 siblings, 0 replies; 4+ messages in thread
From: Abhinav Kumar @ 2022-05-19  1:26 UTC (permalink / raw)
  To: Stephen Boyd, freedreno
  Cc: dri-devel, quic_khsieh, seanpaul, dmitry.baryshkov,
	quic_jesszhan, quic_aravindh



On 5/18/2022 5:40 PM, Stephen Boyd wrote:
> Quoting Abhinav Kumar (2022-05-18 15:34:07)
>> If there are errors while trying to enable the pm in the
>> bind path, it will lead to unclocked access of hw revision
>> register thereby crashing the device.
>>
>> This will not address why the pm_runtime_get_sync() fails
>> but at the very least we should be able to prevent the
>> crash by handling the error and bailing out earlier.
>>
>> changes in v2:
>>          - use pm_runtime_resume_and_get() instead of
>>            pm_runtime_get_sync()
>>
>> Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
>> ---
> 
> Any Fixes tag? When did pm errors start happening in the bind path?
> 
> Reviewed-by: Stephen Boyd <swboyd@chromium.org>

This error got exposed with PANEL_EDP=m and DRM_MSM=y. We were not 
testing this combination previously. This combination causes "clk stuck 
at OFF" from the pm_runtime_get_sync() path which means we shouldnt 
proceed with the next register access since it failed.

We are still debugging the root-cause of why "clk stuck at OFF" error is 
present, this is just resolving the crash.

Fixes : 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")

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

end of thread, other threads:[~2022-05-19  1:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-18 22:34 [PATCH v2] drm/msm/dpu: handle pm_runtime_get_sync() errors in bind path Abhinav Kumar
2022-05-19  0:31 ` Rob Clark
2022-05-19  0:40 ` Stephen Boyd
2022-05-19  1:26   ` [Freedreno] " Abhinav Kumar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.