diff --git a/drivers/gpu/drm/xe/xe_drm_ras.c b/drivers/gpu/drm/xe/xe_drm_ras.c index 78184b6ea7d4..7f3695707611 100644 --- a/drivers/gpu/drm/xe/xe_drm_ras.c +++ b/drivers/gpu/drm/xe/xe_drm_ras.c @@ -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;