* [PATCH v3 1/2] drm/tegra: gr2d/gr3d: Initialize address register map before HOST1X client is registered
2026-05-17 9:14 [PATCH v3 0/2] drm/tegra: gr2d/gr3d: Move pm_runtime_enable to gr*d_probe Svyatoslav Ryhel
@ 2026-05-17 9:14 ` Svyatoslav Ryhel
2026-05-17 9:14 ` [PATCH v3 2/2] drm/tegra: gr2d/gr3d: Contain PM in the gr*d_probe/gr*d_remove Svyatoslav Ryhel
2026-05-28 12:14 ` [PATCH v3 0/2] drm/tegra: gr2d/gr3d: Move pm_runtime_enable to gr*d_probe Thierry Reding
2 siblings, 0 replies; 4+ messages in thread
From: Svyatoslav Ryhel @ 2026-05-17 9:14 UTC (permalink / raw)
To: Thierry Reding, Mikko Perttunen, David Airlie, Simona Vetter,
Jonathan Hunter, Ion Agorria, Svyatoslav Ryhel
Cc: dri-devel, linux-tegra, linux-kernel
The host1x_client_register() function is called just prior to register map
initialization loop, making the device available to userspace. This may
result in userspace attempting to submits a job before the register map is
initialized. Address this by moving register initialization before host1x
client registration.
Acked-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
drivers/gpu/drm/tegra/gr2d.c | 8 ++++----
drivers/gpu/drm/tegra/gr3d.c | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/tegra/gr2d.c b/drivers/gpu/drm/tegra/gr2d.c
index 21f4dd0fa6af..e4148b034af7 100644
--- a/drivers/gpu/drm/tegra/gr2d.c
+++ b/drivers/gpu/drm/tegra/gr2d.c
@@ -276,16 +276,16 @@ static int gr2d_probe(struct platform_device *pdev)
if (err)
return err;
+ /* initialize address register map */
+ for (i = 0; i < ARRAY_SIZE(gr2d_addr_regs); i++)
+ set_bit(gr2d_addr_regs[i], gr2d->addr_regs);
+
err = host1x_client_register(&gr2d->client.base);
if (err < 0) {
dev_err(dev, "failed to register host1x client: %d\n", err);
return err;
}
- /* initialize address register map */
- for (i = 0; i < ARRAY_SIZE(gr2d_addr_regs); i++)
- set_bit(gr2d_addr_regs[i], gr2d->addr_regs);
-
return 0;
}
diff --git a/drivers/gpu/drm/tegra/gr3d.c b/drivers/gpu/drm/tegra/gr3d.c
index 42e9656ab80c..47b0c6c56bfd 100644
--- a/drivers/gpu/drm/tegra/gr3d.c
+++ b/drivers/gpu/drm/tegra/gr3d.c
@@ -506,6 +506,10 @@ static int gr3d_probe(struct platform_device *pdev)
if (err)
return err;
+ /* initialize address register map */
+ for (i = 0; i < ARRAY_SIZE(gr3d_addr_regs); i++)
+ set_bit(gr3d_addr_regs[i], gr3d->addr_regs);
+
err = host1x_client_register(&gr3d->client.base);
if (err < 0) {
dev_err(&pdev->dev, "failed to register host1x client: %d\n",
@@ -513,10 +517,6 @@ static int gr3d_probe(struct platform_device *pdev)
return err;
}
- /* initialize address register map */
- for (i = 0; i < ARRAY_SIZE(gr3d_addr_regs); i++)
- set_bit(gr3d_addr_regs[i], gr3d->addr_regs);
-
return 0;
}
--
2.51.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH v3 2/2] drm/tegra: gr2d/gr3d: Contain PM in the gr*d_probe/gr*d_remove
2026-05-17 9:14 [PATCH v3 0/2] drm/tegra: gr2d/gr3d: Move pm_runtime_enable to gr*d_probe Svyatoslav Ryhel
2026-05-17 9:14 ` [PATCH v3 1/2] drm/tegra: gr2d/gr3d: Initialize address register map before HOST1X client is registered Svyatoslav Ryhel
@ 2026-05-17 9:14 ` Svyatoslav Ryhel
2026-05-28 12:14 ` [PATCH v3 0/2] drm/tegra: gr2d/gr3d: Move pm_runtime_enable to gr*d_probe Thierry Reding
2 siblings, 0 replies; 4+ messages in thread
From: Svyatoslav Ryhel @ 2026-05-17 9:14 UTC (permalink / raw)
To: Thierry Reding, Mikko Perttunen, David Airlie, Simona Vetter,
Jonathan Hunter, Ion Agorria, Svyatoslav Ryhel
Cc: dri-devel, linux-tegra, linux-kernel
From: Ion Agorria <ion@agorria.com>
The current power management configuration causes GR2G/GR3D to malfunction
after resume. Reconfigure all PM actions to be handled within the GR*D
probe and remove operations to address this.
Fixes: 62fa0a985e2c ("drm/tegra: Enable runtime PM during probe")
Acked-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Ion Agorria <ion@agorria.com>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
drivers/gpu/drm/tegra/gr2d.c | 13 ++++++-------
drivers/gpu/drm/tegra/gr3d.c | 13 ++++++-------
2 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/tegra/gr2d.c b/drivers/gpu/drm/tegra/gr2d.c
index e4148b034af7..892e3450b281 100644
--- a/drivers/gpu/drm/tegra/gr2d.c
+++ b/drivers/gpu/drm/tegra/gr2d.c
@@ -100,9 +100,6 @@ static int gr2d_exit(struct host1x_client *client)
if (err < 0)
return err;
- pm_runtime_dont_use_autosuspend(client->dev);
- pm_runtime_force_suspend(client->dev);
-
host1x_client_iommu_detach(client);
host1x_syncpt_put(client->syncpts[0]);
host1x_channel_put(gr2d->channel);
@@ -280,12 +277,18 @@ static int gr2d_probe(struct platform_device *pdev)
for (i = 0; i < ARRAY_SIZE(gr2d_addr_regs); i++)
set_bit(gr2d_addr_regs[i], gr2d->addr_regs);
+ pm_runtime_enable(dev);
+
err = host1x_client_register(&gr2d->client.base);
if (err < 0) {
+ pm_runtime_disable(dev);
dev_err(dev, "failed to register host1x client: %d\n", err);
return err;
}
+ pm_runtime_use_autosuspend(dev);
+ pm_runtime_set_autosuspend_delay(dev, 500);
+
return 0;
}
@@ -367,10 +370,6 @@ static int __maybe_unused gr2d_runtime_resume(struct device *dev)
goto disable_clk;
}
- pm_runtime_enable(dev);
- pm_runtime_use_autosuspend(dev);
- pm_runtime_set_autosuspend_delay(dev, 500);
-
return 0;
disable_clk:
diff --git a/drivers/gpu/drm/tegra/gr3d.c b/drivers/gpu/drm/tegra/gr3d.c
index 47b0c6c56bfd..388e47943d5e 100644
--- a/drivers/gpu/drm/tegra/gr3d.c
+++ b/drivers/gpu/drm/tegra/gr3d.c
@@ -109,9 +109,6 @@ static int gr3d_exit(struct host1x_client *client)
if (err < 0)
return err;
- pm_runtime_dont_use_autosuspend(client->dev);
- pm_runtime_force_suspend(client->dev);
-
host1x_client_iommu_detach(client);
host1x_syncpt_put(client->syncpts[0]);
host1x_channel_put(gr3d->channel);
@@ -510,13 +507,19 @@ static int gr3d_probe(struct platform_device *pdev)
for (i = 0; i < ARRAY_SIZE(gr3d_addr_regs); i++)
set_bit(gr3d_addr_regs[i], gr3d->addr_regs);
+ pm_runtime_enable(&pdev->dev);
+
err = host1x_client_register(&gr3d->client.base);
if (err < 0) {
+ pm_runtime_disable(&pdev->dev);
dev_err(&pdev->dev, "failed to register host1x client: %d\n",
err);
return err;
}
+ pm_runtime_use_autosuspend(&pdev->dev);
+ pm_runtime_set_autosuspend_delay(&pdev->dev, 500);
+
return 0;
}
@@ -578,10 +581,6 @@ static int __maybe_unused gr3d_runtime_resume(struct device *dev)
goto disable_clk;
}
- pm_runtime_enable(dev);
- pm_runtime_use_autosuspend(dev);
- pm_runtime_set_autosuspend_delay(dev, 500);
-
return 0;
disable_clk:
--
2.51.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v3 0/2] drm/tegra: gr2d/gr3d: Move pm_runtime_enable to gr*d_probe
2026-05-17 9:14 [PATCH v3 0/2] drm/tegra: gr2d/gr3d: Move pm_runtime_enable to gr*d_probe Svyatoslav Ryhel
2026-05-17 9:14 ` [PATCH v3 1/2] drm/tegra: gr2d/gr3d: Initialize address register map before HOST1X client is registered Svyatoslav Ryhel
2026-05-17 9:14 ` [PATCH v3 2/2] drm/tegra: gr2d/gr3d: Contain PM in the gr*d_probe/gr*d_remove Svyatoslav Ryhel
@ 2026-05-28 12:14 ` Thierry Reding
2 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2026-05-28 12:14 UTC (permalink / raw)
To: Svyatoslav Ryhel
Cc: Mikko Perttunen, David Airlie, Simona Vetter, Jonathan Hunter,
Ion Agorria, dri-devel, linux-tegra, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 927 bytes --]
On Sun, May 17, 2026 at 12:14:48PM +0300, Svyatoslav Ryhel wrote:
> The gr*d_remove() has pm_runtime_disable, this indicates it should be
> paired with pm_runtime_enable in the probe instead of being inside
> gr*d_runtime_resume().
>
> ---
> Changes in v3:
> - pm_runtime_enable moved before host1x_client_register
>
> Changes in v2:
> - remove pm from gr2d_exit along with pm from gr2d_runtime_resume
> - move register map initialize before host1x_client_register
> ---
>
> Ion Agorria (1):
> drm/tegra: gr2d/gr3d: Contain PM in the gr*d_probe/gr*d_remove
>
> Svyatoslav Ryhel (1):
> drm/tegra: gr2d/gr3d: Initialize address register map before HOST1X
> client is registered
>
> drivers/gpu/drm/tegra/gr2d.c | 19 +++++++++----------
> drivers/gpu/drm/tegra/gr3d.c | 19 +++++++++----------
> 2 files changed, 18 insertions(+), 20 deletions(-)
Both patches applied, thanks.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread