public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] tests/core_hotunplug: Skip unplug when sysfs 'remove' is missing
@ 2026-02-03 10:46 Marcin Bernatowicz
  2026-02-03 15:08 ` ✓ Xe.CI.BAT: success for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Marcin Bernatowicz @ 2026-02-03 10:46 UTC (permalink / raw)
  To: igt-dev
  Cc: Marcin Bernatowicz, Jakub Kolakowski, Janusz Krzysztofik,
	Lukasz Laguna

Some PCI devices don't expose the sysfs remove attribute. The unplug/rescan
paths in core_hotunplug rely on writing 1 to remove, so attempting those
subtests would fail, skip the test early when remove is not present.

Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Cc: Jakub Kolakowski <jakub1.kolakowski@intel.com>
Cc: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Cc: Lukasz Laguna <lukasz.laguna@intel.com>
---
 tests/core_hotunplug.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c
index e23b5b89f..7c9dae1bf 100644
--- a/tests/core_hotunplug.c
+++ b/tests/core_hotunplug.c
@@ -245,6 +245,17 @@ static void device_unplug(struct hotunplug *priv, const char *prefix,
 {
 	igt_require(priv->fd.sysfs_dev == -1);
 
+	priv->fd.sysfs_dev = openat(priv->fd.sysfs_bus, priv->dev_bus_addr,
+				    O_DIRECTORY);
+	igt_assert_fd(priv->fd.sysfs_dev);
+
+	if (!igt_sysfs_has_attr(priv->fd.sysfs_dev, "remove")) {
+		priv->fd.sysfs_dev = close_sysfs(priv->fd.sysfs_dev);
+		igt_assert_eq(priv->fd.sysfs_dev, -1);
+		igt_skip("PCI %s has no sysfs 'remove' attribute, skipping test\n",
+			 priv->dev_bus_addr);
+	}
+
 	/*
 	 * FIXME: on some devices, the audio driver (snd_hda_intel)
 	 * binds into the i915 driver. On such hardware, kernel warnings
@@ -254,16 +265,14 @@ static void device_unplug(struct hotunplug *priv, const char *prefix,
 	 * unbind i915 driver, reloading it when binding again.
 	 */
 	if (igt_audio_driver_unload(&priv->snd_driver)) {
+		priv->fd.sysfs_dev = close_sysfs(priv->fd.sysfs_dev);
+		igt_assert_eq(priv->fd.sysfs_dev, -1);
 		igt_skip("Audio driver %s in use, skipping test\n",
 			 priv->snd_driver);
 	} else if (priv->snd_driver) {
 		igt_info("Unloaded audio driver %s\n", priv->snd_driver);
 	}
 
-	priv->fd.sysfs_dev = openat(priv->fd.sysfs_bus, priv->dev_bus_addr,
-				    O_DIRECTORY);
-	igt_assert_fd(priv->fd.sysfs_dev);
-
 	local_debug("%sunplugging the device\n", prefix);
 	priv->failure = "Device unplug failure!";
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-02-05 19:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-03 10:46 [PATCH i-g-t] tests/core_hotunplug: Skip unplug when sysfs 'remove' is missing Marcin Bernatowicz
2026-02-03 15:08 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-02-03 15:25 ` ✓ i915.CI.BAT: " Patchwork
2026-02-04  3:59 ` ✗ i915.CI.Full: failure " Patchwork
2026-02-04  5:16 ` ✗ Xe.CI.FULL: " Patchwork
2026-02-05 19:13 ` [PATCH i-g-t] " Kamil Konieczny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox