Re: [PATCH i-g-t 01/10] lib/xe: Move lib/intel_wa to lib/xe/xe_wa

Gustavo Sousa <[email protected]> Wed, 29 Jul 2026 18:09:13 -0300
Newsgroups org.freedesktop.lists.igt-dev
Message-ID <[email protected]>
Matt Roper <[email protected]> writes:

> On Tue, Jul 21, 2026 at 03:59:54PM -0300, Gustavo Sousa wrote:
>> The functionality provided by intel_wa is specific devices managed by
>> the xe driver, so move that module to belong to the lib/xe folder.
>> 
>> While at it, change the function signature to match the adopted
>> standard for lib/xe (used xe_query.h as example).
>> 
>> Signed-off-by: Gustavo Sousa <[email protected]>
>> ---
>>  lib/intel_wa.h                 | 11 -----------
>>  lib/meson.build                |  2 +-
>>  lib/{intel_wa.c => xe/xe_wa.c} | 21 +++++++++++----------
>>  lib/xe/xe_wa.h                 | 11 +++++++++++
>>  tests/intel/xe_oa.c            |  4 ++--
>>  5 files changed, 25 insertions(+), 24 deletions(-)
>> 
>> diff --git a/lib/intel_wa.h b/lib/intel_wa.h
>> deleted file mode 100644
>> index 765a5948ef88..000000000000
>> --- a/lib/intel_wa.h
>> +++ /dev/null
>> @@ -1,11 +0,0 @@
>> -/* SPDX-License-Identifier: MIT */
>> -/*
>> - * Copyright © 2025 Intel Corporation
>> - */
>> -
>> -#ifndef __INTEL_WA_H__
>> -#define __INTEL_WA_H__
>> -
>> -int igt_has_intel_wa(int drm_fd, const char *check_wa);
>> -
>> -#endif /* __INTEL_WA_H__ */
>> diff --git a/lib/meson.build b/lib/meson.build
>> index 8db9fffdecec..b31936d6c3fd 100644
>> --- a/lib/meson.build
>> +++ b/lib/meson.build
>> @@ -93,7 +93,6 @@ lib_sources = [
>>  	'intel_aux_pgtable.c',
>>  	'intel_reg_map.c',
>>  	'intel_iosf.c',
>> -        'intel_wa.c',
>>  	'igt_kms.c',
>>  	'igt_fb.c',
>>  	'igt_core.c',
>> @@ -135,6 +134,7 @@ lib_sources = [
>>  	'xe/xe_sriov_debugfs.c',
>>  	'xe/xe_sriov_provisioning.c',
>>  	'xe/xe_util.c',
>> +	'xe/xe_wa.c',
>>  
>>  	# Vendored libraries:
>>  	'vendor/uwildmat/uwildmat.c',
>> diff --git a/lib/intel_wa.c b/lib/xe/xe_wa.c
>> similarity index 66%
>> rename from lib/intel_wa.c
>> rename to lib/xe/xe_wa.c
>> index 727dd6c988df..ff5daf529831 100644
>> --- a/lib/intel_wa.c
>> +++ b/lib/xe/xe_wa.c
>> @@ -9,7 +9,8 @@
>>  
>>  #include "igt_debugfs.h"
>>  #include "igt_sysfs.h"
>> -#include "intel_wa.h"
>> +
>> +#include "xe/xe_wa.h"
>>  #include "xe/xe_query.h"
>
> Nitpick:  These aren't sorted.

Thanks.

>
>>  
>>  static int debugfs_file_has_wa(int drm_fd, int debugfs_fd,
>> @@ -34,32 +35,32 @@ static int debugfs_file_has_wa(int drm_fd, int debugfs_fd,
>>  }
>>  
>>  /**
>> - * igt_has_intel_wa:
>> - * @drm_fd:	A drm file descriptor
>> - * @check_wa:	Workaround to be checked
>> + * xe_wa: Check if a workaround is enabled for the device.
>> + * @fd: A drm file descriptor.
>> + * @wa: Name of the workaround to be checked.
>>   *
>> - * Returns:	0 if no WA, 1 if WA present, -1 on error
>> + * Returns 1 if enabled, 0 if disabled, -1 on error.
>>   */
>> -int igt_has_intel_wa(int drm_fd, const char *check_wa)
>> +int xe_wa(int fd, const char *wa)
>>  {
>>  	int ret = 0;
>>  	int debugfs_fd;
>>  	unsigned int xe;
>>  	char name[256];
>>  
>> -	debugfs_fd = igt_debugfs_dir(drm_fd);
>> +	debugfs_fd = igt_debugfs_dir(fd);
>>  	if (debugfs_fd == -1)
>>  		return -1;
>>  
>> -	xe_for_each_gt(drm_fd, xe) {
>> +	xe_for_each_gt(fd, xe) {
>>  		sprintf(name, "gt%d/workarounds", xe);
>> -		ret = debugfs_file_has_wa(drm_fd, debugfs_fd, name, check_wa);
>> +		ret = debugfs_file_has_wa(fd, debugfs_fd, name, wa);
>>  		if (ret)
>>  			break;
>>  	}
>>  
>>  	if (!ret)
>> -		ret = debugfs_file_has_wa(drm_fd, debugfs_fd, "workarounds", check_wa);
>> +		ret = debugfs_file_has_wa(fd, debugfs_fd, "workarounds", wa);
>>  
>>  	close(debugfs_fd);
>>  	return ret;
>> diff --git a/lib/xe/xe_wa.h b/lib/xe/xe_wa.h
>> new file mode 100644
>> index 000000000000..4ff897196545
>> --- /dev/null
>> +++ b/lib/xe/xe_wa.h
>> @@ -0,0 +1,11 @@
>> +/* SPDX-License-Identifier: MIT */
>> +/*
>> + * Copyright © 2025 Intel Corporation
>
> Nitpick:  This should say 2026.

Even though we are essentially moving the content?

>
>
> Aside from those two minor things,
>
> Reviewed-by: Matt Roper <[email protected]>

Thanks!

--
Gustavo Sousa

>
>
> Matt
>
>> + */
>> +
>> +#ifndef XE_WA_H
>> +#define XE_WA_H
>> +
>> +int xe_wa(int fd, const char *wa);
>> +
>> +#endif /* XE_WA_H */
>> diff --git a/tests/intel/xe_oa.c b/tests/intel/xe_oa.c
>> index 68c7537d3888..fcf1d71a167f 100644
>> --- a/tests/intel/xe_oa.c
>> +++ b/tests/intel/xe_oa.c
>> @@ -24,10 +24,10 @@
>>  #include "igt_device.h"
>>  #include "igt_syncobj.h"
>>  #include "igt_sysfs.h"
>> -#include "intel_wa.h"
>>  #include "xe/xe_ioctl.h"
>>  #include "xe/xe_query.h"
>>  #include "xe/xe_oa.h"
>> +#include "xe/xe_wa.h"
>>  
>>  /**
>>   * TEST: perf
>> @@ -2678,7 +2678,7 @@ test_non_zero_reason(const struct drm_xe_oa_unit *oau, size_t oa_buffer_size)
>>  	 * can result in buffer overflows.
>>  	 */
>>  	if (oau->oa_unit_type == DRM_XE_OA_UNIT_TYPE_MERT &&
>> -		igt_has_intel_wa(drm_fd, "14026633728") > 0) {
>> +	    xe_wa(drm_fd, "14026633728") > 0) {
>>  		oa_exponent = max(oa_exponent, 8);
>>  		properties[9] = oa_exponent;
>>  	}
>> 
>> -- 
>> 2.55.0
>> 
>
> -- 
> Matt Roper
> Graphics Software Engineer
> Linux GPU Platform Enablement
> Intel Corporation