]> Gentwo Git Trees - linux/.git/commitdiff
drm/panthor: Reset queue slots if termination fails
authorAshley Smith <ashley.smith@collabora.com>
Thu, 13 Nov 2025 10:57:34 +0000 (11:57 +0100)
committerBoris Brezillon <boris.brezillon@collabora.com>
Wed, 26 Nov 2025 11:51:37 +0000 (12:51 +0100)
Make sure the queue slot is reset even if we failed termination so
we don't have garbage in the CS input interface after a reset. In
practice that's not a problem because we zero out all RW sections when
a hangs occurs, but it's safer to reset things manually, in case we
decide to not conditionally reload RW sections based on the type of
hang.

v4:
- Split the changes in two separate patches

v5:
- No changes

v6:
- Adjust the explanation in the commit message
- Drop the Fixes tag
- Put after the timeout changes and make the two patches independent
  so one can be backported, and the other not

v7:
- Use the local group variable instead of dereferencing csg_slot->group
- Add Steve's R-b

v8:
- No changes

Signed-off-by: Ashley Smith <ashley.smith@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Link: https://patch.msgid.link/20251113105734.1520338-3-boris.brezillon@collabora.com
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
drivers/gpu/drm/panthor/panthor_sched.c

index 6fb3208efc05507b478c4459c734d3b7ea7f5905..b834123a6560e981d1d504df608b0cf5e3213db0 100644 (file)
@@ -2841,13 +2841,23 @@ void panthor_sched_suspend(struct panthor_device *ptdev)
                while (slot_mask) {
                        u32 csg_id = ffs(slot_mask) - 1;
                        struct panthor_csg_slot *csg_slot = &sched->csg_slots[csg_id];
+                       struct panthor_group *group = csg_slot->group;
 
                        /* Terminate command timedout, but the soft-reset will
                         * automatically terminate all active groups, so let's
                         * force the state to halted here.
                         */
-                       if (csg_slot->group->state != PANTHOR_CS_GROUP_TERMINATED)
-                               csg_slot->group->state = PANTHOR_CS_GROUP_TERMINATED;
+                       if (group->state != PANTHOR_CS_GROUP_TERMINATED) {
+                               group->state = PANTHOR_CS_GROUP_TERMINATED;
+
+                               /* Reset the queue slots manually if the termination
+                                * request failed.
+                                */
+                               for (i = 0; i < group->queue_count; i++) {
+                                       if (group->queues[i])
+                                               cs_slot_reset_locked(ptdev, csg_id, i);
+                               }
+                       }
                        slot_mask &= ~BIT(csg_id);
                }
        }