All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeevan B <jeevan.b@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: jani.nikula@intel.com, pranay.samala@intel.com,
	karthik.b.s@intel.com, Jeevan B <jeevan.b@intel.com>
Subject: [PATCH i-g-t 1/8] lib/igt_params: Fall back to intel_display module parameters
Date: Wed, 18 Nov 2026 21:14:16 +0530	[thread overview]
Message-ID: <20261118154426.345883-2-jeevan.b@intel.com> (raw)
In-Reply-To: <20261118154426.345883-1-jeevan.b@intel.com>

With display split into a dedicated intel-display.ko, display module
parameters move from /sys/module/<driver>/parameters to
/sys/module/intel_display/parameters.

Add igt_display_params_open() to open the intel_display parameters
directory, and make igt_params_get()/igt_params_set() search the GPU
driver module first and then intel_display. Existing tests keep working
unchanged on kernels both with and without the dedicated display module.
igt_params_open() is unchanged.

Signed-off-by: Jeevan B <jeevan.b@intel.com>
---
 lib/igt_params.c | 48 +++++++++++++++++++++++++++++++++++++++++++++---
 lib/igt_params.h |  1 +
 2 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/lib/igt_params.c b/lib/igt_params.c
index 3dad317a5..c95c88b87 100644
--- a/lib/igt_params.c
+++ b/lib/igt_params.c
@@ -28,6 +28,7 @@
 #include <stdio.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
+#include <unistd.h>
 
 #include <i915_drm.h>
 
@@ -156,6 +157,45 @@ int igt_params_open(int device)
 	return params;
 }
 
+/**
+ * igt_display_params_open:
+ *
+ * Opens the module parameters directory of the dedicated intel_display
+ * module (/sys/module/intel_display/parameters). On kernels where display is
+ * still built into the GPU driver module this directory does not exist.
+ *
+ * Returns:
+ * The directory fd, or -1 on failure.
+ */
+int igt_display_params_open(void)
+{
+	return open("/sys/module/intel_display/parameters", O_RDONLY);
+}
+
+/*
+ * Open the params directory that holds @parameter: the GPU driver module
+ * first, then the intel_display module. This keeps tests working on kernels
+ * with and without a dedicated display module.
+ */
+static int params_open_for(int device, const char *parameter)
+{
+	int dir;
+
+	dir = igt_params_open(device);
+	if (dir >= 0 && faccessat(dir, parameter, F_OK, 0) == 0)
+		return dir;
+	if (dir >= 0)
+		close(dir);
+
+	dir = igt_display_params_open();
+	if (dir >= 0 && faccessat(dir, parameter, F_OK, 0) == 0)
+		return dir;
+	if (dir >= 0)
+		close(dir);
+
+	return -1;
+}
+
 /**
  * __igt_params_get:
  * @device: fd of the device
@@ -172,7 +212,7 @@ char *__igt_params_get(int device, const char *parameter)
 	char *str;
 	int dir;
 
-	dir = igt_params_open(device);
+	dir = params_open_for(device, parameter);
 	if (dir < 0)
 		return NULL;
 
@@ -189,7 +229,7 @@ static bool __igt_params_set(int device, const char *parameter,
 	int dir;
 	int ret;
 
-	dir = igt_params_open(device);
+	dir = params_open_for(device, parameter);
 	if (dir < 0)
 		return false;
 
@@ -230,7 +270,9 @@ bool igt_params_set(int device, const char *parameter, const char *fmt, ...)
  *
  * Save original value to be restored by exit handler. Parameter is first
  * searched at debugfs/dri/N/<device>_params and if not found will look for
- * parameter at /sys/module/<device>/parameters.
+ * parameter at /sys/module/<device>/parameters. If the parameter is not found
+ * there either, the dedicated intel_display module is searched at
+ * /sys/module/intel_display/parameters.
  *
  * Giving -1 here for default device will search for matching device from
  * debugfs/dri/N where N go from 0 to 63. First device found from debugfs
diff --git a/lib/igt_params.h b/lib/igt_params.h
index 6494786f0..f2ec44d1f 100644
--- a/lib/igt_params.h
+++ b/lib/igt_params.h
@@ -27,6 +27,7 @@
 #include <stdbool.h>
 
 int igt_params_open(int device);
+int igt_display_params_open(void);
 
 char *__igt_params_get(int device, const char *parameter);
 
-- 
2.43.0


  reply	other threads:[~2026-11-18 15:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 15:44 [PATCH i-g-t 0/8] RFC: Add intel_display module support to module load tests Jeevan B
2026-11-18 15:44 ` Jeevan B [this message]
2026-11-18 15:44 ` [PATCH i-g-t 2/8] tests/kms_panel_fitting: Find fastboot param with a dedicated display module Jeevan B
2026-11-19  9:13   ` Jani Nikula
2026-11-18 15:44 ` [PATCH i-g-t 3/8] tests/intel/i915_module_load: Check intel_display in load subtest Jeevan B
2026-11-18 15:44 ` [PATCH i-g-t 4/8] tests/intel/xe_module_load: Check intel_display in load subtests Jeevan B
2026-11-18 15:44 ` [PATCH i-g-t 5/8] lib/igt_kmod: Unload intel_display together with the GPU driver Jeevan B
2026-11-18 15:44 ` [PATCH i-g-t 6/8] tests/intel: Add intel_display_module_load test Jeevan B
2026-11-18 15:44 ` [PATCH i-g-t 7/8] tests/intel/xe_module_load: Verify driver unload result Jeevan B
2026-11-18 15:44 ` [PATCH i-g-t 8/8] tests/intel/i915_module_load: " Jeevan B
2026-11-19  3:40 ` ✓ Xe.CI.BAT: success for RFC: Add intel_display module support to module load tests Patchwork
2026-11-19 12:46 ` ✗ i915.CI.BAT: failure " Patchwork
2026-11-20  3:40 ` ✗ Xe.CI.FULL: " 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=20261118154426.345883-2-jeevan.b@intel.com \
    --to=jeevan.b@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=karthik.b.s@intel.com \
    --cc=pranay.samala@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.