Skip to contentSkip to conversation

tests/intel/xe_survivability: Add xe_survivability test

PATCH Superseded Sk Anirban 1 participant 4 messages Oct 27, 2025 Arm/Amlogic Meson SoC support

v7 of 10 Superseded Latest is v10 →

lore
Share & tools
lore

Sk Anirban

author
#0 lore raw

v7 cover tests/intel/xe_survivability: Add xe_survivability test

This series creates a new xe_survivability.c test file with two subtests. i2c-functionality validates i2c adapter preservation in survivability mode for AMC firmware updates, and runtime-survivability tests CSC error injection, device wedged state recovery, and post-recovery GPU functionality validation.

Sk Anirban (3):
tests/intel/xe_survivability: Add new xe_survivability test for i2c
adapter
tests/intel/xe_survivability: Add new test runtime survivability
HAX: Add xe_survivability tests to fast feedback list

 tests/intel-ci/xe-fast-feedback.testlist |   4 +
 tests/intel/xe_survivability.c           | 263 +++++++++++++++++++++++
 tests/meson.build                        |   1 +
 3 files changed, 268 insertions(+)
 create mode 100644 tests/intel/xe_survivability.c
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH v7 1/3 tests/intel/xe_survivability: Add new xe_survivability test for i2c adapter

Add i2c adapter presence check in survivability mode to ensure the Add-In Management Controller (AMC) can receive firmware updates when the device is in survivability mode.

v2: Create new file for test (Riana)
v3: Update subject, description, nitpick (Kamil)
Use drm_close_driver() (Kamil)
v4: Update test details (Riana)
Align with xe_configfs (Riana)
Create separate function for sysfs (Riana)
v5: Remove duplicate close(fd) (Riana)
Modify fixture (Riana)
Move assert to function (Riana)
v6: Move VF check (Riana)
v7: Clear survivability mode (Riana)

---
 tests/intel/xe_survivability.c | 158 +++++++++++++++++++++++++++++++++
 tests/meson.build              |   1 +
 2 files changed, 159 insertions(+)
 create mode 100644 tests/intel/xe_survivability.c
tests/intel/xe_survivability.c new file +158 -0
new file mode 100644
index 000000000..432220a35
@@ -0,0 +1,158 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2025 Intel Corporation
+ */
+#include <dirent.h>
+#include <fcntl.h>
+#include <limits.h>
+
+#include "igt.h"
+#include "igt_configfs.h"
+#include "igt_device.h"
+#include "igt_fs.h"
+#include "igt_kmod.h"
+#include "igt_sriov_device.h"
+#include "igt_sysfs.h"
+#include "xe/xe_query.h"
+
+/**
+ * TEST: Comprehensive survivability mode testing
+ * Category: Core
+ * Mega feature: General Core features
+ * Sub-category: Telemetry
+ * Functionality: survivability mode
+ * Description: Validate survivability mode functionality
+ * Test category: Functional tests
+ *
+ * SUBTEST: i2c-functionality
+ * Description: Validate i2c adapter functionality in survivability mode
+ */
+
+static char bus_addr[NAME_MAX];
+
+static bool check_survivability_mode_sysfs(void)
+{
+	char path[PATH_MAX];
+	int fd;
+
+	snprintf(path, PATH_MAX, "/sys/bus/pci/devices/%s/survivability_mode", bus_addr);
+	fd = open(path, O_RDONLY);
+	igt_assert_f(fd >= 0, "Survivability mode not set\n");
+	close(fd);
+	return true;
+}
+
+static int find_i2c_adapter(struct pci_device *pci_xe)
+{
+	char device_path[PATH_MAX];
+	struct dirent *dirent;
+	int i2c_adapter = -1;
+	DIR *device_dir;
+	int ret;
+
+	igt_require(igt_kmod_load("i2c-dev", NULL) == 0);
+
+	snprintf(device_path, sizeof(device_path), "/sys/bus/pci/devices/%s/%s.%hu", bus_addr,
+		 "i2c_designware", (pci_xe->bus << 8) | (pci_xe->dev));
+	device_dir = opendir(device_path);
+
+	if (!device_dir)
+		return -1;
+
+	while ((dirent = readdir(device_dir))) {
+		if (strncmp(dirent->d_name, "i2c-", 4) == 0) {
+			ret = sscanf(dirent->d_name, "i2c-%d", &i2c_adapter);
+			igt_assert_f(ret == 1, "Failed to parse i2c adapter number");
+			closedir(device_dir);
+			return i2c_adapter;
+		}
+	}
+
+	closedir(device_dir);
+	return i2c_adapter;
+}
+
+static void restore(int sig)
+{
+	int configfs_fd;
+
+	igt_kmod_unbind("xe", bus_addr);
+
+	configfs_fd = igt_configfs_open("xe");
+	if (configfs_fd >= 0)
+		igt_fs_remove_dir(configfs_fd, bus_addr);
+	close(configfs_fd);
+
+	igt_kmod_bind("xe", bus_addr);
+}
+
+static void set_survivability_mode(int configfs_device_fd, bool value)
+{
+	igt_kmod_unbind("xe", bus_addr);
+	igt_sysfs_set_boolean(configfs_device_fd, "survivability_mode", value);
+	igt_kmod_bind("xe", bus_addr);
+}
+
+static void test_i2c_functionality(int configfs_device_fd, struct pci_device *pci_xe)
+{
+	if (find_i2c_adapter(pci_xe) >= 0) {
+		/* Enable survivability mode */
+		set_survivability_mode(configfs_device_fd, true);
+
+		/* check presence of survivability mode sysfs */
+		check_survivability_mode_sysfs();
+
+		/* Check i2c adapter after survivability mode */
+		igt_assert_f(find_i2c_adapter(pci_xe) >= 0,
+			     "i2c not initialized\n");
+
+		set_survivability_mode(configfs_device_fd, false);
+	}
+}
+
+static int create_device_configfs_group(int configfs_fd)
+{
+	mode_t mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
+	int configfs_device_fd;
+
+	configfs_device_fd = igt_fs_create_dir(configfs_fd, bus_addr, mode);
+	igt_assert(configfs_device_fd);
+
+	return configfs_device_fd;
+}
+
+igt_main
+{
+	int fd, configfs_fd, configfs_device_fd;
+	struct pci_device *pci_xe;
+	bool vf_device;
+
+	igt_fixture {
+		fd = drm_open_driver(DRIVER_XE);
+		igt_require(IS_BATTLEMAGE(intel_get_drm_devid(fd)));
+		vf_device = intel_is_vf_device(fd);
+		igt_require_f(!vf_device, "survivability mode not supported in VF\n");
+		pci_xe = igt_device_get_pci_device(fd);
+		igt_device_get_pci_slot_name(fd, bus_addr);
+		configfs_fd = igt_configfs_open("xe");
+		igt_require(configfs_fd != -1);
+		configfs_device_fd = create_device_configfs_group(configfs_fd);
+		igt_install_exit_handler(restore);
+	}
+
+	igt_describe("Validate i2c adapter functionality in survivability mode");
+	igt_subtest("i2c-functionality") {
+		test_i2c_functionality(configfs_device_fd, pci_xe);
+		drm_close_driver(fd);
+		igt_kmod_rebind("xe", bus_addr);
+		fd = drm_open_driver(DRIVER_XE);
+	}
+
+	igt_fixture {
+		igt_fs_remove_dir(configfs_fd, bus_addr);
+		close(configfs_device_fd);
+		close(configfs_fd);
+		drm_close_driver(fd);
+	}
+}
+
tests/meson.build +1 -0
index 73edd3e71..31487f62e 100644
@@ -329,6 +329,7 @@ intel_xe_progs = [
 	'xe_sriov_auto_provisioning',
 	'xe_sriov_flr',
 	'xe_sriov_scheduling',
+        'xe_survivability',
 	'xe_sriov_vram',
 	'xe_sysfs_defaults',
 	'xe_sysfs_preempt_timeout',
Signature · 1 line
2.43.0
author
#2 lore raw

PATCH v7 2/3 tests/intel/xe_survivability: Add new test runtime survivability

In reply to Sk Anirban

Inject CSC error using debugfs to test vendor-specific device wedged state and runtime survivability mode.
To return the device to a normal state, reload the driver, as the wedged state can only be resolved by rebinding/reprobing the driver.

v3: Update commit message (Riana)
Modify the uevents interrupt handling (Riana)
v4: Move test to xe_survivability (Riana)
v5: Use separate function for sysfs (Riana)
Cosmetic changes (Riana)
Use basic spinner (Riana)
v6: Move VF check (Riana)
Modify commit message (Riana)
Add test description (Riana)
v7: Modify igt fixture (Riana)
Update the uevent_intercept function (Riana)

---
 tests/intel-ci/xe-fast-feedback.testlist |   2 +
 tests/intel/xe_survivability.c           | 105 +++++++++++++++++++++++
 2 files changed, 107 insertions(+)
tests/intel-ci/xe-fast-feedback.testlist +2 -0
index 017e3ba2a..5f27baafb 100644
@@ -185,6 +185,8 @@ igt@xe_sysfs_scheduler@timeslice_duration_us-invalid
 igt@xe_sysfs_scheduler@timeslice_duration_us-min-max
 igt@xe_sysfs_scheduler@job_timeout_ms-invalid
 igt@xe_sysfs_scheduler@job_timeout_ms-min-max
+igt@xe_survivability@i2c-functionality
+igt@xe_survivability@runtime-survivability
 #igt@xe_vm@bind-once
 #igt@xe_vm@scratch
 igt@xe_vm@shared-pte-page
tests/intel/xe_survivability.c +105 -0

146 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#3 lore raw

PATCH v7 3/3 HAX: Add xe_survivability tests to fast feedback list

In reply to Sk Anirban

Add xe_survivability to xe-fast-feedback

---
 tests/intel-ci/xe-fast-feedback.testlist | 2 ++
 1 file changed, 2 insertions(+)
tests/intel-ci/xe-fast-feedback.testlist +2 -0
index 5f27baafb..d18a44610 100644
@@ -187,6 +187,8 @@ igt@xe_sysfs_scheduler@job_timeout_ms-invalid
 igt@xe_sysfs_scheduler@job_timeout_ms-min-max
 igt@xe_survivability@i2c-functionality
 igt@xe_survivability@runtime-survivability
+igt@xe_survivability@i2c-functionality
+igt@xe_survivability@runtime-survivability
 #igt@xe_vm@bind-once
 #igt@xe_vm@scratch
 igt@xe_vm@shared-pte-page
Signature · 1 line
2.43.0