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

drm/xe: Add a helper function to set recovery method

Add a helper function to set recovery method. The recovery
method can be set before declaring the device wedged and sending the
drm wedged uevent. If no method is set, default unbind/re-bind method
will be set.

v2: fix documentation (Raag)

Signed-off-by: Riana Tauro <riana.tauro@intel.com>
Reviewed-by: Raag Jadav <raag.jadav@intel.com>
Link: https://lore.kernel.org/r/20250826063419.3022216-5-riana.tauro@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

authored by

Riana Tauro and committed by
Rodrigo Vivi
60439ac3 90fdcf5f

+24 -5
+21 -5
drivers/gpu/drm/xe/xe_device.c
··· 1177 1177 */ 1178 1178 1179 1179 /** 1180 + * xe_device_set_wedged_method - Set wedged recovery method 1181 + * @xe: xe device instance 1182 + * @method: recovery method to set 1183 + * 1184 + * Set wedged recovery method to be sent in drm wedged uevent. 1185 + */ 1186 + void xe_device_set_wedged_method(struct xe_device *xe, unsigned long method) 1187 + { 1188 + xe->wedged.method = method; 1189 + } 1190 + 1191 + /** 1180 1192 * xe_device_declare_wedged - Declare device wedged 1181 1193 * @xe: xe device instance 1182 1194 * 1183 1195 * This is a final state that can only be cleared with the recovery method 1184 - * specified in the drm wedged uevent. The default recovery method is 1185 - * re-probe (unbind + bind). 1196 + * specified in the drm wedged uevent. The method can be set using 1197 + * xe_device_set_wedged_method before declaring the device as wedged. If no method 1198 + * is set, reprobe (unbind/re-bind) will be sent by default. 1186 1199 * 1187 1200 * In this state every IOCTL will be blocked so the GT cannot be used. 1188 1201 * In general it will be called upon any critical error such as gt reset ··· 1236 1223 xe_gt_declare_wedged(gt); 1237 1224 1238 1225 if (xe_device_wedged(xe)) { 1226 + /* If no wedge recovery method is set, use default */ 1227 + if (!xe->wedged.method) 1228 + xe_device_set_wedged_method(xe, DRM_WEDGE_RECOVERY_REBIND | 1229 + DRM_WEDGE_RECOVERY_BUS_RESET); 1230 + 1239 1231 /* Notify userspace of wedged device */ 1240 - drm_dev_wedged_event(&xe->drm, 1241 - DRM_WEDGE_RECOVERY_REBIND | DRM_WEDGE_RECOVERY_BUS_RESET, 1242 - NULL); 1232 + drm_dev_wedged_event(&xe->drm, xe->wedged.method, NULL); 1243 1233 } 1244 1234 }
+1
drivers/gpu/drm/xe/xe_device.h
··· 187 187 return atomic_read(&xe->wedged.flag); 188 188 } 189 189 190 + void xe_device_set_wedged_method(struct xe_device *xe, unsigned long method); 190 191 void xe_device_declare_wedged(struct xe_device *xe); 191 192 192 193 struct xe_file *xe_file_get(struct xe_file *xef);
+2
drivers/gpu/drm/xe/xe_device_types.h
··· 541 541 atomic_t flag; 542 542 /** @wedged.mode: Mode controlled by kernel parameter and debugfs */ 543 543 int mode; 544 + /** @wedged.method: Recovery method to be sent in the drm device wedged uevent */ 545 + unsigned long method; 544 546 } wedged; 545 547 546 548 /** @bo_device: Struct to control async free of BOs */