Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+16 -12
+1 -6
drivers/gpu/drm/panthor/panthor_device.c
··· 129 129 panthor_gpu_l2_power_on(ptdev); 130 130 panthor_mmu_post_reset(ptdev); 131 131 ret = panthor_fw_post_reset(ptdev); 132 - if (ret) 133 - goto out_dev_exit; 134 - 135 132 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); 139 134 drm_dev_exit(cookie); 140 135 141 136 if (ret) {
+14 -5
drivers/gpu/drm/panthor/panthor_sched.c
··· 2733 2733 mutex_unlock(&sched->reset.lock); 2734 2734 } 2735 2735 2736 - void panthor_sched_post_reset(struct panthor_device *ptdev) 2736 + void panthor_sched_post_reset(struct panthor_device *ptdev, bool reset_failed) 2737 2737 { 2738 2738 struct panthor_scheduler *sched = ptdev->scheduler; 2739 2739 struct panthor_group *group, *group_tmp; 2740 2740 2741 2741 mutex_lock(&sched->reset.lock); 2742 2742 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 + 2744 2750 panthor_group_start(group); 2751 + } 2745 2752 2746 2753 /* We're done resetting the GPU, clear the reset.in_progress bit so we can 2747 2754 * kick the scheduler. ··· 2756 2749 atomic_set(&sched->reset.in_progress, false); 2757 2750 mutex_unlock(&sched->reset.lock); 2758 2751 2759 - sched_queue_delayed_work(sched, tick, 0); 2760 - 2761 - sched_queue_work(sched, sync_upd); 2752 + /* No need to queue a tick and update syncs if the reset failed. */ 2753 + if (!reset_failed) { 2754 + sched_queue_delayed_work(sched, tick, 0); 2755 + sched_queue_work(sched, sync_upd); 2756 + } 2762 2757 } 2763 2758 2764 2759 static void group_sync_upd_work(struct work_struct *work)
+1 -1
drivers/gpu/drm/panthor/panthor_sched.h
··· 40 40 int panthor_sched_init(struct panthor_device *ptdev); 41 41 void panthor_sched_unplug(struct panthor_device *ptdev); 42 42 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); 44 44 void panthor_sched_suspend(struct panthor_device *ptdev); 45 45 void panthor_sched_resume(struct panthor_device *ptdev); 46 46