On 4/18/2026 2:46 AM, Raag Jadav wrote:
Now that we have get/set error threshold support in xe driver, wire them
up to drm_ras so that the user can make use of both functionalities.

so that userspace can make use of the functionality.

With that change

Reviewed-by: Riana Tauro <[email protected]>


$ sudo ynl --family drm_ras --do get-error-threshold --json \
   '{"node-id":0, "error-id":2}'
{'error-id': 2, 'error-name': 'soc-internal', 'error-threshold': 0}

$ sudo ynl --family drm_ras --do set-error-threshold --json \
   '{"node-id":0, "error-id":2, "error-threshold":8}'
None

Signed-off-by: Raag Jadav <[email protected]>
---
  drivers/gpu/drm/xe/xe_drm_ras.c | 29 +++++++++++++++++++++++++++--
  1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_drm_ras.c b/drivers/gpu/drm/xe/xe_drm_ras.c
index e07dc23a155e..824dabd5c29e 100644
--- a/drivers/gpu/drm/xe/xe_drm_ras.c
+++ b/drivers/gpu/drm/xe/xe_drm_ras.c
@@ -11,6 +11,7 @@
#include "xe_device_types.h"
  #include "xe_drm_ras.h"
+#include "xe_ras.h"
static const char * const error_components[] = DRM_XE_RAS_ERROR_COMPONENT_NAMES;
  static const char * const error_severity[] = DRM_XE_RAS_ERROR_SEVERITY_NAMES;
@@ -47,6 +48,27 @@ static int query_correctable_error_counter(struct 
drm_ras_node *ep, u32 error_id
        return hw_query_error_counter(info, error_id, name, val);
  }
+static int query_correctable_error_threshold(struct drm_ras_node *ep, u32 error_id,
+                                            const char **name, u32 *val)
+{
+       struct xe_device *xe = ep->priv;
+
+       if (!xe->info.has_sysctrl)
+               return -EOPNOTSUPP;
+
+       return xe_ras_get_threshold(xe, DRM_XE_RAS_ERR_SEV_CORRECTABLE, 
error_id, val);
+}
+
+static int set_correctable_error_threshold(struct drm_ras_node *ep, u32 
error_id, u32 val)
+{
+       struct xe_device *xe = ep->priv;
+
+       if (!xe->info.has_sysctrl)
+               return -EOPNOTSUPP;
+
+       return xe_ras_set_threshold(xe, DRM_XE_RAS_ERR_SEV_CORRECTABLE, 
error_id, val);
+}
+
  static struct xe_drm_ras_counter *allocate_and_copy_counters(struct xe_device 
*xe)
  {
        struct xe_drm_ras_counter *counter;
@@ -92,10 +114,13 @@ static int assign_node_params(struct xe_device *xe, struct 
drm_ras_node *node,
        if (IS_ERR(ras->info[severity]))
                return PTR_ERR(ras->info[severity]);
- if (severity == DRM_XE_RAS_ERR_SEV_CORRECTABLE)
+       if (severity == DRM_XE_RAS_ERR_SEV_CORRECTABLE) {
                node->query_error_counter = query_correctable_error_counter;
-       else
+               node->query_error_threshold = query_correctable_error_threshold;
+               node->set_error_threshold = set_correctable_error_threshold;
+       } else {
                node->query_error_counter = query_uncorrectable_error_counter;
+       }
return 0;
  }

Reply via email to