From: Shekhar Chauhan <shekhar.chauhan@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: shekhar.chauhan@intel.com, ashutosh.dixit@intel.com
Subject: [PATCH v7 1/2] lib/intel_wa: Check for device workarounds
Date: Fri, 8 May 2026 07:43:28 +0530 [thread overview]
Message-ID: <20260508021329.876072-2-shekhar.chauhan@intel.com> (raw)
In-Reply-To: <20260508021329.876072-1-shekhar.chauhan@intel.com>
Currently, igt_has_intel_wa() only checks for GT workarounds, extending
it to ensure that it also checks for device workarounds to avoid having
device workaround checks in the code.
While at it, ensure that we do not duplicate the logic for reading from
the debugfs file by extracting it into a separate function called
debugfs_file_has_wa().
Signed-off-by: Shekhar Chauhan <shekhar.chauhan@intel.com>
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
---
lib/intel_wa.c | 40 ++++++++++++++++++++++++++--------------
1 file changed, 26 insertions(+), 14 deletions(-)
diff --git a/lib/intel_wa.c b/lib/intel_wa.c
index 685df106f..727dd6c98 100644
--- a/lib/intel_wa.c
+++ b/lib/intel_wa.c
@@ -12,6 +12,27 @@
#include "intel_wa.h"
#include "xe/xe_query.h"
+static int debugfs_file_has_wa(int drm_fd, int debugfs_fd,
+ const char *debugfs_name, const char *wa)
+{
+ char *debugfs_dump;
+
+ if (!igt_debugfs_exists(drm_fd, debugfs_name, O_RDONLY))
+ return -1;
+
+ debugfs_dump = igt_sysfs_get(debugfs_fd, debugfs_name);
+ if (debugfs_dump) {
+ char *has_wa = strstr(debugfs_dump, wa);
+
+ free(debugfs_dump);
+
+ if (has_wa)
+ return 1;
+ }
+
+ return 0;
+}
+
/**
* igt_has_intel_wa:
* @drm_fd: A drm file descriptor
@@ -25,7 +46,6 @@ int igt_has_intel_wa(int drm_fd, const char *check_wa)
int debugfs_fd;
unsigned int xe;
char name[256];
- char *debugfs_dump, *has_wa;
debugfs_fd = igt_debugfs_dir(drm_fd);
if (debugfs_fd == -1)
@@ -33,22 +53,14 @@ int igt_has_intel_wa(int drm_fd, const char *check_wa)
xe_for_each_gt(drm_fd, xe) {
sprintf(name, "gt%d/workarounds", xe);
- if (!igt_debugfs_exists(drm_fd, name, O_RDONLY)) {
- ret = -1;
+ ret = debugfs_file_has_wa(drm_fd, debugfs_fd, name, check_wa);
+ if (ret)
break;
- }
-
- debugfs_dump = igt_sysfs_get(debugfs_fd, name);
- if (debugfs_dump) {
- has_wa = strstr(debugfs_dump, check_wa);
- free(debugfs_dump);
- if (has_wa) {
- ret = 1;
- break;
- }
- }
}
+ if (!ret)
+ ret = debugfs_file_has_wa(drm_fd, debugfs_fd, "workarounds", check_wa);
+
close(debugfs_fd);
return ret;
}
--
2.53.0
next prev parent reply other threads:[~2026-05-08 2:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-08 2:13 [PATCH v7 0/2] Wa_14026633728 Shekhar Chauhan
2026-05-08 2:13 ` Shekhar Chauhan [this message]
2026-05-08 2:13 ` [PATCH v7 2/2] tests/intel/xe_oa: Wa_14026633728 Shekhar Chauhan
2026-05-08 4:10 ` Dixit, Ashutosh
2026-05-13 21:38 ` Dixit, Ashutosh
2026-05-08 20:56 ` Dixit, Ashutosh
2026-05-08 3:05 ` ✓ Xe.CI.BAT: success for Wa_14026633728 Patchwork
2026-05-08 3:23 ` ✓ i915.CI.BAT: " Patchwork
2026-05-08 14:09 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-05-08 19:56 ` ✗ i915.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=20260508021329.876072-2-shekhar.chauhan@intel.com \
--to=shekhar.chauhan@intel.com \
--cc=ashutosh.dixit@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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