[PATCH i-g-t 3/3] lib/xe_gt: Update has_xe_gt_reset function
Michal Wajdeczko
michal.wajdeczko at intel.com
Wed May 28 21:26:18 UTC 2025
We should look for the write-only "force_reset" attribute.
While around simplify code by using existing helper functions.
Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
---
lib/xe/xe_gt.c | 26 ++++++--------------------
1 file changed, 6 insertions(+), 20 deletions(-)
diff --git a/lib/xe/xe_gt.c b/lib/xe/xe_gt.c
index c911ca8e4..afb757bfa 100644
--- a/lib/xe/xe_gt.c
+++ b/lib/xe/xe_gt.c
@@ -30,31 +30,17 @@
*/
bool has_xe_gt_reset(int fd)
{
- char reset_sysfs_path[100];
- struct stat st;
+ int reset_fd;
int gt;
- int reset_sysfs_fd = -1;
- int sysfs_fd = -1;
- igt_assert_eq(fstat(fd, &st), 0);
- sysfs_fd = igt_sysfs_open(fd);
-
- igt_assert(sysfs_fd != -1);
xe_for_each_gt(fd, gt) {
- sprintf(reset_sysfs_path, "/sys/kernel/debug/dri/%d/gt%d/force_reset",
- minor(st.st_rdev), gt);
- reset_sysfs_fd = openat(sysfs_fd, reset_sysfs_path, O_RDONLY);
-
- if (reset_sysfs_fd == -1) {
- close(sysfs_fd);
- return 0;
- }
-
- close(reset_sysfs_fd);
+ reset_fd = igt_debugfs_gt_open(fd, gt, "force_reset", O_WRONLY);
+ if (reset_fd == -1)
+ return false;
+ close(reset_fd);
}
- close(sysfs_fd);
- return 1;
+ return true;
}
static void xe_force_gt_reset(int fd, int gt, bool sync)
--
2.47.1
More information about the igt-dev
mailing list