[PATCH v2 1/2] lib/igt_debugfs: Add specific checks for WA in GTs
Mohammed Thasleem
mohammed.thasleem at intel.com
Mon May 19 12:31:34 UTC 2025
This function check the given workaround on available GTs
v2: Add discription for return. (Kamil)
Rename function to igt_has_intel_wa. (Kamil)
Move lib changes to lib/igt_debugfs. (Kamil)
Dump the whole wa sysfs file and then search for the wa. (Vinod)
Use return true/false directly instead assigning value. (Vinod)
Signed-off-by: Mohammed Thasleem <mohammed.thasleem at intel.com>
---
lib/igt_debugfs.c | 31 +++++++++++++++++++++++++++++++
lib/igt_debugfs.h | 1 +
2 files changed, 32 insertions(+)
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 8ac215a76..ec3e33854 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -44,6 +44,7 @@
#include "igt_kms.h"
#include "igt_debugfs.h"
#include "igt_sysfs.h"
+#include "xe/xe_query.h"
/**
* SECTION:igt_debugfs
@@ -770,3 +771,33 @@ void __igt_debugfs_dump(int device, const char *filename, int level)
igt_log(IGT_LOG_DOMAIN, level, "%s:\n%s\n", filename, contents);
free(contents);
}
+
+/**
+ * igt_has_intel_wa:
+ * @drm_fd: A drm file descriptor
+ * @check_wa: Workaround to be checked
+ * @return: It will return true if WA found otherwise false
+ */
+int igt_has_intel_wa(int drm_fd, const char *check_wa)
+{
+ char name[PATH_MAX];
+ char *debugfs_dump;
+ unsigned int xe, debugfs_fd;
+
+ debugfs_fd = igt_debugfs_dir(drm_fd);
+
+ xe_for_each_gt(drm_fd, xe) {
+ sprintf(name, "gt%d/workarounds", xe);
+ if (!igt_debugfs_exists(drm_fd, name, O_RDONLY))
+ return -1;
+
+ debugfs_dump = igt_sysfs_get(debugfs_fd, name);
+
+ if (debugfs_dump != NULL) {
+ if (strstr(debugfs_dump, check_wa))
+ return true;
+ }
+ }
+
+ return false;
+}
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index f4044d545..6d4c09d2f 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -49,6 +49,7 @@ bool igt_debugfs_search(int fd, const char *filename, const char *substring);
int igt_debugfs_gt_dir(int device, unsigned int gt);
int igt_debugfs_gt_open(int device, unsigned int gt, const char *filename,
int mode);
+int igt_has_intel_wa(int drm_fd, const char *check_wa);
/**
* igt_debugfs_read:
--
2.34.1
More information about the igt-dev
mailing list