group_bind_locked() can fail if the MMU block is stuck. This is normally
a reset situation, but by the time we reset the GPU, we might have
tried to resume a group that's not resident, which will probably trip
out the FW. So let's avoid that by bailing out when group_bind_locked()
returns an error. We don't even try to start more groups because the
GPU will be reset anyway.

Fixes: de8548813824 ("drm/panthor: Add the scheduler logical block")
Reported-by: [email protected]
Closes: 
https://sashiko.dev/#/patchset/[email protected]?part=7
Signed-off-by: Boris Brezillon <[email protected]>
---
 drivers/gpu/drm/panthor/panthor_sched.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panthor/panthor_sched.c 
b/drivers/gpu/drm/panthor/panthor_sched.c
index 5fe95d03f23e..298b046c95ed 100644
--- a/drivers/gpu/drm/panthor/panthor_sched.c
+++ b/drivers/gpu/drm/panthor/panthor_sched.c
@@ -2368,7 +2368,13 @@ tick_ctx_apply(struct panthor_scheduler *sched, struct 
panthor_sched_tick_ctx *c
 
                        csg_iface = panthor_fw_get_csg_iface(ptdev, csg_id);
                        csg_slot = &sched->csg_slots[csg_id];
-                       group_bind_locked(group, csg_id);
+                       ret = group_bind_locked(group, csg_id);
+                       if (ret) {
+                               panthor_device_schedule_reset(ptdev);
+                               ctx->csg_upd_failed_mask |= BIT(csg_id);
+                               return;
+                       }
+
                        csg_slot_prog_locked(ptdev, csg_id, new_csg_prio--);
                        csgs_upd_ctx_queue_reqs(ptdev, &upd_ctx, csg_id,
                                                group->state == 
PANTHOR_CS_GROUP_SUSPENDED ?

-- 
2.54.0

Reply via email to