Skip to content

Commit 40a2a91

Browse files
clamor-sgregkh
authored andcommitted
drm/tegra: gr2d/gr3d: Initialize address register map before HOST1X client is registered
[ Upstream commit c4ef5ba ] 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> Signed-off-by: Thierry Reding <treding@nvidia.com> Link: https://patch.msgid.link/20260517091450.46728-2-clamor95@gmail.com Stable-dep-of: ace01e2 ("drm/tegra: gr2d/gr3d: Contain PM in the gr*d_probe/gr*d_remove") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 05d85fd commit 40a2a91

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

drivers/gpu/drm/tegra/gr2d.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,16 +276,16 @@ static int gr2d_probe(struct platform_device *pdev)
276276
if (err)
277277
return err;
278278

279+
/* initialize address register map */
280+
for (i = 0; i < ARRAY_SIZE(gr2d_addr_regs); i++)
281+
set_bit(gr2d_addr_regs[i], gr2d->addr_regs);
282+
279283
err = host1x_client_register(&gr2d->client.base);
280284
if (err < 0) {
281285
dev_err(dev, "failed to register host1x client: %d\n", err);
282286
return err;
283287
}
284288

285-
/* initialize address register map */
286-
for (i = 0; i < ARRAY_SIZE(gr2d_addr_regs); i++)
287-
set_bit(gr2d_addr_regs[i], gr2d->addr_regs);
288-
289289
return 0;
290290
}
291291

drivers/gpu/drm/tegra/gr3d.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -506,17 +506,17 @@ static int gr3d_probe(struct platform_device *pdev)
506506
if (err)
507507
return err;
508508

509+
/* initialize address register map */
510+
for (i = 0; i < ARRAY_SIZE(gr3d_addr_regs); i++)
511+
set_bit(gr3d_addr_regs[i], gr3d->addr_regs);
512+
509513
err = host1x_client_register(&gr3d->client.base);
510514
if (err < 0) {
511515
dev_err(&pdev->dev, "failed to register host1x client: %d\n",
512516
err);
513517
return err;
514518
}
515519

516-
/* initialize address register map */
517-
for (i = 0; i < ARRAY_SIZE(gr3d_addr_regs); i++)
518-
set_bit(gr3d_addr_regs[i], gr3d->addr_regs);
519-
520520
return 0;
521521
}
522522

0 commit comments

Comments
 (0)