Skip to content

Commit 5db8916

Browse files
mpatelczThomas Hellström
authored andcommitted
drm/xe: introduce xe_gt_reset and xe_gt_wait_for_reset
Add synchronous version gt reset as there are few places where it is expected. Also add a wait helper to wait until gt reset is done. Signed-off-by: Maciej Patelczyk <[email protected]> Reviewed-by: Lucas De Marchi <[email protected]> Fixes: f3bc5bb ("drm/xe: Allow userspace to configure CCS mode") Reviewed-by: Nirmoy Das <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Nirmoy Das <[email protected]> (cherry picked from commit 155c77f) Signed-off-by: Thomas Hellström <[email protected]>
1 parent 64192bb commit 5db8916

File tree

4 files changed

+30
-9
lines changed

4 files changed

+30
-9
lines changed

drivers/gpu/drm/xe/tests/xe_bo.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,9 @@ static int evict_test_run_tile(struct xe_device *xe, struct xe_tile *tile, struc
257257
* however seems quite fragile not to also restart the GT. Try
258258
* to do that here by triggering a GT reset.
259259
*/
260-
for_each_gt(__gt, xe, id) {
261-
xe_gt_reset_async(__gt);
262-
flush_work(&__gt->reset.worker);
263-
}
260+
for_each_gt(__gt, xe, id)
261+
xe_gt_reset(__gt);
262+
264263
if (err) {
265264
KUNIT_FAIL(test, "restore kernel err=%pe\n",
266265
ERR_PTR(err));

drivers/gpu/drm/xe/tests/xe_mocs.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ static int mocs_reset_test_run_device(struct xe_device *xe)
162162
if (flags & HAS_LNCF_MOCS)
163163
read_l3cc_table(gt, &mocs.table);
164164

165-
xe_gt_reset_async(gt);
166-
flush_work(&gt->reset.worker);
165+
xe_gt_reset(gt);
167166

168167
kunit_info(test, "mocs_reset_test after reset\n");
169168
if (flags & HAS_GLOBAL_MOCS)

drivers/gpu/drm/xe/xe_gt.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,31 @@ void xe_gt_sanitize(struct xe_gt *gt);
5656
int xe_gt_sanitize_freq(struct xe_gt *gt);
5757
void xe_gt_remove(struct xe_gt *gt);
5858

59+
/**
60+
* xe_gt_wait_for_reset - wait for gt's async reset to finalize.
61+
* @gt: GT structure
62+
* Return:
63+
* %true if it waited for the work to finish execution,
64+
* %false if there was no scheduled reset or it was done.
65+
*/
66+
static inline bool xe_gt_wait_for_reset(struct xe_gt *gt)
67+
{
68+
return flush_work(&gt->reset.worker);
69+
}
70+
71+
/**
72+
* xe_gt_reset - perform synchronous reset
73+
* @gt: GT structure
74+
* Return:
75+
* %true if it waited for the reset to finish,
76+
* %false if there was no scheduled reset.
77+
*/
78+
static inline bool xe_gt_reset(struct xe_gt *gt)
79+
{
80+
xe_gt_reset_async(gt);
81+
return xe_gt_wait_for_reset(gt);
82+
}
83+
5984
/**
6085
* xe_gt_any_hw_engine_by_reset_domain - scan the list of engines and return the
6186
* first that matches the same reset domain as @class

drivers/gpu/drm/xe/xe_gt_debugfs.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,9 @@ static int force_reset(struct xe_gt *gt, struct drm_printer *p)
132132
static int force_reset_sync(struct xe_gt *gt, struct drm_printer *p)
133133
{
134134
xe_pm_runtime_get(gt_to_xe(gt));
135-
xe_gt_reset_async(gt);
135+
xe_gt_reset(gt);
136136
xe_pm_runtime_put(gt_to_xe(gt));
137137

138-
flush_work(&gt->reset.worker);
139-
140138
return 0;
141139
}
142140

0 commit comments

Comments
 (0)