From: Ravi Kishore Koppuravuri <ravi.kishore.koppuravuri@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: riana.tauro@intel.com, anshuman.gupta@intel.com,
mallesh.koujalagi@intel.com, raag.jadav@intel.com,
soham.purkait@intel.com,
Ravi Kishore Koppuravuri <ravi.kishore.koppuravuri@intel.com>
Subject: [PATCH v2 4/8] lib/igt_drm_netlink: add set_error_threshold command support
Date: Thu, 20 Aug 2026 17:45:56 +0530 [thread overview]
Message-ID: <20260820121600.75052-5-ravi.kishore.koppuravuri@intel.com> (raw)
In-Reply-To: <20260820121600.75052-1-ravi.kishore.koppuravuri@intel.com>
Add support for SET_ERROR_THRESHOLD to set the custom error threshold
value
Signed-off-by: Ravi Kishore Koppuravuri <ravi.kishore.koppuravuri@intel.com>
---
v2:Marked this command as response not required
---
---
lib/igt_drm_netlink.c | 39 +++++++++++++++++++++++++++++++++++++++
lib/igt_drm_netlink.h | 1 +
2 files changed, 40 insertions(+)
diff --git a/lib/igt_drm_netlink.c b/lib/igt_drm_netlink.c
index c530076a6..c32e10f2f 100644
--- a/lib/igt_drm_netlink.c
+++ b/lib/igt_drm_netlink.c
@@ -29,6 +29,8 @@ static int ras_command_cb(struct nl_msg *msg, void *arg)
gnlh = nlmsg_data(nlh);
switch (gnlh->cmd) {
+ case DRM_RAS_CMD_SET_ERROR_THRESHOLD:
+ break;
case DRM_RAS_CMD_GET_ERROR_COUNTER: {
struct nlattr *attrs[DRM_RAS_A_ERROR_COUNTER_ATTRS_MAX + 1];
@@ -180,6 +182,7 @@ static int send_command(struct app_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);
@@ -195,6 +198,16 @@ static int send_command(struct app_context *ctx, uint8_t cmd)
nlmsg_free(msg);
return 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;
+ }
+ }
break;
default:
nlmsg_free(msg);
@@ -317,6 +330,14 @@ static int validate_inputs(struct app_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;
}
@@ -371,3 +392,21 @@ int get_error_threshold(struct app_context *ctx)
return 0;
}
+
+int set_error_threshold(struct app_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_netlink.h b/lib/igt_drm_netlink.h
index 08ef4eed0..045dae403 100644
--- a/lib/igt_drm_netlink.h
+++ b/lib/igt_drm_netlink.h
@@ -38,6 +38,7 @@ void cleanup_nl_socket(struct app_context *ctx);
int init_nl_socket(struct app_context *ctx);
int get_error_counter(struct app_context *ctx);
int get_error_threshold(struct app_context *ctx);
+int set_error_threshold(struct app_context *ctx);
#endif /* IGT_DRM_NETLINK_H */
--
2.34.1
next prev parent reply other threads:[~2026-08-20 12:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-20 12:15 [PATCH v2 0/8] Xe3P GPU Error Injection Test Suite with DRM RAS Netlink Support Ravi Kishore Koppuravuri
2026-08-20 12:15 ` [PATCH v2 1/8] lib/igt_drm_netlink: Introduce DRM RAS Generic Netlink interface Ravi Kishore Koppuravuri
2026-08-20 12:15 ` [PATCH v2 2/8] lib/igt_drm_netlink: add get_error_counter support Ravi Kishore Koppuravuri
2026-08-20 12:15 ` [PATCH v2 3/8] lib/igt_drm_netlink: add get_error_threshold command support Ravi Kishore Koppuravuri
2026-08-20 12:15 ` Ravi Kishore Koppuravuri [this message]
2026-08-20 12:15 ` [PATCH v2 5/8] tests/intel/xe_err_injection: Add GT UC Unicast GAM Walker Command Parity Error Injection Ravi Kishore Koppuravuri
2026-08-20 12:15 ` [PATCH v2 6/8] lib/igt_drm_netlink: add event notify subscription and event wait support Ravi Kishore Koppuravuri
2026-08-20 12:15 ` [PATCH v2 7/8] tests/intel/xe_err_injection: Add tests for L2 bank Corr err threshold scenarios Ravi Kishore Koppuravuri
2026-08-20 12:16 ` [PATCH v2 8/8] tests/intel/xe_err_injection: add CRI GPU requirement check Ravi Kishore Koppuravuri
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260820121600.75052-5-ravi.kishore.koppuravuri@intel.com \
--to=ravi.kishore.koppuravuri@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=mallesh.koujalagi@intel.com \
--cc=raag.jadav@intel.com \
--cc=riana.tauro@intel.com \
--cc=soham.purkait@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox