From: "Koppuravuri, Ravi Kishore" <ravi.kishore.koppuravuri@intel.com>
To: Harish Chegondi <harish.chegondi@intel.com>
Cc: <igt-dev@lists.freedesktop.org>, <riana.tauro@intel.com>,
<anshuman.gupta@intel.com>, <mallesh.koujalagi@intel.com>,
<raag.jadav@intel.com>
Subject: Re: [PATCH 1/8] lib/igt_drm_netlink: Introduce DRM RAS Generic Netlink interface
Date: Tue, 11 Aug 2026 13:32:14 +0530 [thread overview]
Message-ID: <ed148833-38ba-4b4a-afd4-9c5d4437d7bb@intel.com> (raw)
In-Reply-To: <anUcs2D7ud7oCSyi@intel.com>
On 07-08-2026 05:15, Harish Chegondi wrote:
> On Wed, Jul 29, 2026 at 05:49:52PM +0530, Ravi Kishore Koppuravuri wrote:
>> Introduce DRM RAS Generic Netlink interface as a library
>>
>> Signed-off-by: Ravi Kishore Koppuravuri <ravi.kishore.koppuravuri@intel.com>
>> ---
>> include/drm-uapi/drm_ras.h | 50 +++++++++++++++++++++++++++++++
>> lib/igt_drm_netlink.c | 60 ++++++++++++++++++++++++++++++++++++++
>> lib/igt_drm_netlink.h | 25 ++++++++++++++++
>> lib/meson.build | 9 ++++++
>> 4 files changed, 144 insertions(+)
>> create mode 100644 include/drm-uapi/drm_ras.h
>> create mode 100644 lib/igt_drm_netlink.c
>> create mode 100644 lib/igt_drm_netlink.h
>>
>> diff --git a/include/drm-uapi/drm_ras.h b/include/drm-uapi/drm_ras.h
>> new file mode 100644
>> index 000000000..218a3ee86
>> --- /dev/null
>> +++ b/include/drm-uapi/drm_ras.h
>> @@ -0,0 +1,50 @@
>> +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
>> +/* Do not edit directly, auto-generated from: */
>> +/* Documentation/netlink/specs/drm_ras.yaml */
>> +/* YNL-GEN uapi header */
>> +/* To regenerate run: tools/net/ynl/ynl-regen.sh */
>> +
>> +#ifndef _UAPI_LINUX_DRM_RAS_H
>> +#define _UAPI_LINUX_DRM_RAS_H
>> +
>> +#define DRM_RAS_FAMILY_NAME "drm-ras"
>> +#define DRM_RAS_FAMILY_VERSION 1
>> +
>> +/*
>> + * Type of the node. Currently, only error-counter nodes are supported, which
>> + * expose reliability counters for a hardware/software component.
>> + */
>> +enum drm_ras_node_type {
>> + DRM_RAS_NODE_TYPE_ERROR_COUNTER = 1,
>> +};
>> +
>> +enum {
>> + DRM_RAS_A_NODE_ATTRS_NODE_ID = 1,
>> + DRM_RAS_A_NODE_ATTRS_DEVICE_NAME,
>> + DRM_RAS_A_NODE_ATTRS_NODE_NAME,
>> + DRM_RAS_A_NODE_ATTRS_NODE_TYPE,
>> +
>> + __DRM_RAS_A_NODE_ATTRS_MAX,
>> + DRM_RAS_A_NODE_ATTRS_MAX = (__DRM_RAS_A_NODE_ATTRS_MAX - 1)
>> +};
> The above enums doesn't seem to be used anywhere in this patch series?
This file is the UAPI header file directly taken from the Kernel (as it
is, not modified anything here). In my opinion, better not to alter
anything in this header
>> +
>> +enum {
>> + DRM_RAS_A_ERROR_COUNTER_ATTRS_NODE_ID = 1,
>> + DRM_RAS_A_ERROR_COUNTER_ATTRS_ERROR_ID,
>> + DRM_RAS_A_ERROR_COUNTER_ATTRS_ERROR_NAME,
>> + DRM_RAS_A_ERROR_COUNTER_ATTRS_ERROR_VALUE,
>> +
>> + __DRM_RAS_A_ERROR_COUNTER_ATTRS_MAX,
>> + DRM_RAS_A_ERROR_COUNTER_ATTRS_MAX = (__DRM_RAS_A_ERROR_COUNTER_ATTRS_MAX - 1)
>> +};
> Is this header file auto generated? I wonder why the above enums have an
> "A" after RAS but not the below enums? I think it would be a good idea
> to have consistency in enum names.
This file is the UAPI header file directly taken from the Kernel (as it
is, not modified anything here). In my opinion, better not to alter
anything in this header
>> +
>> +enum {
>> + DRM_RAS_CMD_LIST_NODES = 1,
>> + DRM_RAS_CMD_GET_ERROR_COUNTER,
>> + DRM_RAS_CMD_CLEAR_ERROR_COUNTER,
>> +
>> + __DRM_RAS_CMD_MAX,
>> + DRM_RAS_CMD_MAX = (__DRM_RAS_CMD_MAX - 1)
>> +};
>> +
>> +#endif /* _UAPI_LINUX_DRM_RAS_H */
>> diff --git a/lib/igt_drm_netlink.c b/lib/igt_drm_netlink.c
>> new file mode 100644
>> index 000000000..1c07bb2db
>> --- /dev/null
>> +++ b/lib/igt_drm_netlink.c
>> @@ -0,0 +1,60 @@
>> +// SPDX-License-Identifier: MIT
>> +/*
>> + * Copyright © 2026 Intel Corporation
>> + */
>> +
>> +#include <stdbool.h>
>> +#include <stdint.h>
>> +#include <stdio.h>
>> +#include <stdlib.h>
>> +#include <string.h>
>> +
>> +#include <netlink/errno.h>
>> +#include <netlink/genl/ctrl.h>
>> +#include <netlink/genl/genl.h>
>> +#include <netlink/netlink.h>
>> +
>> +#include "igt_core.h"
>> +#include "igt_drm_netlink.h"
>> +
>> +void cleanup_nl_socket(struct app_context *ctx)
>> +{
>> + if (!ctx || !ctx->sock)
>> + return;
>> +
>> + nl_close(ctx->sock);
>> + nl_socket_free(ctx->sock);
>> + ctx->sock = NULL;
>> + ctx->family_id = -1;
>> +
>> + igt_debug("Cleaned up netlink socket.\n");
>> +}
>> +
>> +int init_nl_socket(struct app_context *ctx)
>> +{
>> + ctx->sock = nl_socket_alloc();
>> + if (!ctx->sock)
>> + return -1;
>> +
>> + igt_debug("Socket allocation successful. Connecting to Generic Netlink...\n");
>> + if (genl_connect(ctx->sock) < 0) {
>> + cleanup_nl_socket(ctx);
>> + return -1;
>> + }
>> +
>> + igt_debug("Resolving Generic Netlink family '%s'...\n", DRM_RAS_FAMILY_NAME);
>> + ctx->family_id = genl_ctrl_resolve(ctx->sock, DRM_RAS_FAMILY_NAME);
>> + if (ctx->family_id < 0) {
>> + fprintf(stderr,
>> + "Failed to resolve Generic Netlink family '%s': %s. "
>> + "This may mean the running kernel does not expose DRM RAS support.\n",
>> + DRM_RAS_FAMILY_NAME,
>> + nl_geterror(ctx->family_id));
>> + cleanup_nl_socket(ctx);
>> + return -1;
>> + }
>> +
>> + igt_debug("Resolved Generic Netlink family '%s' with id %d.\n",
>> + DRM_RAS_FAMILY_NAME, ctx->family_id);
>> + return 0;
>> +}
>> diff --git a/lib/igt_drm_netlink.h b/lib/igt_drm_netlink.h
>> new file mode 100644
>> index 000000000..c20d5452b
>> --- /dev/null
>> +++ b/lib/igt_drm_netlink.h
>> @@ -0,0 +1,25 @@
>> +/* SPDX-License-Identifier: MIT */
>> +/*
>> + * Copyright © 2026 Intel Corporation
>> + */
>> +
>> +#ifndef IGT_DRM_NETLINK_H
>> +#define IGT_DRM_NETLINK_H
>> +
>> +#include <stdbool.h>
>> +#include <stdint.h>
>> +
>> +#include <netlink/netlink.h>
>> +
>> +#include <drm-uapi/drm_ras.h>
>> +
>> +struct app_context {
>> + struct nl_sock *sock;
>> + int family_id;
>> +};
>> +
>> +void cleanup_nl_socket(struct app_context *ctx);
>> +int init_nl_socket(struct app_context *ctx);
>> +
>> +#endif /* IGT_DRM_NETLINK_H */
>> +
>> diff --git a/lib/meson.build b/lib/meson.build
>> index 4af346b43..79674e032 100644
>> --- a/lib/meson.build
>> +++ b/lib/meson.build
>> @@ -27,6 +27,7 @@ lib_sources = [
>> 'igt_device_scan.c',
>> 'igt_drm_clients.h',
>> 'igt_drm_fdinfo.c',
>> + 'igt_drm_netlink.c',
>> 'igt_fs.c',
>> 'igt_aux.c',
>> 'igt_dp.c',
>> @@ -141,6 +142,13 @@ lib_sources = [
>> 'vendor/uwildmat/uwildmat.c',
>> ]
>>
>> +libnl = declare_dependency(dependencies : [
>> + dependency('libnl-3.0', required : true),
>> + dependency('libnl-genl-3.0', required : true),
>> + dependency('libnl-cli-3.0', required : true),
>> + dependency('libnl-utils', required : false),
>> +])
>> +
>> lib_deps = [
>> cairo,
>> glib,
>> @@ -148,6 +156,7 @@ lib_deps = [
>> libdrm,
>> libdw,
>> libkmod,
>> + libnl,
>> libpci,
>> libudev,
>> math,
>> --
>> 2.34.1
>>
next prev parent reply other threads:[~2026-08-11 8:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 12:19 [PATCH 0/8] Xe3P GPU Error Injection Test Suite with DRM RAS Netlink Support Ravi Kishore Koppuravuri
2026-07-29 12:19 ` [PATCH 1/8] lib/igt_drm_netlink: Introduce DRM RAS Generic Netlink interface Ravi Kishore Koppuravuri
2026-08-06 23:45 ` Harish Chegondi
2026-08-11 8:02 ` Koppuravuri, Ravi Kishore [this message]
2026-07-29 12:19 ` [PATCH 2/8] lib/igt_drm_netlink: add get_error_counter support Ravi Kishore Koppuravuri
2026-07-29 12:19 ` [PATCH 3/8] lib/igt_drm_netlink: add get_error_threshold command support Ravi Kishore Koppuravuri
2026-08-07 23:14 ` Harish Chegondi
2026-07-29 12:19 ` [PATCH 4/8] lib/igt_drm_netlink: add set_error_threshold " Ravi Kishore Koppuravuri
2026-08-07 23:21 ` Harish Chegondi
2026-07-29 12:19 ` [PATCH 5/8] tests/intel/xe_err_injection: Add GT UC Unicast GAM Walker Command Parity Error Injection Ravi Kishore Koppuravuri
2026-08-10 22:28 ` Harish Chegondi
2026-07-29 12:19 ` [PATCH 6/8] lib/igt_drm_netlink: add event notify subscription and event wait support Ravi Kishore Koppuravuri
2026-07-29 12:19 ` [PATCH 7/8] tests/intel/xe_err_injection: Add tests for L2 bank Corr err threshold scenarios Ravi Kishore Koppuravuri
2026-07-29 12:19 ` [PATCH 8/8] tests/intel/xe_err_injection: add CRI GPU requirement check Ravi Kishore Koppuravuri
2026-08-07 0:06 ` Harish Chegondi
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=ed148833-38ba-4b4a-afd4-9c5d4437d7bb@intel.com \
--to=ravi.kishore.koppuravuri@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=harish.chegondi@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=mallesh.koujalagi@intel.com \
--cc=raag.jadav@intel.com \
--cc=riana.tauro@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.