* [PATCH] drm/msm/gpu: Unwind power and clocks on resume failure
@ 2026-11-19 3:47 Haoxiang Li
2026-11-26 19:48 ` Akhil P Oommen
0 siblings, 1 reply; 2+ messages in thread
From: Haoxiang Li @ 2026-11-19 3:47 UTC (permalink / raw)
To: robin.clark, sean, konradybcio, akhilpo, lumag, abhinav.kumar,
jesszhan0024, marijn.suijten, airlied, simona
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel, Haoxiang Li
msm_gpu_pm_resume() returns without disabling the power rails when
enabling the GPU clocks fails. If enabling the AXI clock fails, both
the GPU clocks and power rails remain enabled. In addition,
enable_pwrrail() leaves gpu_reg enabled if enabling gpu_cx fails.
Disable gpu_reg when enabling gpu_cx fails, and unwind the completed
power and clock stages in reverse order when resume fails.
Fixes: 7198e6b03155 ("drm/msm: add a3xx gpu support")
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
drivers/gpu/drm/msm/msm_gpu.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index 8319119041eb..5480abe1aba2 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -40,6 +40,8 @@ static int enable_pwrrail(struct msm_gpu *gpu)
ret = regulator_enable(gpu->gpu_cx);
if (ret) {
DRM_DEV_ERROR(dev->dev, "failed to enable 'gpu_cx': %d\n", ret);
+ if (gpu->gpu_reg)
+ regulator_disable(gpu->gpu_reg);
return ret;
}
}
@@ -110,17 +112,24 @@ int msm_gpu_pm_resume(struct msm_gpu *gpu)
ret = enable_clk(gpu);
if (ret)
- return ret;
+ goto err_disable_pwrrail;
ret = enable_axi(gpu);
if (ret)
- return ret;
+ goto err_disable_clk;
msm_devfreq_resume(gpu);
gpu->needs_hw_init = true;
return 0;
+
+err_disable_clk:
+ disable_clk(gpu);
+
+err_disable_pwrrail:
+ disable_pwrrail(gpu);
+ return ret;
}
int msm_gpu_pm_suspend(struct msm_gpu *gpu)
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/msm/gpu: Unwind power and clocks on resume failure
2026-11-19 3:47 [PATCH] drm/msm/gpu: Unwind power and clocks on resume failure Haoxiang Li
@ 2026-11-26 19:48 ` Akhil P Oommen
0 siblings, 0 replies; 2+ messages in thread
From: Akhil P Oommen @ 2026-11-26 19:48 UTC (permalink / raw)
To: Haoxiang Li, robin.clark, sean, konradybcio, lumag,
abhinav.kumar, jesszhan0024, marijn.suijten, airlied, simona
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
On 11/19/2026 9:17 AM, Haoxiang Li wrote:
> msm_gpu_pm_resume() returns without disabling the power rails when
> enabling the GPU clocks fails. If enabling the AXI clock fails, both
> the GPU clocks and power rails remain enabled. In addition,
> enable_pwrrail() leaves gpu_reg enabled if enabling gpu_cx fails.
>
> Disable gpu_reg when enabling gpu_cx fails, and unwind the completed
> power and clock stages in reverse order when resume fails.
>
> Fixes: 7198e6b03155 ("drm/msm: add a3xx gpu support")
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
Reviewed-by: Akhil P Oommen <akhilpo@oss.qualcomm.com>
-Akhil
> ---
> drivers/gpu/drm/msm/msm_gpu.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
> index 8319119041eb..5480abe1aba2 100644
> --- a/drivers/gpu/drm/msm/msm_gpu.c
> +++ b/drivers/gpu/drm/msm/msm_gpu.c
> @@ -40,6 +40,8 @@ static int enable_pwrrail(struct msm_gpu *gpu)
> ret = regulator_enable(gpu->gpu_cx);
> if (ret) {
> DRM_DEV_ERROR(dev->dev, "failed to enable 'gpu_cx': %d\n", ret);
> + if (gpu->gpu_reg)
> + regulator_disable(gpu->gpu_reg);
> return ret;
> }
> }
> @@ -110,17 +112,24 @@ int msm_gpu_pm_resume(struct msm_gpu *gpu)
>
> ret = enable_clk(gpu);
> if (ret)
> - return ret;
> + goto err_disable_pwrrail;
>
> ret = enable_axi(gpu);
> if (ret)
> - return ret;
> + goto err_disable_clk;
>
> msm_devfreq_resume(gpu);
>
> gpu->needs_hw_init = true;
>
> return 0;
> +
> +err_disable_clk:
> + disable_clk(gpu);
> +
> +err_disable_pwrrail:
> + disable_pwrrail(gpu);
> + return ret;
> }
>
> int msm_gpu_pm_suspend(struct msm_gpu *gpu)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-26 19:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 3:47 [PATCH] drm/msm/gpu: Unwind power and clocks on resume failure Haoxiang Li
2026-11-26 19:48 ` Akhil P Oommen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®