rocket_reset() drops the in-flight job's runtime PM reference with
pm_runtime_put_noidle(), which requests nothing, so the core does not
suspend until something else asks and its power domain does not cycle. On
RK3576 the domain's power-on resets the NPU bus interface; without it the
IOMMU stops answering and the job after a timeout fails.

Use pm_runtime_put_autosuspend(), as the completion path does. On a ROCK 4D
the job after a timeout goes from 0 to 128 of 128 channels correct.

Link: https://lore.kernel.org/all/[email protected]/
Fixes: 0810d5ad88a1 ("accel/rocket: Add job submission IOCTL")
Signed-off-by: Jiaxing Hu <[email protected]>
Tested-by: Igor Paunovic <[email protected]> # RK3588, three cores, induced 
reset, JOB_TIMEOUT_MS=2
---
 drivers/accel/rocket/rocket_job.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/accel/rocket/rocket_job.c 
b/drivers/accel/rocket/rocket_job.c
index bcafa89ba..996890025 100644
--- a/drivers/accel/rocket/rocket_job.c
+++ b/drivers/accel/rocket/rocket_job.c
@@ -443,12 +443,12 @@ rocket_reset(struct rocket_core *core, struct 
drm_sched_job *bad)
 
        /*
         * No handler is running now, but we might still have stuck jobs. Let's
-        * make sure the PM counters stay balanced by manually calling
-        * pm_runtime_put_noidle().
+        * make sure the PM counters stay balanced by putting the reference the
+        * job took, and request idle while doing it so the core can suspend.
         */
        scoped_guard(mutex, &core->job_lock) {
                if (core->in_flight_job)
-                       pm_runtime_put_noidle(core->dev);
+                       pm_runtime_put_autosuspend(core->dev);
 
                iommu_detach_group(NULL, core->iommu_group);
 
-- 
2.43.0

Reply via email to