[PATCH 41/66] tests/xe_exec_sip: Add support for dynamic debugger sysfs toggle

Christoph Manszewski christoph.manszewski at intel.com
Mon Jul 29 16:01:34 UTC 2024


>From now on the debugger is disabled by default so it is required
to enable the debugger before using it. This change addresses that
fact by calling necessary library functions within test fixtures.

Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
Signed-off-by: Christoph Manszewski <christoph.manszewski at intel.com>
Cc: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
---
 tests/intel/xe_exec_sip.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/tests/intel/xe_exec_sip.c b/tests/intel/xe_exec_sip.c
index a315bd3a9..832c26bac 100644
--- a/tests/intel/xe_exec_sip.c
+++ b/tests/intel/xe_exec_sip.c
@@ -123,18 +123,6 @@ static uint32_t gpgpu_shader(int fd, struct intel_bb *ibb, const int shadertype,
 	return buf->handle;
 }
 
-static bool has_debugger(int fd)
-{
-	struct drm_xe_eudebug_connect param = { .pid = getpid() };
-	int debugfd;
-
-	debugfd = igt_ioctl(fd, DRM_IOCTL_XE_EUDEBUG_CONNECT, &param);
-	if (debugfd >= 0)
-		close(debugfd);
-
-	return debugfd >= 0;
-}
-
 static void check_fill_buf(uint8_t *ptr, const int width, const int x,
 			   const int y, const uint8_t color)
 {
@@ -180,7 +168,7 @@ static int check_buf(int fd, uint32_t handle, int width, int height,
 	}
 
 	igt_assert(thread_count);
-	if (siptype != SIP_NULL && has_debugger(fd))
+	if (siptype != SIP_NULL && xe_eudebug_debugger_available(fd))
 		igt_assert_f(thread_count == sip_count,
 			     "Thread and SIP count mismatch, %d != %d\n",
 			     thread_count, sip_count);
@@ -305,7 +293,7 @@ static void test_sip(int shader, int sip, struct drm_xe_engine_class_instance *e
 	timeout *= igt_run_in_simulation() ? 10 : 1;
 
 	exec_queue_id = xe_exec_queue_create(fd, vm_id, eci,
-					     has_debugger(fd) ?
+					     xe_eudebug_debugger_available(fd) ?
 					     to_user_pointer(&ext) : 0);
 	ibb = intel_bb_create_with_context(fd, exec_queue_id, vm_id, NULL, 4096);
 
@@ -338,6 +326,7 @@ static void test_sip(int shader, int sip, struct drm_xe_engine_class_instance *e
 igt_main
 {
 	struct drm_xe_engine_class_instance *eci;
+	bool was_enabled;
 	int fd;
 
 	igt_fixture
@@ -349,17 +338,21 @@ igt_main
 	/* Debugger disabled (TD_CTL not set) */
 	igt_subtest_group {
 		igt_fixture {
-			igt_require(!has_debugger(fd));
+			was_enabled = xe_eudebug_enable(fd, false);
+			igt_require(!xe_eudebug_debugger_available(fd));
 		}
 
 		test_render_and_compute("wait-writesip-nodebug", fd, eci)
 			test_sip(SHADER_WAIT, SIP_WRITE, eci);
+
+		igt_fixture
+			xe_eudebug_enable(fd, was_enabled);
 	}
 
 	/* Debugger enabled (TD_CTL set) */
 	igt_subtest_group {
 		igt_fixture {
-			igt_require(has_debugger(fd));
+			was_enabled = xe_eudebug_enable(fd, true);
 		}
 
 		test_render_and_compute("breakpoint-writesip", fd, eci)
@@ -367,6 +360,9 @@ igt_main
 
 		test_render_and_compute("breakpoint-waitsip", fd, eci)
 			test_sip(SHADER_BREAKPOINT, SIP_WAIT, eci);
+
+		igt_fixture
+			xe_eudebug_enable(fd, was_enabled);
 	}
 
 	igt_fixture
-- 
2.34.1



More information about the igt-dev mailing list