[PATCH i-g-t] tests/intel/xe_eu_stall: Skip test if feature is not supported

Jakub Kolakowski jakub1.kolakowski at intel.com
Tue Jun 3 16:07:18 UTC 2025


Add a helper to check for feature support. If feature isn't supported
skip the test.

Cc: Harish Chegondi <harish.chegondi at intel.com>
Cc: Ashutosh Dixit <ashutosh.dixit at intel.com>
Cc: Adam Miszczak <adam.miszczak at linux.intel.com>
Cc: Lukasz Laguna <lukasz.laguna at intel.com>
Cc: Marcin Bernatowicz <marcin.bernatowicz at linux.intel.com>
Signed-off-by: Jakub Kolakowski <jakub1.kolakowski at intel.com>
---
 tests/intel/xe_eu_stall.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/tests/intel/xe_eu_stall.c b/tests/intel/xe_eu_stall.c
index 411c30871..f3d7c1974 100644
--- a/tests/intel/xe_eu_stall.c
+++ b/tests/intel/xe_eu_stall.c
@@ -267,6 +267,31 @@ static void xe_eu_stall_ioctl_err(int fd, enum drm_xe_observation_op op, void *a
 	errno = 0;
 }
 
+static bool is_eu_stall_supported(int drm_fd)
+{
+	int stream_fd;
+	uint64_t properties[] = {
+		DRM_XE_EU_STALL_PROP_GT_ID, p_gt_id,
+		DRM_XE_EU_STALL_PROP_SAMPLE_RATE, DEFAULT_SAMPLE_RATE,
+		DRM_XE_EU_STALL_PROP_WAIT_NUM_REPORTS, p_num_reports,
+	};
+
+	struct xe_eu_stall_open_prop props = {
+		.num_properties = ARRAY_SIZE(properties) / 2,
+		.properties_ptr = to_user_pointer(properties),
+	};
+
+	stream_fd = xe_eu_stall_ioctl(drm_fd, DRM_XE_OBSERVATION_OP_STREAM_OPEN, &props);
+
+	if(stream_fd == -1 && errno == ENODEV) {
+		close(stream_fd);
+		return false;
+	}
+
+	close(stream_fd);
+	return true;
+}
+
 static uint64_t read_u64_file(const char *path)
 {
 	FILE *f;
@@ -654,6 +679,7 @@ igt_main_args("e:g:o:r:u:w:", long_options, help_str, opt_handler, NULL)
 		igt_require_fd(drm_fd);
 		devid = intel_get_drm_devid(drm_fd);
 		igt_require(IS_PONTEVECCHIO(devid) || intel_graphics_ver(devid) >= IP_VER(20, 0));
+		igt_require_f(is_eu_stall_supported(drm_fd), "EU stall sampling not supported\n");
 		igt_require_f(igt_get_gpgpu_fillfunc(devid), "no gpgpu-fill function\n");
 		igt_require_f(!stat(OBSERVATION_PARANOID, &sb), "no observation_paranoid file\n");
 		if (output_file) {
-- 
2.34.1



More information about the igt-dev mailing list