Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Purkait, Soham" <soham.purkait@intel.com>
To: Ravi Kishore Koppuravuri <ravi.kishore.koppuravuri@intel.com>,
	<igt-dev@lists.freedesktop.org>
Cc: Riana Tauro <riana.tauro@intel.com>,
	Gupta Anshuman <anshuman.gupta@intel.com>,
	Jadav Raag <raag.jadav@intel.com>,
	Nilawar Badal <badal.nilawar@intel.com>,
	Koujalagi Mallesh <mallesh.koujalagi@intel.com>,
	Harish Chegondi <harish.chegondi@intel.com>
Subject: Re: [PATCH v4 03/10] lib/igt_drm_netlink: Introduce DRM RAS Netlink interface library
Date: Thu, 10 Sep 2026 11:47:42 +0530	[thread overview]
Message-ID: <4e07ff06-6b3f-4d41-ae82-1a1458ceca1a@intel.com> (raw)
In-Reply-To: <20260903073335.339540-4-ravi.kishore.koppuravuri@intel.com>

Hi Ravi,

On 03-09-2026 13:03, Ravi Kishore Koppuravuri wrote:
> Introduce an IGT library for communicating with DRM RAS Generic Netlink
> interface. Add helpers for Generic Netlink socket initialization and
> cleanup.
>
> Cc: Purkait Soham <soham.purkait@intel.com>
> Cc: Riana Tauro <riana.tauro@intel.com>
> Cc: Gupta Anshuman <anshuman.gupta@intel.com>
> Cc: Jadav Raag <raag.jadav@intel.com>
> Cc: Nilawar Badal <badal.nilawar@intel.com>
> Cc: Koujalagi Mallesh <mallesh.koujalagi@intel.com>
> Cc: Harish Chegondi <harish.chegondi@intel.com>
> Signed-off-by: Ravi Kishore Koppuravuri <ravi.kishore.koppuravuri@intel.com>
> ---
> v4:Renamed library function names prefixed with igt_drm_netlink_*
>     (Nikula Jani and Kamil)
>     Moved the headers to other commits which are not necessary in this
>     commit (Nikula Jani)
> ---
>   lib/igt_drm_netlink.c | 54 +++++++++++++++++++++++++++++++++++++++++++
>   lib/igt_drm_netlink.h | 20 ++++++++++++++++
>   lib/meson.build       |  1 +
>   3 files changed, 75 insertions(+)
>   create mode 100644 lib/igt_drm_netlink.c
>   create mode 100644 lib/igt_drm_netlink.h
>
> diff --git a/lib/igt_drm_netlink.c b/lib/igt_drm_netlink.c
> new file mode 100644
> index 000000000..709c01987
> --- /dev/null
> +++ b/lib/igt_drm_netlink.c
> @@ -0,0 +1,54 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright © 2026 Intel Corporation
> + */
> +
> +#include <stdint.h>
> +
> +#include <netlink/genl/ctrl.h>
> +#include <netlink/genl/genl.h>
> +
> +#include "igt_core.h"
> +#include "igt_drm_netlink.h"
> +
> +void igt_drm_netlink_cleanup(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 igt_drm_netlink_init(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) {
> +		igt_drm_netlink_cleanup(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));
> +		igt_drm_netlink_cleanup(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..0e563e55f
> --- /dev/null
> +++ b/lib/igt_drm_netlink.h
> @@ -0,0 +1,20 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2026 Intel Corporation
> + */
> +
> +#ifndef IGT_DRM_NETLINK_H
> +#define IGT_DRM_NETLINK_H
> +
> +#include <drm-uapi/drm_ras.h>
> +
> +struct app_context {

app_context is too generic for a non-local type in a public header. 
Please prefix it with "igt_drm_netlink_". e.g. struct 
igt_drm_netlink_context.

Thanks,
Soham
> +	struct nl_sock *sock;
> +	int family_id;
> +};
> +
> +void igt_drm_netlink_cleanup(struct app_context *ctx);
> +int igt_drm_netlink_init(struct app_context *ctx);
> +
> +#endif /* IGT_DRM_NETLINK_H */
> +
> diff --git a/lib/meson.build b/lib/meson.build
> index 7248bbc2d..70da9a4a0 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',

  reply	other threads:[~2026-09-10  6:18 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03  7:33 [PATCH v4 00/10] Xe3P GPU Error Injection Test Suite with DRM RAS Netlink Support Ravi Kishore Koppuravuri
2026-09-03  7:33 ` [PATCH v4 01/10] drm-uapi/drm_ras: Sync with kernel b2207d4c4e84 Ravi Kishore Koppuravuri
2026-09-10 11:12   ` Raag Jadav
2026-09-11  4:19     ` Koppuravuri, Ravi Kishore
2026-09-03  7:33 ` [PATCH v4 02/10] lib/meson: Add libnl dependencies for DRM RAS support Ravi Kishore Koppuravuri
2026-09-10  8:45   ` Purkait, Soham
2026-09-03  7:33 ` [PATCH v4 03/10] lib/igt_drm_netlink: Introduce DRM RAS Netlink interface library Ravi Kishore Koppuravuri
2026-09-10  6:17   ` Purkait, Soham [this message]
2026-09-03  7:33 ` [PATCH v4 04/10] lib/igt_drm_netlink: add get_error_counter support Ravi Kishore Koppuravuri
2026-09-10 12:05   ` Purkait, Soham
2026-09-03  7:33 ` [PATCH v4 05/10] lib/igt_drm_netlink: add get_error_threshold command support Ravi Kishore Koppuravuri
2026-09-03  7:33 ` [PATCH v4 06/10] lib/igt_drm_netlink: add set_error_threshold " Ravi Kishore Koppuravuri
2026-09-11 11:48   ` Purkait, Soham
2026-09-03  7:33 ` [PATCH v4 07/10] tests/intel/xe_err_injection: Add GT UC Unicast GAM Walker Command Parity Error Injection Ravi Kishore Koppuravuri
2026-09-03 16:45   ` Purkait, Soham
2026-09-11 15:03   ` Kamil Konieczny
2026-09-03  7:33 ` [PATCH v4 08/10] lib/igt_drm_netlink: add event notify subscription and event wait support Ravi Kishore Koppuravuri
2026-09-03  7:33 ` [PATCH v4 09/10] tests/intel/xe_err_injection: Add tests for L2 bank Corr err threshold scenarios Ravi Kishore Koppuravuri
2026-09-11  8:14   ` Purkait, Soham
2026-09-03  7:33 ` [PATCH v4 10/10] tests/intel/xe_err_injection: add CRI GPU requirement check Ravi Kishore Koppuravuri
2026-09-10  6:19   ` Purkait, Soham
2026-09-03 20:21 ` ✓ Xe.CI.BAT: success for Xe3P GPU Error Injection Test Suite with DRM RAS Netlink Support (rev7) Patchwork
2026-09-03 20:56 ` ✓ i915.CI.BAT: " Patchwork
2026-09-04  8:50 ` ✓ Xe.CI.FULL: " Patchwork
2026-09-04 10:51 ` ✗ i915.CI.Full: failure " Patchwork

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=4e07ff06-6b3f-4d41-ae82-1a1458ceca1a@intel.com \
    --to=soham.purkait@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=harish.chegondi@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=mallesh.koujalagi@intel.com \
    --cc=raag.jadav@intel.com \
    --cc=ravi.kishore.koppuravuri@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox