* [PATCH] drm/tegra: nvjpg: fix runtime PM setup in probe
@ 2026-11-29 13:44 Jiawen Liu
2026-11-29 14:00 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Jiawen Liu @ 2026-11-29 13:44 UTC (permalink / raw)
To: Thierry Reding, Mikko Perttunen, David Airlie, Simona Vetter,
Jonathan Hunter
Cc: dri-devel, linux-tegra, linux-kernel
devm_pm_runtime_enable() can fail after rolling runtime PM back to its
disabled state. nvjpg_probe() ignored that failure and could register a
Host1x client that was unable to resume for a channel submission.
Use the non-fallible pm_runtime_enable() after the client is registered,
and disable runtime PM explicitly in nvjpg_remove() after Host1x and
Falcon teardown.
Fixes: 2e1fe44e06e3 ("drm/tegra: Add NVJPG driver")
Signed-off-by: Jiawen Liu <1298662399@qq.com>
---
drivers/gpu/drm/tegra/nvjpg.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/tegra/nvjpg.c b/drivers/gpu/drm/tegra/nvjpg.c
index e302a8d1f6e7f..0b6a8467f5183 100644
--- a/drivers/gpu/drm/tegra/nvjpg.c
+++ b/drivers/gpu/drm/tegra/nvjpg.c
@@ -292,7 +292,7 @@ static int nvjpg_probe(struct platform_device *pdev)
pm_runtime_use_autosuspend(dev);
pm_runtime_set_autosuspend_delay(dev, 500);
- devm_pm_runtime_enable(dev);
+ pm_runtime_enable(dev);
return 0;
@@ -308,6 +308,8 @@ static void nvjpg_remove(struct platform_device *pdev)
host1x_client_unregister(&nvjpg->client.base);
falcon_exit(&nvjpg->falcon);
+ pm_runtime_dont_use_autosuspend(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
}
static const struct dev_pm_ops nvjpg_pm_ops = {
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/tegra: nvjpg: fix runtime PM setup in probe
2026-11-29 13:44 [PATCH] drm/tegra: nvjpg: fix runtime PM setup in probe Jiawen Liu
@ 2026-11-29 14:00 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-29 14:00 UTC (permalink / raw)
To: Jiawen Liu; +Cc: dri-devel
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] drm/tegra: nvjpg: double runtime PM disable across
nvjpg_exit() and nvjpg_remove()
- [Medium] drm/tegra: nvjpg: pm_runtime_enable() called after
host1x_client_register() in nvjpg_probe()
- [Medium] drm/tegra: nvjpg: runtime PM disabled after falcon_exit() in
nvjpg_remove()
--
commit 38180484ce9eb95d6bcaa5e7c4e2dae6f0f9c4fd
Author: Jiawen Liu <1298662399@qq.com>
drm/tegra: nvjpg: fix runtime PM setup in probe
This commit replaces devm_pm_runtime_enable() with pm_runtime_enable() in
nvjpg_probe() and adds runtime PM cleanup to nvjpg_remove().
> diff --git a/drivers/gpu/drm/tegra/nvjpg.c b/drivers/gpu/drm/tegra/nvjpg.c
> index e302a8d1f6e7f..0b6a8467f5183 100644
> --- a/drivers/gpu/drm/tegra/nvjpg.c
> +++ b/drivers/gpu/drm/tegra/nvjpg.c
> @@ -292,7 +292,7 @@ static int nvjpg_probe(struct platform_device *pdev)
>
> pm_runtime_use_autosuspend(dev);
> pm_runtime_set_autosuspend_delay(dev, 500);
> - devm_pm_runtime_enable(dev);
> + pm_runtime_enable(dev);
[Severity: Medium]
Should pm_runtime_enable() be called before host1x_client_register() (and
disabled on registration failure), as in gr2d_probe() and gr3d_probe()?
Because tegra_nvjpg_driver is the last entry in drivers[], calling
host1x_client_register() as the final Host1x subdevice synchronously runs
host1x_drm_probe() -> nvjpg_init() -> drm_dev_register() before
host1x_client_register() returns. Channel submissions to NVJPG during that
window hit pm_runtime_resume_and_get() while runtime PM is still disabled
and fail with -EACCES. Also, if host1x_drm_probe() fails after
host1x_device_init(), its error path runs host1x_device_exit() ->
nvjpg_exit() -> pm_runtime_force_suspend() -> pm_runtime_disable(),
incrementing dev->power.disable_depth from 1 to 2 so that
pm_runtime_enable() here leaves runtime PM disabled.
>
> return 0;
>
> @@ -308,6 +308,8 @@ static void nvjpg_remove(struct platform_device *pdev)
>
> host1x_client_unregister(&nvjpg->client.base);
> falcon_exit(&nvjpg->falcon);
> + pm_runtime_dont_use_autosuspend(&pdev->dev);
> + pm_runtime_disable(&pdev->dev);
[Severity: Medium]
Does calling pm_runtime_disable() here after host1x_client_unregister()
disable runtime PM twice?
When the composite Host1x device is active, host1x_client_unregister()
calls host1x_device_exit() -> nvjpg_exit(), which already runs:
drivers/gpu/drm/tegra/nvjpg.c:nvjpg_exit() {
...
pm_runtime_dont_use_autosuspend(client->dev);
pm_runtime_force_suspend(client->dev);
...
}
pm_runtime_force_suspend() calls pm_runtime_disable() and leaves
dev->power.disable_depth at 1, so the second pm_runtime_disable() in
nvjpg_remove() increments disable_depth to 2 for a single
pm_runtime_enable() in nvjpg_probe(). Because pm_runtime_reinit() does not
reset disable_depth on unbind, a subsequent re-probe only decrements
disable_depth from 2 to 1, leaving runtime PM disabled and causing all
NVJPG submissions to fail with -EACCES. As in ace01e2af387 ("drm/tegra:
gr2d/gr3d: Contain PM in the gr*d_probe/gr*d_remove"), runtime PM enable
and disable should be contained in probe and remove rather than mixed with
pm_runtime_force_suspend() in nvjpg_exit().
[Severity: Medium]
Should pm_runtime_dont_use_autosuspend() and pm_runtime_disable() also run
before falcon_exit(), matching vic_remove() and nvdec_remove()?
__device_release_driver() calls pm_runtime_get_sync() and
pm_runtime_put_sync() right before nvjpg_remove(), which leaves the device
RPM_ACTIVE while the 500 ms autosuspend timer is pending. When
nvjpg_exit() has not force-suspended the device, falcon_exit() tears down
the Falcon firmware while runtime PM is still active, and
pm_runtime_dont_use_autosuspend() can then trigger nvjpg_runtime_suspend()
after falcon_exit() has already run.
--
Sashiko AI review · https://sashiko.dev/#/patchset/tencent_A7D12B6489AE96132560FAEF56E5517D5106@qq.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-29 14:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 13:44 [PATCH] drm/tegra: nvjpg: fix runtime PM setup in probe Jiawen Liu
2026-11-29 14:00 ` sashiko-bot
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.