Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Shekhar Chauhan <shekhar.chauhan@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: shekhar.chauhan@intel.com, ashutosh.dixit@intel.com,
	gustavo.sousa@intel.com
Subject: [PATCH v4 1/2] lib/intel_wa: Add workaround check for a wa within debugfs file
Date: Tue,  5 May 2026 11:17:40 +0530	[thread overview]
Message-ID: <20260505054741.486361-2-shekhar.chauhan@intel.com> (raw)
In-Reply-To: <20260505054741.486361-1-shekhar.chauhan@intel.com>

Add a check to see if a workaround exists in the debugfs file.

Signed-off-by: Shekhar Chauhan <shekhar.chauhan@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


  reply	other threads:[~2026-05-05  5:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-05  5:47 [PATCH v4 0/2] Wa_14026633728 Shekhar Chauhan
2026-05-05  5:47 ` Shekhar Chauhan [this message]
2026-05-05 13:34   ` [PATCH v4 1/2] lib/intel_wa: Add workaround check for a wa within debugfs file Gustavo Sousa
2026-05-05 14:26     ` Jani Nikula
2026-05-05 14:50       ` Gustavo Sousa
2026-05-05 14:53         ` Jani Nikula
2026-05-05  5:47 ` [PATCH v4 2/2] tests/intel/xe_oa: Wa_14026633728 Shekhar Chauhan
2026-05-05 16:42   ` Dixit, Ashutosh
2026-05-05  6:59 ` ✓ i915.CI.BAT: success for Wa_14026633728 Patchwork
2026-05-05  7:25 ` ✓ Xe.CI.BAT: " Patchwork
2026-05-05 11:50 ` ✓ i915.CI.Full: " Patchwork
2026-05-05 14:43 ` ✗ Xe.CI.FULL: failure " 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=20260505054741.486361-2-shekhar.chauhan@intel.com \
    --to=shekhar.chauhan@intel.com \
    --cc=ashutosh.dixit@intel.com \
    --cc=gustavo.sousa@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