[PATCH 57/66] lib/xe_eudebug: Expose xe_eudebug_connect

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


From: Karolina Stolarek <karolina.stolarek at intel.com>

Expose xe_eudebug_connect library function to use it directly in tests.

Signed-off-by: Karolina Stolarek <karolina.stolarek at intel.com>
Cc: Christoph Manszewski <christoph.manszewski at intel.com>
Cc: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
---
 lib/xe/xe_eudebug.c | 30 ++++++++++++++++++++----------
 lib/xe/xe_eudebug.h |  1 +
 2 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/lib/xe/xe_eudebug.c b/lib/xe/xe_eudebug.c
index 41809429d..1fa9cbaf1 100644
--- a/lib/xe/xe_eudebug.c
+++ b/lib/xe/xe_eudebug.c
@@ -329,16 +329,6 @@ static int __xe_eudebug_connect(int fd, pid_t pid, uint32_t flags, uint64_t even
 	return debugfd;
 }
 
-static int xe_eudebug_connect(int fd, pid_t pid, uint32_t flags)
-{
-	int ret;
-	uint64_t events = 0; /* events filtering not supported yet! */
-
-	ret = __xe_eudebug_connect(fd, pid, flags, events);
-
-	return ret;
-}
-
 static void event_log_write_to_fd(struct xe_eudebug_event_log *l, int fd)
 {
 	igt_assert_eq(write(fd, &l->head, sizeof(l->head)),
@@ -810,6 +800,26 @@ static void event_log_sort(struct xe_eudebug_event_log *l)
 	xe_eudebug_event_log_destroy(tmp);
 }
 
+/**
+ * xe_eudebug_connect:
+ * @fd: Xe file descriptor
+ * @pid: client PID
+ * @flags: connection flags
+ *
+ * Opens the xe eu debugger connection to the process described by @pid
+ *
+ * Returns: 0 if the debugger was successfully attached, -errno otherwise.
+ */
+int xe_eudebug_connect(int fd, pid_t pid, uint32_t flags)
+{
+	int ret;
+	uint64_t events = 0; /* events filtering not supported yet! */
+
+	ret = __xe_eudebug_connect(fd, pid, flags, events);
+
+	return ret;
+}
+
 /**
  * xe_eudebug_event_log_create:
  * @name: event log identifier
diff --git a/lib/xe/xe_eudebug.h b/lib/xe/xe_eudebug.h
index a499cc977..4654b462f 100644
--- a/lib/xe/xe_eudebug.h
+++ b/lib/xe/xe_eudebug.h
@@ -112,6 +112,7 @@ typedef void (*xe_eudebug_trigger_fn)(struct xe_eudebug_debugger *,
 #define XE_EUDEUBG_FILTER_ALL			GENMASK(DRM_XE_EUDEBUG_EVENT_MAX_EVENT, 0)
 #define XE_EUDEBUG_EVENT_IS_FILTERED(_e, _f)	((1UL << _e) & _f)
 
+int xe_eudebug_connect(int fd, pid_t pid, uint32_t flags);
 const char *xe_eudebug_event_to_str(struct drm_xe_eudebug_event *e, char *buf, size_t len);
 struct drm_xe_eudebug_event *
 xe_eudebug_event_log_find_seqno(struct xe_eudebug_event_log *l, uint64_t seqno);
-- 
2.34.1



More information about the igt-dev mailing list