Hi Ravi, On 14-10-2026 00:36, Ravi Kishore Koppuravuri wrote: > Add support for SET_ERROR_THRESHOLD to set the custom error threshold > value > > Cc: Soham Purkait > Cc: Riana Tauro > Cc: Anshuman Gupta > Cc: Raag Jadav > Cc: Badal Nilawar > Cc: Mallesh Koujalagi > Cc: Harish Chegondi > Signed-off-by: Ravi Kishore Koppuravuri > --- > v4:Renamed the library functions with prefix "igt_drm_netlink_*" (Nikula > Jani & Kamil) > v2:Marked this command as response not required > --- > lib/igt_drm_ras_nl.c | 39 +++++++++++++++++++++++++++++++++++++++ > lib/igt_drm_ras_nl.h | 1 + > 2 files changed, 40 insertions(+) > > diff --git a/lib/igt_drm_ras_nl.c b/lib/igt_drm_ras_nl.c > index f8f289329..94fcc40ac 100644 > --- a/lib/igt_drm_ras_nl.c > +++ b/lib/igt_drm_ras_nl.c > @@ -68,6 +68,8 @@ static int ras_command_cb(struct nl_msg *msg, void *arg) > return NL_SKIP; > > switch (gnlh->cmd) { > + case DRM_RAS_CMD_SET_ERROR_THRESHOLD: > + break; > case DRM_RAS_CMD_GET_ERROR_COUNTER: { > if (!attrs[DRM_RAS_A_ERROR_COUNTER_ATTRS_ERROR_VALUE]) > return NL_SKIP; > @@ -237,6 +239,7 @@ static int send_command(struct igt_drm_ras_nl_context *ctx, uint8_t cmd) > case DRM_RAS_CMD_GET_ERROR_THRESHOLD: > case DRM_RAS_CMD_GET_ERROR_COUNTER: > ctx->response_required = true; > + case DRM_RAS_CMD_SET_ERROR_THRESHOLD: > ret = nla_put_u32(msg, > DRM_RAS_A_ERROR_COUNTER_ATTRS_NODE_ID, > ctx->node_id); > @@ -252,6 +255,16 @@ static int send_command(struct igt_drm_ras_nl_context *ctx, uint8_t cmd) > nlmsg_free(msg); > return normalize_nl_error(ret); > } > + > + if (cmd == DRM_RAS_CMD_SET_ERROR_THRESHOLD) { > + ret = nla_put_u32(msg, > + DRM_RAS_A_ERROR_COUNTER_ATTRS_ERROR_THRESHOLD, > + ctx->error_threshold); > + if (ret < 0) { > + nlmsg_free(msg); > + return ret; return normalize_nl_error(ret) Regards, Soham > + } > + } > break; > default: > nlmsg_free(msg); > @@ -347,6 +360,14 @@ static int validate_inputs(struct igt_drm_ras_nl_context *ctx, uint8_t cmd) > return -EINVAL; > } > > + if (cmd == DRM_RAS_CMD_SET_ERROR_THRESHOLD && > + (ctx->error_threshold < 1 || ctx->error_threshold > 16)) { > + igt_warn("Invalid error_threshold (%u) provided. " > + "error_threshold should be >= 1 and <= 16.\n", > + ctx->error_threshold); > + return -EINVAL; > + } > + > return 0; > } > > @@ -401,3 +422,21 @@ int igt_drm_ras_nl_get_error_threshold(struct igt_drm_ras_nl_context *ctx) > > return 0; > } > + > +int igt_drm_ras_nl_set_error_threshold(struct igt_drm_ras_nl_context *ctx) > +{ > + int ret; > + > + ret = validate_inputs(ctx, DRM_RAS_CMD_SET_ERROR_THRESHOLD); > + if (ret < 0) > + return ret; > + > + ret = send_command(ctx, DRM_RAS_CMD_SET_ERROR_THRESHOLD); > + if (ret < 0) > + return ret; > + > + igt_debug("Set error threshold: node_id=%u error_id=%u threshold=%u\n", > + ctx->node_id, ctx->error_id, ctx->error_threshold); > + > + return 0; > +} > diff --git a/lib/igt_drm_ras_nl.h b/lib/igt_drm_ras_nl.h > index 86cfd79d0..5c9be5b17 100644 > --- a/lib/igt_drm_ras_nl.h > +++ b/lib/igt_drm_ras_nl.h > @@ -53,6 +53,7 @@ void igt_drm_ras_nl_cleanup(struct igt_drm_ras_nl_context *ctx); > int igt_drm_ras_nl_init(struct igt_drm_ras_nl_context *ctx); > int igt_drm_ras_nl_get_error_counter(struct igt_drm_ras_nl_context *ctx); > int igt_drm_ras_nl_get_error_threshold(struct igt_drm_ras_nl_context *ctx); > +int igt_drm_ras_nl_set_error_threshold(struct igt_drm_ras_nl_context *ctx); > > #endif /* IGT_DRM_RAS_NL_H */ >