Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] tests/intel/xe_eu_stall: Skip test if feature is not supported
@ 2025-06-03 16:07 Jakub Kolakowski
  2025-06-03 19:33 ` ✓ Xe.CI.BAT: success for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jakub Kolakowski @ 2025-06-03 16:07 UTC (permalink / raw)
  To: igt-dev
  Cc: Jakub Kolakowski, Harish Chegondi, Ashutosh Dixit, Adam Miszczak,
	Lukasz Laguna, Marcin Bernatowicz

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

Cc: Harish Chegondi <harish.chegondi@intel.com>
Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
Cc: Adam Miszczak <adam.miszczak@linux.intel.com>
Cc: Lukasz Laguna <lukasz.laguna@intel.com>
Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Signed-off-by: Jakub Kolakowski <jakub1.kolakowski@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


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

end of thread, other threads:[~2025-06-04 18:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-03 16:07 [PATCH i-g-t] tests/intel/xe_eu_stall: Skip test if feature is not supported Jakub Kolakowski
2025-06-03 19:33 ` ✓ Xe.CI.BAT: success for " Patchwork
2025-06-03 19:50 ` ✗ i915.CI.BAT: failure " Patchwork
2025-06-04  6:03 ` [PATCH i-g-t] " Harish Chegondi
2025-06-04 18:03 ` ✗ Xe.CI.Full: failure for " Patchwork

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