Skip to content

Commit 1f8a87b

Browse files
author
Lucas De Marchi
committed
drm/xe: Inline gt_reset in the worker
gt_reset() doesn't make sense by itself: it can only be called as part of the worker. Inline it there to avoid it being called from elsewhere and clarify the gt_reset() vs do_gt_reset() paths. Note that the error return from gt_reset() was just being ignored. Also add a comment to the xe_pm_runtime_put() to make sure the get()/put() pair is clear. Reviewed-by: Matthew Brost <matthew.brost@intel.com> Link: https://patch.msgid.link/20251031222244.37735-2-lucas.demarchi@intel.com Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
1 parent 6b514ed commit 1f8a87b

1 file changed

Lines changed: 11 additions & 18 deletions

File tree

drivers/gpu/drm/xe/xe_gt.c

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -813,21 +813,18 @@ static int do_gt_restart(struct xe_gt *gt)
813813
return 0;
814814
}
815815

816-
static int gt_reset(struct xe_gt *gt)
816+
static void gt_reset_worker(struct work_struct *w)
817817
{
818+
struct xe_gt *gt = container_of(w, typeof(*gt), reset.worker);
818819
unsigned int fw_ref;
819820
int err;
820821

821-
if (xe_device_wedged(gt_to_xe(gt))) {
822-
err = -ECANCELED;
822+
if (xe_device_wedged(gt_to_xe(gt)))
823823
goto err_pm_put;
824-
}
825824

826825
/* We only support GT resets with GuC submission */
827-
if (!xe_device_uc_enabled(gt_to_xe(gt))) {
828-
err = -ENODEV;
826+
if (!xe_device_uc_enabled(gt_to_xe(gt)))
829827
goto err_pm_put;
830-
}
831828

832829
xe_gt_info(gt, "reset started\n");
833830

@@ -864,30 +861,24 @@ static int gt_reset(struct xe_gt *gt)
864861
goto err_out;
865862

866863
xe_force_wake_put(gt_to_fw(gt), fw_ref);
864+
865+
/* Pair with get while enqueueing the work in xe_gt_reset_async() */
867866
xe_pm_runtime_put(gt_to_xe(gt));
868867

869868
xe_gt_info(gt, "reset done\n");
870869

871-
return 0;
870+
return;
872871

873872
err_out:
874873
xe_force_wake_put(gt_to_fw(gt), fw_ref);
875874
XE_WARN_ON(xe_uc_start(&gt->uc));
875+
876876
err_fail:
877877
xe_gt_err(gt, "reset failed (%pe)\n", ERR_PTR(err));
878-
879878
xe_device_declare_wedged(gt_to_xe(gt));
879+
880880
err_pm_put:
881881
xe_pm_runtime_put(gt_to_xe(gt));
882-
883-
return err;
884-
}
885-
886-
static void gt_reset_worker(struct work_struct *w)
887-
{
888-
struct xe_gt *gt = container_of(w, typeof(*gt), reset.worker);
889-
890-
gt_reset(gt);
891882
}
892883

893884
void xe_gt_reset_async(struct xe_gt *gt)
@@ -899,6 +890,8 @@ void xe_gt_reset_async(struct xe_gt *gt)
899890
return;
900891

901892
xe_gt_info(gt, "reset queued\n");
893+
894+
/* Pair with put in gt_reset_worker() if work is enqueued */
902895
xe_pm_runtime_get_noresume(gt_to_xe(gt));
903896
if (!queue_work(gt->ordered_wq, &gt->reset.worker))
904897
xe_pm_runtime_put(gt_to_xe(gt));

0 commit comments

Comments
 (0)