[PATCH 1/4] drm/xe: Fix GT "for each engine" workaround handling

Tvrtko Ursulin tursulin at ursulin.net
Thu Jan 30 16:23:30 UTC 2025


On 30/01/2025 11:03, Tvrtko Ursulin wrote:
> Any rules using engine matching are currently broken due RTP processing
> happening in early init before the list of hardware engines has been
> initialised.
> 
> Fix it my moving the engine initialisation to earlier in the init process
> and process the workaround and tuning lists just before the GuC load will
> happen.
> 
> Looking at the debugfs gt0/workarounds on ADL-P we notice 14011060649
> should be present while we see, before:
> 
> GT Workarounds
> 	14011059788
> 	14015795083
> 
> And after:
> 
> GT Workarounds
> 	14011060649
> 	14011059788
> 	14015795083
> 
> v2:
>   * Moved OOB back to early init.
>   * Moved engine init and WA processing to earlier phase.
>   * Improved commit message.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>
> Cc: Lucas De Marchi <lucas.demarchi at intel.com>
> Cc: Matt Roper <matthew.d.roper at intel.com>
> ---
> Lets see if this explodes in CI...
> ---
>   drivers/gpu/drm/xe/xe_device.c | 18 ++++++++++++++++++
>   drivers/gpu/drm/xe/xe_gt.c     |  6 ------
>   2 files changed, 18 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index f3f754beb812..9d8dfee9dad2 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
> @@ -55,6 +55,7 @@
>   #include "xe_tile.h"
>   #include "xe_ttm_stolen_mgr.h"
>   #include "xe_ttm_sys_mgr.h"
> +#include "xe_tuning.h"
>   #include "xe_vm.h"
>   #include "xe_vram.h"
>   #include "xe_vsec.h"
> @@ -793,6 +794,23 @@ int xe_device_probe(struct xe_device *xe)
>   	}
>   
>   	for_each_gt(gt, xe, id) {
> +		unsigned int fw_ref;
> +
> +		fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
> +		if (!fw_ref)
> +			return -ETIMEDOUT;
> +
> +		err = xe_hw_engines_init_early(gt);

Nope, this is now too early according to the CI. Back to the drawing board.

Regards,

Tvrtko

> +		if (err) {
> +			xe_force_wake_put(gt_to_fw(gt), fw_ref);
> +			return err;
> +		}
> +
> +		xe_force_wake_put(gt_to_fw(gt), fw_ref);
> +
> +		xe_wa_process_gt(gt);
> +		xe_tuning_process_gt(gt);
> +
>   		err = xe_gt_init_hwconfig(gt);
>   		if (err)
>   			return err;
> diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
> index 01a4a852b8f4..c3711987737e 100644
> --- a/drivers/gpu/drm/xe/xe_gt.c
> +++ b/drivers/gpu/drm/xe/xe_gt.c
> @@ -380,9 +380,7 @@ int xe_gt_init_early(struct xe_gt *gt)
>   	if (err)
>   		return err;
>   
> -	xe_wa_process_gt(gt);
>   	xe_wa_process_oob(gt);
> -	xe_tuning_process_gt(gt);
>   
>   	xe_force_wake_init_gt(gt, gt_to_fw(gt));
>   	spin_lock_init(&gt->global_invl_lock);
> @@ -430,10 +428,6 @@ static int gt_fw_domain_init(struct xe_gt *gt)
>   	/* Rerun MCR init as we now have hw engine list */
>   	xe_gt_mcr_init(gt);
>   
> -	err = xe_hw_engines_init_early(gt);
> -	if (err)
> -		goto err_force_wake;
> -
>   	err = xe_hw_engine_class_sysfs_init(gt);
>   	if (err)
>   		goto err_force_wake;


More information about the Intel-xe mailing list