Re: [PATCH i-g-t 09/10] lib/intel_pat: Pass xe_device to xe_get_pat_config()

Matt Roper <[email protected]> Wed, 29 Jul 2026 15:38:43 -0700
Newsgroups org.freedesktop.lists.igt-dev
Message-ID <[email protected]>
On Tue, Jul 21, 2026 at 04:00:02PM -0300, Gustavo Sousa wrote:
> In an upcoming change, we will need to check for a workaround as part
> of xe_get_pat_config().  Since xe_get_pat_config() also gets called
> during xe_device_get(), we will need to use xe_wa_from_cache() instead
> of the regular xe_wa() function.  In preparation for that, make sure
> that xe_get_pat_config() gets called with the xe_device struct instead
> of the drm file descriptor.
> 
> Signed-off-by: Gustavo Sousa <[email protected]>

Reviewed-by: Matt Roper <[email protected]>

> ---
>  lib/intel_pat.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/intel_pat.c b/lib/intel_pat.c
> index 14935e3c4692..ebf5cd428c68 100644
> --- a/lib/intel_pat.c
> +++ b/lib/intel_pat.c
> @@ -24,7 +24,7 @@ enum xe_pat_config {
>   * Returns: The number of PAT entries successfully read on success, or a negative error
>   *          code on failure
>   */
> -static int32_t xe_get_pat_config(int drm_fd, struct intel_pat_cache *xe_pat_cache,
> +static int32_t xe_get_pat_config(struct xe_device *xe_dev, struct intel_pat_cache *xe_pat_cache,
>  				 int gt, enum xe_pat_config pat_config)
>  {
>  	char *line = NULL;
> @@ -40,7 +40,7 @@ static int32_t xe_get_pat_config(int drm_fd, struct intel_pat_cache *xe_pat_cach
>  	else
>  		snprintf(config, sizeof(config), "gt%d/pat", gt);
>  
> -	dbgfs_fd = igt_debugfs_open(drm_fd, config, O_RDONLY);
> +	dbgfs_fd = igt_debugfs_open(xe_dev->fd, config, O_RDONLY);
>  	if (dbgfs_fd < 0)
>  		return dbgfs_fd;
>  	dbgfs_file = fdopen(dbgfs_fd, "r");
> @@ -125,7 +125,9 @@ static int32_t xe_get_pat_config(int drm_fd, struct intel_pat_cache *xe_pat_cach
>   */
>  int32_t xe_get_pat_sw_config(int drm_fd, struct intel_pat_cache *xe_pat_cache, int gt)
>  {
> -	return xe_get_pat_config(drm_fd, xe_pat_cache, gt, PAT_SW_CONFIG);
> +	struct xe_device *xe_dev = xe_device_get(drm_fd);
> +
> +	return xe_get_pat_config(xe_dev, xe_pat_cache, gt, PAT_SW_CONFIG);
>  }
>  
>  /**
> @@ -141,7 +143,9 @@ int32_t xe_get_pat_sw_config(int drm_fd, struct intel_pat_cache *xe_pat_cache, i
>   */
>  int32_t xe_get_pat_hw_config(int drm_fd, struct intel_pat_cache *xe_pat_cache, int gt)
>  {
> -	return xe_get_pat_config(drm_fd, xe_pat_cache, gt, PAT_HW_CONFIG);
> +	struct xe_device *xe_dev = xe_device_get(drm_fd);
> +
> +	return xe_get_pat_config(xe_dev, xe_pat_cache, gt, PAT_HW_CONFIG);
>  }
>  
>  void intel_pat_build_xe_cache(struct xe_device *xe_dev)
> @@ -151,7 +155,7 @@ void intel_pat_build_xe_cache(struct xe_device *xe_dev)
>  	pat_cache = calloc(1, sizeof(*pat_cache));
>  	igt_assert(pat_cache);
>  
> -	if (igt_debug_on(xe_get_pat_sw_config(xe_dev->fd, pat_cache, 0) <= 0)) {
> +	if (igt_debug_on(xe_get_pat_config(xe_dev, pat_cache, 0, PAT_SW_CONFIG) <= 0)) {
>  		free(pat_cache);
>  		return;
>  	}
> 
> -- 
> 2.55.0
> 

-- 
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation