drm/xe/drm_ras: Wire up error threshold callbacks

Now that we have get/set error threshold support in xe driver, wire them
up to drm_ras so that userspace can make use of the functionality.

$ 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': 16}

$ 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 <raag.jadav@intel.com>
Reviewed-by: Riana Tauro <riana.tauro@intel.com>
Link: https://patch.msgid.link/20260818135304.497098-5-raag.jadav@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
Raag Jadav 2026-08-18 19:22:08 +05:30 committed by Rodrigo Vivi
parent 5a2b1a5fb4
commit 1b2a3db004
No known key found for this signature in database
GPG Key ID: FA625F640EEB13CA

View File

@ -86,6 +86,38 @@ static int clear_correctable_error_counter(struct drm_ras_node *node, u32 error_
return clear_error_counter(xe, DRM_XE_RAS_ERR_SEV_CORRECTABLE, error_id);
}
static int query_correctable_error_threshold(struct drm_ras_node *ep, u32 error_id,
const char **name, u32 *threshold)
{
struct xe_device *xe = ep->priv;
struct xe_drm_ras *ras = &xe->ras;
struct xe_drm_ras_counter *info = ras->info[DRM_XE_RAS_ERR_SEV_CORRECTABLE];
if (!info || !info[error_id].name)
return -ENOENT;
if (!xe->info.has_sysctrl)
return -EOPNOTSUPP;
*name = info[error_id].name;
return xe_ras_get_threshold(xe, DRM_XE_RAS_ERR_SEV_CORRECTABLE, error_id, threshold);
}
static int set_correctable_error_threshold(struct drm_ras_node *ep, u32 error_id, u32 threshold)
{
struct xe_device *xe = ep->priv;
struct xe_drm_ras *ras = &xe->ras;
struct xe_drm_ras_counter *info = ras->info[DRM_XE_RAS_ERR_SEV_CORRECTABLE];
if (!info || !info[error_id].name)
return -ENOENT;
if (!xe->info.has_sysctrl)
return -EOPNOTSUPP;
return xe_ras_set_threshold(xe, DRM_XE_RAS_ERR_SEV_CORRECTABLE, error_id, threshold);
}
static struct xe_drm_ras_counter *allocate_and_copy_counters(struct xe_device *xe)
{
struct xe_drm_ras_counter *counter;
@ -134,6 +166,8 @@ static int assign_node_params(struct xe_device *xe, struct drm_ras_node *node,
if (severity == DRM_XE_RAS_ERR_SEV_CORRECTABLE) {
node->query_error_counter = query_correctable_error_counter;
node->clear_error_counter = clear_correctable_error_counter;
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;
node->clear_error_counter = clear_uncorrectable_error_counter;