[PATCH i-g-t 2/3] lib/xe_gt: Trigger forced GT reset using write

Kamil Konieczny kamil.konieczny at linux.intel.com
Mon Jun 2 15:17:00 UTC 2025


Hi Michal,
On 2025-05-28 at 23:26:17 +0200, Michal Wajdeczko wrote:
> The newest Xe driver supports triggering a GT reset using a write
> operation and this is a preffered method. Update IGT code to comply
> with that and also start using existing helper functions to access
> exposed "force_reset" attribute instead of relying on system() call.
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: John Harrison <John.C.Harrison at Intel.com>

Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

> ---
>  lib/xe/xe_gt.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/lib/xe/xe_gt.c b/lib/xe/xe_gt.c
> index 8bceca10d..c911ca8e4 100644
> --- a/lib/xe/xe_gt.c
> +++ b/lib/xe/xe_gt.c
> @@ -59,15 +59,14 @@ bool has_xe_gt_reset(int fd)
>  
>  static void xe_force_gt_reset(int fd, int gt, bool sync)
>  {
> -	char reset_string[128];
> -	struct stat st;
> +	const char *attr = sync ? "force_reset_sync" : "force_reset";
> +	int dir = igt_debugfs_gt_dir(fd, gt);
> +	int len;
>  
> -	igt_assert_eq(fstat(fd, &st), 0);
> -
> -	snprintf(reset_string, sizeof(reset_string),
> -		 "cat /sys/kernel/debug/dri/%d/gt%d/force_reset%s",
> -		 minor(st.st_rdev), gt, sync ? "_sync" : "");
> -	system(reset_string);
> +	igt_assert_neq(dir, -1);
> +	len = igt_sysfs_write(dir, attr, "1", 1);
> +	close(dir);
> +	igt_assert_eq(len, 1);
>  }
>  
>  /**
> -- 
> 2.47.1
> 


More information about the igt-dev mailing list