On 23-11-2026 12:27 pm, Ravi Kishore Koppuravuri wrote:
Accessing the gpu_health sysfs attribute sends a command to the system
controller. Add a guard to skip the command when the device is wedged.

Do not skip when the wedge mode is XE_WEDGED_MODE_UPON_ANY_HANG_NO_RESET,
as this mode is intended for debugging hangs.
Signed-off-by: Ravi Kishore Koppuravuri <ravi.kishore.koppuravuri@intel.com>
---
V2:
  - Added support for not skipping when wedged in
    XE_WEDGED_MODE_UPON_ANY_HANG_NO_RESET mode (Riana)
  - Removed xe_device_is_in_reset() from the guard (Riana)
  - Removed log message from the guard (sashiko, Mallesh and Riana)
---
 drivers/gpu/drm/xe/xe_ras.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
index 0fb891d00b36..3c563ef67614 100644
--- a/drivers/gpu/drm/xe/xe_ras.c
+++ b/drivers/gpu/drm/xe/xe_ras.c
@@ -1134,6 +1134,9 @@ static ssize_t gpu_health_show(struct device *dev, struct device_attribute *attr
 	size_t rlen;
 	int ret;
 
+	if (xe_wedged(xe) && xe->wedged.mode != XE_WEDGED_MODE_UPON_ANY_HANG_NO_RESET)

Please use  !xe_wedge_mode_is_no_reset(xe) instead of xe->wedged.mode != XE_WEDGED_MODE_UPON_ANY_HANG_NO_RESET, has done in patch

https://lore.kernel.org/intel-xe/20261119102344.2053821-3-raag.jadav@intel.com/

+		return -ECANCELED;
+
 	xe_sysctrl_create_command(&command, XE_SYSCTRL_GROUP_GFSP, XE_SYSCTRL_CMD_GET_HEALTH,
 				  &request, sizeof(request), &response, sizeof(response));
 	guard(xe_pm_runtime)(xe);
@@ -1177,6 +1180,9 @@ static ssize_t gpu_health_store(struct device *dev, struct device_attribute *att
 	if (state < 0)
 		return -EINVAL;
 
+	if (xe_wedged(xe) && xe->wedged.mode != XE_WEDGED_MODE_UPON_ANY_HANG_NO_RESET)

ditto,

Thanks,

-/Mallesh

+		return -ECANCELED;
+
 	request.health = state;
 
 	xe_sysctrl_create_command(&command, XE_SYSCTRL_GROUP_GFSP, XE_SYSCTRL_CMD_SET_HEALTH,