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

Configure Feed

Select the types of activity you want to include in your feed.

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 <maciej.patelczyk@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Fixes: f3bc5bb4d53d ("drm/xe: Allow userspace to configure CCS mode")
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241211111727.1481476-2-maciej.patelczyk@intel.com
Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>

authored by

Maciej Patelczyk and committed by
Nirmoy Das
155c77f4 6a04bb5a

+30 -9
+3 -4
drivers/gpu/drm/xe/tests/xe_bo.c
··· 264 264 * however seems quite fragile not to also restart the GT. Try 265 265 * to do that here by triggering a GT reset. 266 266 */ 267 - for_each_gt(__gt, xe, id) { 268 - xe_gt_reset_async(__gt); 269 - flush_work(&__gt->reset.worker); 270 - } 267 + for_each_gt(__gt, xe, id) 268 + xe_gt_reset(__gt); 269 + 271 270 if (err) { 272 271 KUNIT_FAIL(test, "restore kernel err=%pe\n", 273 272 ERR_PTR(err));
+1 -2
drivers/gpu/drm/xe/tests/xe_mocs.c
··· 162 162 if (flags & HAS_LNCF_MOCS) 163 163 read_l3cc_table(gt, &mocs.table); 164 164 165 - xe_gt_reset_async(gt); 166 - flush_work(&gt->reset.worker); 165 + xe_gt_reset(gt); 167 166 168 167 kunit_info(test, "mocs_reset_test after reset\n"); 169 168 if (flags & HAS_GLOBAL_MOCS)
+25
drivers/gpu/drm/xe/xe_gt.h
··· 57 57 void xe_gt_remove(struct xe_gt *gt); 58 58 59 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 + 84 + /** 60 85 * xe_gt_any_hw_engine_by_reset_domain - scan the list of engines and return the 61 86 * first that matches the same reset domain as @class 62 87 * @gt: GT structure
+1 -3
drivers/gpu/drm/xe/xe_gt_debugfs.c
··· 132 132 static int force_reset_sync(struct xe_gt *gt, struct drm_printer *p) 133 133 { 134 134 xe_pm_runtime_get(gt_to_xe(gt)); 135 - xe_gt_reset_async(gt); 135 + xe_gt_reset(gt); 136 136 xe_pm_runtime_put(gt_to_xe(gt)); 137 - 138 - flush_work(&gt->reset.worker); 139 137 140 138 return 0; 141 139 }