Skip to content

Commit d2308dd

Browse files
thierryredinggregkh
authored andcommitted
drm/tegra: sor: Grab runtime PM reference across reset
commit ac097ae upstream. The SOR resets are exclusively shared with the SOR power domain. This means that exclusive access can only be granted temporarily and in order for that to work, a rigorous sequence must be observed. To ensure that a single consumer gets exclusive access to a reset, each consumer must implement a rigorous protocol using the reset_control_acquire() and reset_control_release() functions. However, these functions alone don't provide any guarantees at the system level. Drivers need to ensure that the only a single consumer has access to the reset at the same time. In order for the SOR to be able to exclusively access its reset, it must therefore ensure that the SOR power domain is not powered off by holding on to a runtime PM reference to that power domain across the reset assert/deassert operation. This used to work fine by accident, but was revealed when recently more devices started to rely on the SOR power domain. Fixes: 11c632e ("drm/tegra: sor: Implement acquire/release for reset") Reported-by: Jonathan Hunter <jonathanh@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f552f95 commit d2308dd

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

  • drivers/gpu/drm/tegra

drivers/gpu/drm/tegra/sor.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3115,6 +3115,12 @@ static int tegra_sor_init(struct host1x_client *client)
31153115
* kernel is possible.
31163116
*/
31173117
if (sor->rst) {
3118+
err = pm_runtime_resume_and_get(sor->dev);
3119+
if (err < 0) {
3120+
dev_err(sor->dev, "failed to get runtime PM: %d\n", err);
3121+
return err;
3122+
}
3123+
31183124
err = reset_control_acquire(sor->rst);
31193125
if (err < 0) {
31203126
dev_err(sor->dev, "failed to acquire SOR reset: %d\n",
@@ -3148,6 +3154,7 @@ static int tegra_sor_init(struct host1x_client *client)
31483154
}
31493155

31503156
reset_control_release(sor->rst);
3157+
pm_runtime_put(sor->dev);
31513158
}
31523159

31533160
err = clk_prepare_enable(sor->clk_safe);

0 commit comments

Comments
 (0)