* [PATCH 1/9] drm/msm/dpu: clean up the self-refresh helper on KMS teardown
2026-11-30 6:55 [PATCH 0/9] drm/msm: fix unbind/rebind of the msm_dpu Yuanjie Yang
@ 2026-11-30 6:55 ` Yuanjie Yang
2026-11-30 6:55 ` [PATCH 2/9] drm/msm/dp: don't depopulate the eDP AUX bus on component unbind Yuanjie Yang
` (7 subsequent siblings)
8 siblings, 0 replies; 18+ messages in thread
From: Yuanjie Yang @ 2026-11-30 6:55 UTC (permalink / raw)
To: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona, quic_kalyant, quic_vpolimer,
quic_khsieh, jordan, konradybcio, akhilpo, antomani103, smasetty
Cc: linux-arm-msm, dri-devel, freedreno, yuanjie.yang, tingwei.zhang,
stable
dpu_crtc_init() sets up the self-refresh helper for each CRTC, but
drm_self_refresh_helper_cleanup() is never called. The helper re-arms
its entry_work on every commit, including the one done by
drm_atomic_helper_shutdown() on unbind, so the work later runs on the
freed DRM device and CRTCs:
Unable to handle kernel NULL pointer dereference at virtual address
0000000000000300
Workqueue: events drm_self_refresh_helper_entry_work
pc : drm_atomic_commit_alloc+0x18/0xb0
Fixes: 1122697810e5 ("drm/msm/disp/dpu: add PSR support for eDP interface in dpu driver")
Cc: stable@vger.kernel.org
Signed-off-by: Yuanjie Yang <yuanjie.yang@oss.qualcomm.com>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 1b6286dccfc0..efdde46f67f9 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -17,6 +17,7 @@
#include <drm/drm_crtc.h>
#include <drm/drm_file.h>
#include <drm/drm_framebuffer.h>
+#include <drm/drm_self_refresh_helper.h>
#include <drm/drm_vblank.h>
#include <drm/drm_writeback.h>
@@ -905,6 +906,7 @@ static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms)
static void dpu_kms_destroy(struct msm_kms *kms)
{
struct dpu_kms *dpu_kms;
+ struct drm_crtc *crtc;
if (!kms) {
DPU_ERROR("invalid kms\n");
@@ -913,6 +915,10 @@ static void dpu_kms_destroy(struct msm_kms *kms)
dpu_kms = to_dpu_kms(kms);
+ if (dpu_kms->dev)
+ drm_for_each_crtc(crtc, dpu_kms->dev)
+ drm_self_refresh_helper_cleanup(crtc);
+
_dpu_kms_hw_destroy(dpu_kms);
msm_kms_destroy(&dpu_kms->base);
--
2.43.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 2/9] drm/msm/dp: don't depopulate the eDP AUX bus on component unbind
2026-11-30 6:55 [PATCH 0/9] drm/msm: fix unbind/rebind of the msm_dpu Yuanjie Yang
2026-11-30 6:55 ` [PATCH 1/9] drm/msm/dpu: clean up the self-refresh helper on KMS teardown Yuanjie Yang
@ 2026-11-30 6:55 ` Yuanjie Yang
2026-11-30 7:09 ` sashiko-bot
2026-11-30 6:55 ` [PATCH 3/9] drm/msm: unpin the fbdev buffer when the fbdev is destroyed Yuanjie Yang
` (6 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Yuanjie Yang @ 2026-11-30 6:55 UTC (permalink / raw)
To: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona, quic_kalyant, quic_vpolimer,
quic_khsieh, jordan, konradybcio, akhilpo, antomani103, smasetty
Cc: linux-arm-msm, dri-devel, freedreno, yuanjie.yang, tingwei.zhang,
stable
Since commit e2969ee30252 ("drm/msm/dp: move of_dp_aux_populate_bus() to
eDP probe()") the eDP AUX bus is populated at probe time with
devm_of_dp_aux_populate_bus(), but msm_dp_display_unbind() still
depopulates it. This frees the panel while dp->next_bridge keeps
pointing at it, and the first connector probe after a rebind crashes:
Unable to handle kernel paging request at virtual address
0000000800000000
Workqueue: events output_poll_execute
panel_edp_get_modes+0x1b8/0x480 [panel_edp]
Drop the depopulate and leave it to the devm action registered at probe
time.
Fixes: e2969ee30252 ("drm/msm/dp: move of_dp_aux_populate_bus() to eDP probe()")
Cc: stable@vger.kernel.org
Signed-off-by: Yuanjie Yang <yuanjie.yang@oss.qualcomm.com>
---
drivers/gpu/drm/msm/dp/dp_display.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index c0c150e2c575..895174e04731 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -239,8 +239,6 @@ static void msm_dp_display_unbind(struct device *dev, struct device *master,
struct msm_dp_display_private *dp = dev_get_dp_display_private(dev);
struct msm_drm_private *priv = dev_get_drvdata(master);
- of_dp_aux_depopulate_bus(dp->aux);
-
msm_dp_aux_unregister(dp->aux);
dp->drm_dev = NULL;
dp->aux->drm_dev = NULL;
--
2.43.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH 2/9] drm/msm/dp: don't depopulate the eDP AUX bus on component unbind
2026-11-30 6:55 ` [PATCH 2/9] drm/msm/dp: don't depopulate the eDP AUX bus on component unbind Yuanjie Yang
@ 2026-11-30 7:09 ` sashiko-bot
2026-11-30 9:54 ` yuanjiey
0 siblings, 1 reply; 18+ messages in thread
From: sashiko-bot @ 2026-11-30 7:09 UTC (permalink / raw)
To: Yuanjie Yang; +Cc: dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm/msm/dp: use-after-free of dp->aux after
msm_dp_display_remove()
--
commit ffc44dc305e10f09be11226df97e5b2a91916044
Author: Yuanjie Yang <yuanjie.yang@oss.qualcomm.com>
drm/msm/dp: don't depopulate the eDP AUX bus on component unbind
This commit stops calling of_dp_aux_depopulate_bus() in
msm_dp_display_unbind() so that eDP AUX bus teardown is left to the devm
action registered at probe time.
> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> index c0c150e2c5758..895174e047312 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -239,8 +239,6 @@ static void msm_dp_display_unbind(struct device *dev, struct device *master,
> struct msm_dp_display_private *dp = dev_get_dp_display_private(dev);
> struct msm_drm_private *priv = dev_get_drvdata(master);
>
> - of_dp_aux_depopulate_bus(dp->aux);
> -
> msm_dp_aux_unregister(dp->aux);
> dp->drm_dev = NULL;
> dp->aux->drm_dev = NULL;
[Severity: High]
Does deferring AUX bus depopulation to the devm action cause a
use-after-free of dp->aux during msm_dp_display_remove()?
When the platform device is removed, msm_dp_display_remove() runs before
devres_release_all():
drivers/gpu/drm/msm/dp/dp_display.c:msm_dp_display_remove() {
struct msm_dp_display_private *dp = dev_get_dp_display_private(&pdev->dev);
component_del(&pdev->dev, &msm_dp_display_comp_ops);
msm_dp_display_deinit_sub_modules(dp);
platform_set_drvdata(pdev, NULL);
}
msm_dp_display_deinit_sub_modules() calls msm_dp_aux_put(dp->aux), which
destroys aux->mutex and calls devm_kfree(aux->dev, aux). When
devres_release_all() then runs the devm_of_dp_aux_populate_bus() cleanup
action, of_dp_aux_depopulate_bus_void(dp->aux) dereferences aux->dev from
the already-freed dp->aux and tears down the child AUX endpoint device
after dp->aux and aux->mutex have been destroyed.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130-dpu_unbind_rebind_display-v1-0-c335387de1bb@oss.qualcomm.com?part=2
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH 2/9] drm/msm/dp: don't depopulate the eDP AUX bus on component unbind
2026-11-30 7:09 ` sashiko-bot
@ 2026-11-30 9:54 ` yuanjiey
0 siblings, 0 replies; 18+ messages in thread
From: yuanjiey @ 2026-11-30 9:54 UTC (permalink / raw)
To: sashiko-reviews; +Cc: dri-devel
On Mon, Nov 30, 2026 at 07:09:11AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [High] drm/msm/dp: use-after-free of dp->aux after
> msm_dp_display_remove()
> --
>
> commit ffc44dc305e10f09be11226df97e5b2a91916044
> Author: Yuanjie Yang <yuanjie.yang@oss.qualcomm.com>
>
> drm/msm/dp: don't depopulate the eDP AUX bus on component unbind
>
> This commit stops calling of_dp_aux_depopulate_bus() in
> msm_dp_display_unbind() so that eDP AUX bus teardown is left to the devm
> action registered at probe time.
>
> > diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> > index c0c150e2c5758..895174e047312 100644
> > --- a/drivers/gpu/drm/msm/dp/dp_display.c
> > +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> > @@ -239,8 +239,6 @@ static void msm_dp_display_unbind(struct device *dev, struct device *master,
> > struct msm_dp_display_private *dp = dev_get_dp_display_private(dev);
> > struct msm_drm_private *priv = dev_get_drvdata(master);
> >
> > - of_dp_aux_depopulate_bus(dp->aux);
> > -
> > msm_dp_aux_unregister(dp->aux);
> > dp->drm_dev = NULL;
> > dp->aux->drm_dev = NULL;
>
> [Severity: High]
> Does deferring AUX bus depopulation to the devm action cause a
> use-after-free of dp->aux during msm_dp_display_remove()?
>
> When the platform device is removed, msm_dp_display_remove() runs before
> devres_release_all():
>
> drivers/gpu/drm/msm/dp/dp_display.c:msm_dp_display_remove() {
> struct msm_dp_display_private *dp = dev_get_dp_display_private(&pdev->dev);
>
> component_del(&pdev->dev, &msm_dp_display_comp_ops);
> msm_dp_display_deinit_sub_modules(dp);
> platform_set_drvdata(pdev, NULL);
> }
>
> msm_dp_display_deinit_sub_modules() calls msm_dp_aux_put(dp->aux), which
> destroys aux->mutex and calls devm_kfree(aux->dev, aux). When
> devres_release_all() then runs the devm_of_dp_aux_populate_bus() cleanup
> action, of_dp_aux_depopulate_bus_void(dp->aux) dereferences aux->dev from
> the already-freed dp->aux and tears down the child AUX endpoint device
> after dp->aux and aux->mutex have been destroyed.
I mentioned this issue in the cover letter. this can be reproduce by
rmmod msm. will fix in other patch.
Thanks,
Yuanjie
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20261130-dpu_unbind_rebind_display-v1-0-c335387de1bb@oss.qualcomm.com?part=2
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 3/9] drm/msm: unpin the fbdev buffer when the fbdev is destroyed
2026-11-30 6:55 [PATCH 0/9] drm/msm: fix unbind/rebind of the msm_dpu Yuanjie Yang
2026-11-30 6:55 ` [PATCH 1/9] drm/msm/dpu: clean up the self-refresh helper on KMS teardown Yuanjie Yang
2026-11-30 6:55 ` [PATCH 2/9] drm/msm/dp: don't depopulate the eDP AUX bus on component unbind Yuanjie Yang
@ 2026-11-30 6:55 ` Yuanjie Yang
2026-11-30 6:55 ` [PATCH 4/9] drm/msm/a6xx: don't leak the SQE vmap in a6xx_ucode_check_version() Yuanjie Yang
` (5 subsequent siblings)
8 siblings, 0 replies; 18+ messages in thread
From: Yuanjie Yang @ 2026-11-30 6:55 UTC (permalink / raw)
To: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona, quic_kalyant, quic_vpolimer,
quic_khsieh, jordan, konradybcio, akhilpo, antomani103, smasetty
Cc: linux-arm-msm, dri-devel, freedreno, yuanjie.yang, tingwei.zhang,
stable
msm_fbdev_driver_fbdev_probe() pins the scanout buffer, but
msm_fbdev_fb_destroy() never unpins it, so every unbind frees a pinned
object:
WARNING: drivers/gpu/drm/msm/msm_gem.c:173 at update_lru_locked+0x98/0xa8
msm_gem_free_object+0x1d0/0x260
drm_client_buffer_delete+0xdc/0x108
msm_fbdev_fb_destroy+0x5c/0x80
Drop the pin before deleting the client buffer. For the KMS VM,
msm_gem_unpin_iova() only drops the object pin, so do that directly with
msm_gem_unpin_locked(), as msm_gem_put_vaddr() does for the vmap.
Fixes: 9fe041f6fdfe ("drm/msm: Add msm_gem_get_and_pin_iova()")
Cc: stable@vger.kernel.org
Signed-off-by: Yuanjie Yang <yuanjie.yang@oss.qualcomm.com>
---
drivers/gpu/drm/msm/msm_fbdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
index f37cc3f97a21..e73792d6d5b1 100644
--- a/drivers/gpu/drm/msm/msm_fbdev.c
+++ b/drivers/gpu/drm/msm/msm_fbdev.c
@@ -48,6 +48,9 @@ static void msm_fbdev_fb_destroy(struct fb_info *info)
drm_fb_helper_fini(helper);
msm_gem_put_vaddr(bo);
+ msm_gem_lock(bo);
+ msm_gem_unpin_locked(bo);
+ msm_gem_unlock(bo);
drm_client_buffer_delete(helper->buffer);
drm_client_release(&helper->client);
--
2.43.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 4/9] drm/msm/a6xx: don't leak the SQE vmap in a6xx_ucode_check_version()
2026-11-30 6:55 [PATCH 0/9] drm/msm: fix unbind/rebind of the msm_dpu Yuanjie Yang
` (2 preceding siblings ...)
2026-11-30 6:55 ` [PATCH 3/9] drm/msm: unpin the fbdev buffer when the fbdev is destroyed Yuanjie Yang
@ 2026-11-30 6:55 ` Yuanjie Yang
2026-11-30 8:00 ` Konrad Dybcio
2026-11-30 6:55 ` [PATCH 5/9] drm/msm/a6xx: drop the shadow BO vmap on destroy Yuanjie Yang
` (4 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Yuanjie Yang @ 2026-11-30 6:55 UTC (permalink / raw)
To: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona, quic_kalyant, quic_vpolimer,
quic_khsieh, jordan, konradybcio, akhilpo, antomani103, smasetty
Cc: linux-arm-msm, dri-devel, freedreno, yuanjie.yang, tingwei.zhang,
stable
a6xx_ucode_check_version() maps the SQE firmware BO with
msm_gem_get_vaddr(), but returns early for a7xx, a702 and a8xx without
the matching msm_gem_put_vaddr(). The BO then reaches a6xx_destroy()
still vmapped, and freeing it warns:
WARNING: drivers/gpu/drm/msm/msm_gem.c:912 at msm_gem_vunmap+0x78/0x88
WARNING: drivers/gpu/drm/msm/msm_gem.c:173 at update_lru_locked+0x98/0xa8
Go through the common exit path instead.
Fixes: af66706accdf ("drm/msm/a6xx: Add skeleton A7xx support")
Cc: stable@vger.kernel.org
Signed-off-by: Yuanjie Yang <yuanjie.yang@oss.qualcomm.com>
---
drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index 3e4afaa5345f..57fede45e044 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -995,8 +995,11 @@ static bool a6xx_ucode_check_version(struct a6xx_gpu *a6xx_gpu,
return false;
/* A7xx is safe! */
- if (adreno_is_a7xx(adreno_gpu) || adreno_is_a702(adreno_gpu) || adreno_is_a8xx(adreno_gpu))
- return true;
+ if (adreno_is_a7xx(adreno_gpu) || adreno_is_a702(adreno_gpu) ||
+ adreno_is_a8xx(adreno_gpu)) {
+ ret = true;
+ goto out;
+ }
/*
* Targets up to a640 (a618, a630 and a640) need to check for a
--
2.43.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH 4/9] drm/msm/a6xx: don't leak the SQE vmap in a6xx_ucode_check_version()
2026-11-30 6:55 ` [PATCH 4/9] drm/msm/a6xx: don't leak the SQE vmap in a6xx_ucode_check_version() Yuanjie Yang
@ 2026-11-30 8:00 ` Konrad Dybcio
0 siblings, 0 replies; 18+ messages in thread
From: Konrad Dybcio @ 2026-11-30 8:00 UTC (permalink / raw)
To: Yuanjie Yang, robin.clark, lumag, abhinav.kumar, jesszhan0024,
sean, marijn.suijten, airlied, simona, quic_kalyant,
quic_vpolimer, quic_khsieh, jordan, konradybcio, akhilpo,
antomani103, smasetty
Cc: linux-arm-msm, dri-devel, freedreno, tingwei.zhang, stable
On 11/30/26 7:55 AM, Yuanjie Yang wrote:
> a6xx_ucode_check_version() maps the SQE firmware BO with
> msm_gem_get_vaddr(), but returns early for a7xx, a702 and a8xx without
> the matching msm_gem_put_vaddr(). The BO then reaches a6xx_destroy()
> still vmapped, and freeing it warns:
>
> WARNING: drivers/gpu/drm/msm/msm_gem.c:912 at msm_gem_vunmap+0x78/0x88
> WARNING: drivers/gpu/drm/msm/msm_gem.c:173 at update_lru_locked+0x98/0xa8
>
> Go through the common exit path instead.
>
> Fixes: af66706accdf ("drm/msm/a6xx: Add skeleton A7xx support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Yuanjie Yang <yuanjie.yang@oss.qualcomm.com>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 5/9] drm/msm/a6xx: drop the shadow BO vmap on destroy
2026-11-30 6:55 [PATCH 0/9] drm/msm: fix unbind/rebind of the msm_dpu Yuanjie Yang
` (3 preceding siblings ...)
2026-11-30 6:55 ` [PATCH 4/9] drm/msm/a6xx: don't leak the SQE vmap in a6xx_ucode_check_version() Yuanjie Yang
@ 2026-11-30 6:55 ` Yuanjie Yang
2026-11-30 8:04 ` Konrad Dybcio
2026-11-30 6:55 ` [PATCH 6/9] drm/msm/a6xx: free the preemption and pwrup_reglist buffers " Yuanjie Yang
` (3 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Yuanjie Yang @ 2026-11-30 6:55 UTC (permalink / raw)
To: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona, quic_kalyant, quic_vpolimer,
quic_khsieh, jordan, konradybcio, akhilpo, antomani103, smasetty
Cc: linux-arm-msm, dri-devel, freedreno, yuanjie.yang, tingwei.zhang,
stable
The RPTR shadow BO is allocated with msm_gem_kernel_new(), which keeps
it vmapped, but a6xx_destroy() only unpins its iova before dropping the
last reference. Unlike sqe_bo and aqe_bo, whose vmap is dropped right
after the firmware is copied in, it is freed still vmapped:
WARNING: drivers/gpu/drm/msm/msm_gem.c:912 at msm_gem_vunmap+0x78/0x88
WARNING: drivers/gpu/drm/msm/msm_gem.c:173 at update_lru_locked+0x98/0xa8
Release it with msm_gem_kernel_put(), the counterpart of
msm_gem_kernel_new().
Fixes: d3a569fccfa0 ("drm/msm: a6xx: Use WHERE_AM_I for eligible targets")
Cc: stable@vger.kernel.org
Signed-off-by: Yuanjie Yang <yuanjie.yang@oss.qualcomm.com>
---
drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index 57fede45e044..da1202474dee 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -2325,10 +2325,7 @@ static void a6xx_destroy(struct msm_gpu *gpu)
drm_gem_object_put(a6xx_gpu->aqe_bo);
}
- if (a6xx_gpu->shadow_bo) {
- msm_gem_unpin_iova(a6xx_gpu->shadow_bo, gpu->vm);
- drm_gem_object_put(a6xx_gpu->shadow_bo);
- }
+ msm_gem_kernel_put(a6xx_gpu->shadow_bo, gpu->vm);
a6xx_llc_slices_destroy(a6xx_gpu);
--
2.43.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH 5/9] drm/msm/a6xx: drop the shadow BO vmap on destroy
2026-11-30 6:55 ` [PATCH 5/9] drm/msm/a6xx: drop the shadow BO vmap on destroy Yuanjie Yang
@ 2026-11-30 8:04 ` Konrad Dybcio
0 siblings, 0 replies; 18+ messages in thread
From: Konrad Dybcio @ 2026-11-30 8:04 UTC (permalink / raw)
To: Yuanjie Yang, robin.clark, lumag, abhinav.kumar, jesszhan0024,
sean, marijn.suijten, airlied, simona, quic_kalyant,
quic_vpolimer, quic_khsieh, jordan, konradybcio, akhilpo,
antomani103, smasetty
Cc: linux-arm-msm, dri-devel, freedreno, tingwei.zhang, stable
On 11/30/26 7:55 AM, Yuanjie Yang wrote:
> The RPTR shadow BO is allocated with msm_gem_kernel_new(), which keeps
> it vmapped, but a6xx_destroy() only unpins its iova before dropping the
> last reference. Unlike sqe_bo and aqe_bo, whose vmap is dropped right
> after the firmware is copied in, it is freed still vmapped:
>
> WARNING: drivers/gpu/drm/msm/msm_gem.c:912 at msm_gem_vunmap+0x78/0x88
> WARNING: drivers/gpu/drm/msm/msm_gem.c:173 at update_lru_locked+0x98/0xa8
>
> Release it with msm_gem_kernel_put(), the counterpart of
> msm_gem_kernel_new().
>
> Fixes: d3a569fccfa0 ("drm/msm: a6xx: Use WHERE_AM_I for eligible targets")
> Cc: stable@vger.kernel.org
> Signed-off-by: Yuanjie Yang <yuanjie.yang@oss.qualcomm.com>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 6/9] drm/msm/a6xx: free the preemption and pwrup_reglist buffers on destroy
2026-11-30 6:55 [PATCH 0/9] drm/msm: fix unbind/rebind of the msm_dpu Yuanjie Yang
` (4 preceding siblings ...)
2026-11-30 6:55 ` [PATCH 5/9] drm/msm/a6xx: drop the shadow BO vmap on destroy Yuanjie Yang
@ 2026-11-30 6:55 ` Yuanjie Yang
2026-11-30 7:06 ` sashiko-bot
2026-11-30 6:55 ` [PATCH 7/9] drm/msm/a6xx: map the GMU rscc and PDC regions against the GPU device Yuanjie Yang
` (2 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Yuanjie Yang @ 2026-11-30 6:55 UTC (permalink / raw)
To: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona, quic_kalyant, quic_vpolimer,
quic_khsieh, jordan, konradybcio, akhilpo, antomani103, smasetty
Cc: linux-arm-msm, dri-devel, freedreno, yuanjie.yang, tingwei.zhang,
stable
a6xx_destroy() never calls a6xx_preempt_fini(), which itself only frees
preempt_bo[], and it never frees pwrup_reglist_bo either. Each leaked BO
stays mapped in gpu->vm and holds references to it, so the GPU VM, its
IOMMU domain and the SMMU context bank 0 reserved for the GPU are never
released, and the next bind of the GPU fails:
msm_dpu ae01000.display-controller: failed to bind 3d00000.gpu (...): -28
On x1e80100 the final drm_gpuvm_put() in msm_gpu_cleanup() still sees
21 references: the VM's own one plus two for each of the 10 leaked BOs.
Free all the preemption buffers in a6xx_preempt_fini(), clearing the
pointers since the a6xx_preempt_init() error path calls it as well, and
call it from a6xx_destroy() together with freeing pwrup_reglist_bo.
Fixes: e7ae83da4a28 ("drm/msm/a6xx: Implement preemption for a7xx targets")
Fixes: 50117cad0c50 ("drm/msm/a6xx: Use posamble to reset counters on preemption")
Cc: stable@vger.kernel.org
Signed-off-by: Yuanjie Yang <yuanjie.yang@oss.qualcomm.com>
---
drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 4 ++++
drivers/gpu/drm/msm/adreno/a6xx_preempt.c | 9 ++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index da1202474dee..c07fc8822ff1 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -2327,6 +2327,10 @@ static void a6xx_destroy(struct msm_gpu *gpu)
msm_gem_kernel_put(a6xx_gpu->shadow_bo, gpu->vm);
+ msm_gem_kernel_put(a6xx_gpu->pwrup_reglist_bo, gpu->vm);
+
+ a6xx_preempt_fini(gpu);
+
a6xx_llc_slices_destroy(a6xx_gpu);
a6xx_gmu_remove(a6xx_gpu);
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_preempt.c b/drivers/gpu/drm/msm/adreno/a6xx_preempt.c
index df8d4f3e8d4c..821c04bfed00 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_preempt.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_preempt.c
@@ -354,8 +354,15 @@ void a6xx_preempt_fini(struct msm_gpu *gpu)
struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu);
int i;
- for (i = 0; i < gpu->nr_rings; i++)
+ for (i = 0; i < gpu->nr_rings; i++) {
msm_gem_kernel_put(a6xx_gpu->preempt_bo[i], gpu->vm);
+ a6xx_gpu->preempt_bo[i] = NULL;
+ msm_gem_kernel_put(a6xx_gpu->preempt_smmu_bo[i], gpu->vm);
+ a6xx_gpu->preempt_smmu_bo[i] = NULL;
+ }
+
+ msm_gem_kernel_put(a6xx_gpu->preempt_postamble_bo, gpu->vm);
+ a6xx_gpu->preempt_postamble_bo = NULL;
}
void a6xx_preempt_init(struct msm_gpu *gpu)
--
2.43.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH 6/9] drm/msm/a6xx: free the preemption and pwrup_reglist buffers on destroy
2026-11-30 6:55 ` [PATCH 6/9] drm/msm/a6xx: free the preemption and pwrup_reglist buffers " Yuanjie Yang
@ 2026-11-30 7:06 ` sashiko-bot
0 siblings, 0 replies; 18+ messages in thread
From: sashiko-bot @ 2026-11-30 7:06 UTC (permalink / raw)
To: Yuanjie Yang; +Cc: dri-devel
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] drm/msm: double free on gpu->memptrs_bo in msm_gpu_init()
[1]
--
commit f46993f14cc108abd1489c5015e179df0efd70e6
Author: Yuanjie Yang <yuanjie.yang@oss.qualcomm.com>
drm/msm/a6xx: free the preemption and pwrup_reglist buffers on destroy
This commit releases all preemption buffers in a6xx_preempt_fini() while
clearing their pointers, and calls a6xx_preempt_fini() alongside freeing
pwrup_reglist_bo in a6xx_destroy().
> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_preempt.c b/drivers/gpu/drm/msm/adreno/a6xx_preempt.c
> index df8d4f3e8d4c1..821c04bfed00b 100644
> --- a/drivers/gpu/drm/msm/adreno/a6xx_preempt.c
> +++ b/drivers/gpu/drm/msm/adreno/a6xx_preempt.c
> @@ -354,8 +354,15 @@ void a6xx_preempt_fini(struct msm_gpu *gpu)
> struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu);
> int i;
>
> - for (i = 0; i < gpu->nr_rings; i++)
> + for (i = 0; i < gpu->nr_rings; i++) {
> msm_gem_kernel_put(a6xx_gpu->preempt_bo[i], gpu->vm);
> + a6xx_gpu->preempt_bo[i] = NULL;
> + msm_gem_kernel_put(a6xx_gpu->preempt_smmu_bo[i], gpu->vm);
> + a6xx_gpu->preempt_smmu_bo[i] = NULL;
> + }
> +
> + msm_gem_kernel_put(a6xx_gpu->preempt_postamble_bo, gpu->vm);
> + a6xx_gpu->preempt_postamble_bo = NULL;
> }
>
> void a6xx_preempt_init(struct msm_gpu *gpu)
[Severity: Critical]
This problem wasn't introduced by this patch, but can gpu->memptrs_bo be
double freed [1] if msm_gpu_init() fails after allocating it?
drivers/gpu/drm/msm/msm_gpu.c:msm_gpu_init() {
...
fail:
for (i = 0; i < ARRAY_SIZE(gpu->rb); i++) {
msm_ringbuffer_destroy(gpu->rb[i]);
gpu->rb[i] = NULL;
}
msm_gem_kernel_put(gpu->memptrs_bo, gpu->vm);
platform_set_drvdata(pdev, NULL);
return ret;
}
When a step such as msm_ringbuffer_new() fails, msm_gpu_init() releases
gpu->memptrs_bo without clearing the pointer to NULL. The caller's error
path (for example a6xx_gpu_init() -> a6xx_destroy() -> adreno_gpu_cleanup()
-> msm_gpu_cleanup()) then calls msm_gem_kernel_put(gpu->memptrs_bo,
gpu->vm) a second time on the already-freed GEM object.
[1] https://sashiko.dev/#/bug/linux-ee423138-c527-467c-b053-bdbec97b4f9c
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130-dpu_unbind_rebind_display-v1-0-c335387de1bb@oss.qualcomm.com?part=6
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 7/9] drm/msm/a6xx: map the GMU rscc and PDC regions against the GPU device
2026-11-30 6:55 [PATCH 0/9] drm/msm: fix unbind/rebind of the msm_dpu Yuanjie Yang
` (5 preceding siblings ...)
2026-11-30 6:55 ` [PATCH 6/9] drm/msm/a6xx: free the preemption and pwrup_reglist buffers " Yuanjie Yang
@ 2026-11-30 6:55 ` Yuanjie Yang
2026-11-30 7:07 ` sashiko-bot
2026-11-30 8:29 ` Konrad Dybcio
2026-11-30 6:55 ` [PATCH 8/9] drm/msm/a6xx: cold boot the GMU on the first resume after bind Yuanjie Yang
2026-11-30 6:55 ` [PATCH 9/9] drm/msm/a6xx: wake up a PDC left asleep by a previous GPU instance Yuanjie Yang
8 siblings, 2 replies; 18+ messages in thread
From: Yuanjie Yang @ 2026-11-30 6:55 UTC (permalink / raw)
To: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona, quic_kalyant, quic_vpolimer,
quic_khsieh, jordan, konradybcio, akhilpo, antomani103, smasetty
Cc: linux-arm-msm, dri-devel, freedreno, yuanjie.yang, tingwei.zhang,
stable
Commit 188db3d7fe66 ("drm/msm/a6xx: Rebase GMU register offsets") maps
the rscc, gmu_pdc and gmu_pdc_seq regions with
devm_platform_ioremap_resource_byname() on the GMU device. That device
has no driver, so its devres are never released and the regions cannot
be requested again on the next bind:
3d6a000.gmu: error -EBUSY: can't request region for resource
[mem 0x03d50000-0x03d5ffff]
msm_dpu ae01000.display-controller: failed to bind 3d00000.gpu (...): -19
For gmu_pdc the failure is silent and the RSC/PDC setup is skipped.
Keep the managed mappings, but attach them to the GPU device. They are
created from the GPU component bind, so component_unbind(), or a failed
bind, releases them through the devres group opened by
component_bind().
Fixes: 188db3d7fe66 ("drm/msm/a6xx: Rebase GMU register offsets")
Cc: stable@vger.kernel.org
Signed-off-by: Yuanjie Yang <yuanjie.yang@oss.qualcomm.com>
---
drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index a1561ca41a5b..e1178053953a 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -684,11 +684,20 @@ static inline void pdc_write(void __iomem *ptr, u32 offset, u32 value)
writel(value, ptr + (offset << 2));
}
+static void __iomem *a6xx_gmu_ioremap_byname(struct a6xx_gmu *gmu,
+ const char *name)
+{
+ struct a6xx_gpu *a6xx_gpu = container_of(gmu, struct a6xx_gpu, gmu);
+ struct platform_device *pdev = to_platform_device(gmu->dev);
+
+ return devm_ioremap_resource(&a6xx_gpu->base.base.pdev->dev,
+ platform_get_resource_byname(pdev, IORESOURCE_MEM, name));
+}
+
static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
{
struct a6xx_gpu *a6xx_gpu = container_of(gmu, struct a6xx_gpu, gmu);
struct adreno_gpu *adreno_gpu = &a6xx_gpu->base;
- struct platform_device *pdev = to_platform_device(gmu->dev);
u32 seqmem0_drv0_reg = REG_A6XX_RSCC_SEQ_MEM_0_DRV0;
void __iomem *seqptr = NULL;
uint32_t pdc_address_offset;
@@ -699,7 +708,7 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
if (adreno_is_a8xx(adreno_gpu))
return;
- pdcptr = devm_platform_ioremap_resource_byname(pdev, "gmu_pdc");
+ pdcptr = a6xx_gmu_ioremap_byname(gmu, "gmu_pdc");
if (IS_ERR(pdcptr))
return;
@@ -714,7 +723,7 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
pdc_address_offset = 0x30080;
if (!pdc_in_aop) {
- seqptr = devm_platform_ioremap_resource_byname(pdev, "gmu_pdc_seq");
+ seqptr = a6xx_gmu_ioremap_byname(gmu, "gmu_pdc_seq");
if (IS_ERR(seqptr))
return;
}
@@ -2464,7 +2473,7 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node)
if (adreno_is_a650_family(adreno_gpu) ||
adreno_is_a7xx(adreno_gpu)) {
- gmu->rscc = devm_platform_ioremap_resource_byname(pdev, "rscc");
+ gmu->rscc = a6xx_gmu_ioremap_byname(gmu, "rscc");
if (IS_ERR(gmu->rscc)) {
ret = -ENODEV;
goto err_mmio;
--
2.43.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH 7/9] drm/msm/a6xx: map the GMU rscc and PDC regions against the GPU device
2026-11-30 6:55 ` [PATCH 7/9] drm/msm/a6xx: map the GMU rscc and PDC regions against the GPU device Yuanjie Yang
@ 2026-11-30 7:07 ` sashiko-bot
2026-11-30 8:29 ` Konrad Dybcio
1 sibling, 0 replies; 18+ messages in thread
From: sashiko-bot @ 2026-11-30 7:07 UTC (permalink / raw)
To: Yuanjie Yang; +Cc: dri-devel
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] drm/msm/a6xx: ignored a6xx_gmu_pwrlevels_probe() return in
a6xx_gmu_init() [1]
--
commit 95ee2296d872dd08a9e4fb839630fa6c9e25a217
Author: Yuanjie Yang <yuanjie.yang@oss.qualcomm.com>
drm/msm/a6xx: map the GMU rscc and PDC regions against the GPU device
This commit attaches the devres-managed mappings for the GMU rscc, gmu_pdc,
and gmu_pdc_seq regions to the GPU device rather than the driverless GMU
device so that they are properly released on component unbind or bind
failure.
> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
> index a1561ca41a5b3..e1178053953ad 100644
> --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
> +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
[ ... ]
> @@ -2464,7 +2473,7 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node)
>
> if (adreno_is_a650_family(adreno_gpu) ||
> adreno_is_a7xx(adreno_gpu)) {
> - gmu->rscc = devm_platform_ioremap_resource_byname(pdev, "rscc");
> + gmu->rscc = a6xx_gmu_ioremap_byname(gmu, "rscc");
> if (IS_ERR(gmu->rscc)) {
> ret = -ENODEV;
> goto err_mmio;
[Severity: High]
This problem wasn't introduced by this patch, but should a6xx_gmu_init()
check the return value of a6xx_gmu_pwrlevels_probe() [1]?
drivers/gpu/drm/msm/adreno/a6xx_gmu.c:a6xx_gmu_init() {
...
/* Get the power levels for the GMU and GPU */
a6xx_gmu_pwrlevels_probe(gmu);
ret = a6xx_gmu_acd_probe(gmu);
if (ret)
goto detach_gxpd;
...
}
If a6xx_gmu_pwrlevels_probe() fails (for example, returning -EPROBE_DEFER
when OPP tables are not yet ready), probe continues with unpopulated
frequency tables (gmu->nr_gmu_freqs and gmu->nr_gpu_freqs remain 0),
leading to invalid hardware initialization and a kernel panic when voting
for frequencies.
[1] https://sashiko.dev/#/bug/linux-0cc3192b-3c52-4862-8d9b-9647c0282109
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130-dpu_unbind_rebind_display-v1-0-c335387de1bb@oss.qualcomm.com?part=7
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH 7/9] drm/msm/a6xx: map the GMU rscc and PDC regions against the GPU device
2026-11-30 6:55 ` [PATCH 7/9] drm/msm/a6xx: map the GMU rscc and PDC regions against the GPU device Yuanjie Yang
2026-11-30 7:07 ` sashiko-bot
@ 2026-11-30 8:29 ` Konrad Dybcio
2026-11-30 9:56 ` yuanjiey
1 sibling, 1 reply; 18+ messages in thread
From: Konrad Dybcio @ 2026-11-30 8:29 UTC (permalink / raw)
To: Yuanjie Yang, robin.clark, lumag, abhinav.kumar, jesszhan0024,
sean, marijn.suijten, airlied, simona, quic_kalyant,
quic_vpolimer, quic_khsieh, jordan, konradybcio, akhilpo,
antomani103, smasetty
Cc: linux-arm-msm, dri-devel, freedreno, tingwei.zhang, stable
On 11/30/26 7:55 AM, Yuanjie Yang wrote:
> Commit 188db3d7fe66 ("drm/msm/a6xx: Rebase GMU register offsets") maps
> the rscc, gmu_pdc and gmu_pdc_seq regions with
> devm_platform_ioremap_resource_byname() on the GMU device. That device
> has no driver, so its devres are never released and the regions cannot
> be requested again on the next bind:
>
> 3d6a000.gmu: error -EBUSY: can't request region for resource
> [mem 0x03d50000-0x03d5ffff]
> msm_dpu ae01000.display-controller: failed to bind 3d00000.gpu (...): -19
msm-next currently carries a patch to bind a driver to the GMU
Konrad
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH 7/9] drm/msm/a6xx: map the GMU rscc and PDC regions against the GPU device
2026-11-30 8:29 ` Konrad Dybcio
@ 2026-11-30 9:56 ` yuanjiey
0 siblings, 0 replies; 18+ messages in thread
From: yuanjiey @ 2026-11-30 9:56 UTC (permalink / raw)
To: Konrad Dybcio
Cc: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona, quic_kalyant, quic_vpolimer,
quic_khsieh, jordan, konradybcio, akhilpo, antomani103, smasetty,
linux-arm-msm, dri-devel, freedreno, tingwei.zhang, stable
On Mon, Nov 30, 2026 at 09:29:49AM +0100, Konrad Dybcio wrote:
> On 11/30/26 7:55 AM, Yuanjie Yang wrote:
> > Commit 188db3d7fe66 ("drm/msm/a6xx: Rebase GMU register offsets") maps
> > the rscc, gmu_pdc and gmu_pdc_seq regions with
> > devm_platform_ioremap_resource_byname() on the GMU device. That device
> > has no driver, so its devres are never released and the regions cannot
> > be requested again on the next bind:
> >
> > 3d6a000.gmu: error -EBUSY: can't request region for resource
> > [mem 0x03d50000-0x03d5ffff]
> > msm_dpu ae01000.display-controller: failed to bind 3d00000.gpu (...): -19
>
> msm-next currently carries a patch to bind a driver to the GMU
will drop this patch in next series.
Thanks,
Yuanjie
> Konrad
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 8/9] drm/msm/a6xx: cold boot the GMU on the first resume after bind
2026-11-30 6:55 [PATCH 0/9] drm/msm: fix unbind/rebind of the msm_dpu Yuanjie Yang
` (6 preceding siblings ...)
2026-11-30 6:55 ` [PATCH 7/9] drm/msm/a6xx: map the GMU rscc and PDC regions against the GPU device Yuanjie Yang
@ 2026-11-30 6:55 ` Yuanjie Yang
2026-11-30 6:55 ` [PATCH 9/9] drm/msm/a6xx: wake up a PDC left asleep by a previous GPU instance Yuanjie Yang
8 siblings, 0 replies; 18+ messages in thread
From: Yuanjie Yang @ 2026-11-30 6:55 UTC (permalink / raw)
To: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona, quic_kalyant, quic_vpolimer,
quic_khsieh, jordan, konradybcio, akhilpo, antomani103, smasetty
Cc: linux-arm-msm, dri-devel, freedreno, yuanjie.yang, tingwei.zhang,
stable
On a7xx/a8xx a6xx_gmu_resume() warm boots the GMU when
CX_MISC_TCM_RET_CNTL reads back 1. The flag survives a GPU unbind/bind
as long as CX stays powered, but a warm boot skips a6xx_gmu_fw_load()
while the icache/dcache/dummy buffers of the new instance are empty, so
the first GPU open after a rebind fails:
*ERROR* GMU firmware initialization timed out
*ERROR* Couldn't power up the GPU: -110
Only allow a warm boot on a7xx/a8xx once this instance has loaded the
firmware.
Fixes: af66706accdf ("drm/msm/a6xx: Add skeleton A7xx support")
Cc: stable@vger.kernel.org
Signed-off-by: Yuanjie Yang <yuanjie.yang@oss.qualcomm.com>
---
drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 4 ++++
drivers/gpu/drm/msm/adreno/a6xx_gmu.h | 1 +
2 files changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index e1178053953a..e6b8985c473b 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -992,6 +992,8 @@ static int a6xx_gmu_fw_start(struct a6xx_gmu *gmu, unsigned int state)
ret = a6xx_gmu_fw_load(gmu);
if (ret)
return ret;
+
+ gmu->fw_loaded = true;
}
/* Clear init result to make sure we are getting a fresh value */
@@ -1382,6 +1384,8 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
if (adreno_is_a7xx(adreno_gpu) || adreno_is_a8xx(adreno_gpu)) {
status = a6xx_cx_misc_read(a6xx_gpu, REG_A7XX_CX_MISC_TCM_RET_CNTL) == 1 ?
GMU_WARM_BOOT : GMU_COLD_BOOT;
+ if (!gmu->fw_loaded)
+ status = GMU_COLD_BOOT;
} else if (gmu->legacy) {
status = gmu_read(gmu, REG_A6XX_GMU_GENERAL_7) == 1 ?
GMU_WARM_BOOT : GMU_COLD_BOOT;
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
index b9e966e602e2..f3b8f22bd189 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
@@ -117,6 +117,7 @@ struct a6xx_gmu {
bool initialized;
bool hung;
bool legacy; /* a618 or a630 */
+ bool fw_loaded;
/* For power domain callback */
struct notifier_block pd_nb;
--
2.43.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 9/9] drm/msm/a6xx: wake up a PDC left asleep by a previous GPU instance
2026-11-30 6:55 [PATCH 0/9] drm/msm: fix unbind/rebind of the msm_dpu Yuanjie Yang
` (7 preceding siblings ...)
2026-11-30 6:55 ` [PATCH 8/9] drm/msm/a6xx: cold boot the GMU on the first resume after bind Yuanjie Yang
@ 2026-11-30 6:55 ` Yuanjie Yang
8 siblings, 0 replies; 18+ messages in thread
From: Yuanjie Yang @ 2026-11-30 6:55 UTC (permalink / raw)
To: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona, quic_kalyant, quic_vpolimer,
quic_khsieh, jordan, konradybcio, akhilpo, antomani103, smasetty
Cc: linux-arm-msm, dri-devel, freedreno, yuanjie.yang, tingwei.zhang,
stable
Since commit f248d5d5159a ("drm/msm/a6xx: Fix PDC sleep sequence") the
PDC is only woken up when GMU_STATUS_PDC_SLEEP is set, i.e. after this
instance put it to sleep. The PDC lives outside the GPU and stays
asleep across a GPU unbind/bind, while gmu->status of the new instance
starts out clear. The wake sequence is then skipped, the GMU cannot
reach RPMh and the first GPU open after a rebind fails:
*ERROR* Message HFI_H2F_MSG_GX_BW_PERF_VOTE id 8 timed out waiting for
response
*ERROR* Timeout waiting for GMU OOB set GPU_SET: 0x0
*ERROR* gpu hw init failed: -110
On the first GMU boot of an instance, set GMU_STATUS_PDC_SLEEP if the
RSC status reports the PDC asleep, using the same bit a6xx_rpmh_stop()
waits for, so that the wake sequence still only follows a sleep. Move
the bit selection into a helper shared with a6xx_rpmh_stop().
Fixes: f248d5d5159a ("drm/msm/a6xx: Fix PDC sleep sequence")
Cc: stable@vger.kernel.org
Signed-off-by: Yuanjie Yang <yuanjie.yang@oss.qualcomm.com>
---
drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index e6b8985c473b..8618887fb8be 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -623,6 +623,14 @@ static int a6xx_gmu_notify_slumber(struct a6xx_gmu *gmu)
return ret;
}
+static u32 a6xx_rsc_sleep_mask(struct adreno_gpu *adreno_gpu)
+{
+ if (adreno_is_a840(adreno_gpu) || adreno_is_a850_family(adreno_gpu))
+ return BIT(30);
+
+ return BIT(16);
+}
+
static int a6xx_rpmh_start(struct a6xx_gmu *gmu)
{
int ret;
@@ -657,16 +665,13 @@ static void a6xx_rpmh_stop(struct a6xx_gmu *gmu)
{
struct a6xx_gpu *a6xx_gpu = container_of(gmu, struct a6xx_gpu, gmu);
struct adreno_gpu *adreno_gpu = &a6xx_gpu->base;
- u32 bitmask = BIT(16);
+ u32 bitmask = a6xx_rsc_sleep_mask(adreno_gpu);
int ret;
u32 val;
if (!test_and_clear_bit(GMU_STATUS_FW_START, &gmu->status))
return;
- if (adreno_is_a840(adreno_gpu) || adreno_is_a850_family(adreno_gpu))
- bitmask = BIT(30);
-
gmu_write(gmu, REG_A6XX_GMU_RSCC_CONTROL_REQ, 1);
ret = gmu_poll_timeout_rscc(gmu, REG_A6XX_GPU_RSCC_RSC_STATUS0_DRV0,
@@ -980,6 +985,13 @@ static int a6xx_gmu_fw_start(struct a6xx_gmu *gmu, unsigned int state)
else if (!adreno_is_a8xx(adreno_gpu))
gmu_write(gmu, REG_A6XX_GMU_GENERAL_7, 1);
+ if (!gmu->fw_loaded &&
+ (gmu_read_rscc(gmu, REG_A6XX_GPU_RSCC_RSC_STATUS0_DRV0) &
+ a6xx_rsc_sleep_mask(adreno_gpu))) {
+ DRM_DEV_DEBUG_DRIVER(gmu->dev, "GPU RSC left asleep, waking it up\n");
+ set_bit(GMU_STATUS_PDC_SLEEP, &gmu->status);
+ }
+
ret = a6xx_rpmh_start(gmu);
if (ret)
return ret;
--
2.43.0
^ permalink raw reply related [flat|nested] 18+ messages in thread