Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 3ce4322

Browse files
committed
drm/panthor: Call panthor_sched_post_reset() even if the reset failed
We need to undo what was done in panthor_sched_pre_reset() even if the reset failed. We just flag all previously running groups as terminated when that happens to unblock things. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Steven Price <steven.price@arm.com> Reviewed-by: Liviu Dudau <liviu.dudau@arm.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240502183813.1612017-5-boris.brezillon@collabora.com
1 parent a257e81 commit 3ce4322

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

drivers/gpu/drm/panthor/panthor_device.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,8 @@ static void panthor_device_reset_work(struct work_struct *work)
129129
panthor_gpu_l2_power_on(ptdev);
130130
panthor_mmu_post_reset(ptdev);
131131
ret = panthor_fw_post_reset(ptdev);
132-
if (ret)
133-
goto out_dev_exit;
134-
135132
atomic_set(&ptdev->reset.pending, 0);
136-
panthor_sched_post_reset(ptdev);
137-
138-
out_dev_exit:
133+
panthor_sched_post_reset(ptdev, ret != 0);
139134
drm_dev_exit(cookie);
140135

141136
if (ret) {

drivers/gpu/drm/panthor/panthor_sched.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2733,25 +2733,34 @@ void panthor_sched_pre_reset(struct panthor_device *ptdev)
27332733
mutex_unlock(&sched->reset.lock);
27342734
}
27352735

2736-
void panthor_sched_post_reset(struct panthor_device *ptdev)
2736+
void panthor_sched_post_reset(struct panthor_device *ptdev, bool reset_failed)
27372737
{
27382738
struct panthor_scheduler *sched = ptdev->scheduler;
27392739
struct panthor_group *group, *group_tmp;
27402740

27412741
mutex_lock(&sched->reset.lock);
27422742

2743-
list_for_each_entry_safe(group, group_tmp, &sched->reset.stopped_groups, run_node)
2743+
list_for_each_entry_safe(group, group_tmp, &sched->reset.stopped_groups, run_node) {
2744+
/* Consider all previously running group as terminated if the
2745+
* reset failed.
2746+
*/
2747+
if (reset_failed)
2748+
group->state = PANTHOR_CS_GROUP_TERMINATED;
2749+
27442750
panthor_group_start(group);
2751+
}
27452752

27462753
/* We're done resetting the GPU, clear the reset.in_progress bit so we can
27472754
* kick the scheduler.
27482755
*/
27492756
atomic_set(&sched->reset.in_progress, false);
27502757
mutex_unlock(&sched->reset.lock);
27512758

2752-
sched_queue_delayed_work(sched, tick, 0);
2753-
2754-
sched_queue_work(sched, sync_upd);
2759+
/* No need to queue a tick and update syncs if the reset failed. */
2760+
if (!reset_failed) {
2761+
sched_queue_delayed_work(sched, tick, 0);
2762+
sched_queue_work(sched, sync_upd);
2763+
}
27552764
}
27562765

27572766
static void group_sync_upd_work(struct work_struct *work)

drivers/gpu/drm/panthor/panthor_sched.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void panthor_group_pool_destroy(struct panthor_file *pfile);
4040
int panthor_sched_init(struct panthor_device *ptdev);
4141
void panthor_sched_unplug(struct panthor_device *ptdev);
4242
void panthor_sched_pre_reset(struct panthor_device *ptdev);
43-
void panthor_sched_post_reset(struct panthor_device *ptdev);
43+
void panthor_sched_post_reset(struct panthor_device *ptdev, bool reset_failed);
4444
void panthor_sched_suspend(struct panthor_device *ptdev);
4545
void panthor_sched_resume(struct panthor_device *ptdev);
4646

0 commit comments

Comments
 (0)