From: Christoph Manszewski <christoph.manszewski@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Rudnicki@freedesktop.org, Piotr <piotr.rudnicki@intel.com>,
Piatkowski@freedesktop.org,
Dominik Karol <dominik.karol.piatkowski@intel.com>,
Jan Sokolowski <jan.sokolowski@intel.com>,
Christoph Manszewski <christoph.manszewski@intel.com>
Subject: [PATCH i-g-t v4 5/5] lib/xe/xe_eudebug: Get drm card sysfs path
Date: Fri, 20 Feb 2026 16:37:54 +0100 [thread overview]
Message-ID: <20260220153748.210381-12-christoph.manszewski@intel.com> (raw)
In-Reply-To: <20260220153748.210381-7-christoph.manszewski@intel.com>
Add helper function to get the card name as defined in the:
'/sys/class/drm/card<N>' path.
Signed-off-by: Christoph Manszewski <christoph.manszewski@intel.com>
---
lib/xe/xe_eudebug.c | 40 ++++++++++++++++++++++++++++++++++++----
1 file changed, 36 insertions(+), 4 deletions(-)
diff --git a/lib/xe/xe_eudebug.c b/lib/xe/xe_eudebug.c
index a0caad2c3..37ce1e2ac 100644
--- a/lib/xe/xe_eudebug.c
+++ b/lib/xe/xe_eudebug.c
@@ -1901,6 +1901,34 @@ static void metadata_event(struct xe_eudebug_client *c, uint32_t flags,
}
#define EU_DEBUG_TOGGLE "device/enable_eudebug"
+
+static char *get_card_name(int fd, char *card_name, size_t len)
+{
+ char sysfs_path[PATH_MAX];
+ char link_target[PATH_MAX];
+ char *card_start;
+ ssize_t link_len;
+
+ if (!igt_sysfs_path(fd, sysfs_path, sizeof(sysfs_path)))
+ return NULL;
+
+ link_len = readlink(sysfs_path, link_target, sizeof(link_target) - 1);
+ if (link_len < 0)
+ return NULL;
+
+ link_target[link_len] = '\0';
+
+ card_start = strstr(link_target, "card");
+ if (!card_start)
+ return NULL;
+
+ snprintf(card_name, len, "%s", card_start);
+ card_start = strchr(card_name, '/');
+ if (card_start)
+ *card_start = '\0';
+
+ return card_name;
+}
/**
* __xe_eudebug_enable_getset
* @fd: xe client
@@ -1962,7 +1990,7 @@ out:
*/
bool xe_eudebug_enable(int fd, bool enable)
{
- char sysfs_path[PATH_MAX];
+ char card_name[NAME_MAX];
bool old = false;
int ret = 0;
@@ -1984,9 +2012,13 @@ bool xe_eudebug_enable(int fd, bool enable)
}
if (ret == -ENOENT) {
- igt_assert(igt_sysfs_path(fd, sysfs_path, sizeof(sysfs_path)));
- igt_skip("'%s/" EU_DEBUG_TOGGLE
- "' sysfs attribute not found, EU DEBUG not supported\n", sysfs_path);
+ if (get_card_name(fd, card_name, sizeof(card_name)))
+ igt_skip("'/sys/class/drm/%s/" EU_DEBUG_TOGGLE
+ "' sysfs attribute not found, EU DEBUG not supported\n",
+ card_name);
+ else
+ igt_skip("'" EU_DEBUG_TOGGLE
+ "' sysfs attribute not found, EU DEBUG not supported\n");
}
igt_abort_on_f(ret, "xe_eudebug_enable: Failed to %s eudebug\n",
--
2.47.1
next prev parent reply other threads:[~2026-02-20 15:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-20 15:37 [PATCH i-g-t v4 0/5] Improve eudebug test cleanup Christoph Manszewski
2026-02-20 15:37 ` [PATCH i-g-t v4 1/5] tests/xe/xe_eudebug: Change pthread_join to pthread_timedjoin_np Christoph Manszewski
2026-03-10 12:57 ` Rudnicki, Piotr
2026-02-20 15:37 ` [PATCH i-g-t v4 2/5] lib/xe/xe_eudebug: Modify toggle error handling Christoph Manszewski
2026-03-10 12:57 ` Rudnicki, Piotr
2026-02-20 15:37 ` [PATCH i-g-t v4 3/5] xe/xe_eudebug: Add reattach function and make plain connect private Christoph Manszewski
2026-03-10 12:58 ` Rudnicki, Piotr
2026-02-20 15:37 ` [PATCH i-g-t v4 4/5] lib/xe/xe_eudebug: Track active debugger sessions and close when disabling Christoph Manszewski
2026-03-10 11:17 ` Rudnicki, Piotr
2026-02-20 15:37 ` Christoph Manszewski [this message]
2026-03-10 12:59 ` [PATCH i-g-t v4 5/5] lib/xe/xe_eudebug: Get drm card sysfs path Rudnicki, Piotr
2026-02-20 20:43 ` ✓ Xe.CI.BAT: success for Improve eudebug test cleanup (rev4) Patchwork
2026-02-20 21:30 ` ✓ i915.CI.BAT: " Patchwork
2026-02-21 8:55 ` ✗ i915.CI.Full: failure " Patchwork
2026-02-23 9:58 ` ✗ Xe.CI.FULL: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260220153748.210381-12-christoph.manszewski@intel.com \
--to=christoph.manszewski@intel.com \
--cc=Piatkowski@freedesktop.org \
--cc=Rudnicki@freedesktop.org \
--cc=dominik.karol.piatkowski@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jan.sokolowski@intel.com \
--cc=piotr.rudnicki@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox