[PATCH i-g-t] lib/gpu_cmds: Correct number of threads in CFE_STATE instruction

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Mon Sep 23 07:12:49 UTC 2024


On Fri, Sep 20, 2024 at 03:24:25PM +0200, Dominik Grzegorzek wrote:
> Since xe2 there was a change in CFE_STATE instruction format.
> Field describing maximal number of threads now has type of u16,
> not u16-1 as it used to have.
> 
> Reported-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> Signed-off-by: Dominik Grzegorzek <dominik.grzegorzek at intel.com>

Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>

--
Zbigniew

> ---
>  lib/gpu_cmds.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/gpu_cmds.c b/lib/gpu_cmds.c
> index c44b24c79..2638e3791 100644
> --- a/lib/gpu_cmds.c
> +++ b/lib/gpu_cmds.c
> @@ -992,6 +992,7 @@ void
>  xehp_emit_cfe_state(struct intel_bb *ibb, uint32_t threads)
>  {
>  	bool dfeud = CFE_CAN_DISABLE_FUSED_EU_DISPATCH(ibb->devid);
> +	bool u16minus1 = intel_graphics_ver(ibb->devid) < IP_VER(20, 0);
>  
>  	intel_bb_out(ibb, XEHP_CFE_STATE | (6 - 2));
>  
> @@ -1001,7 +1002,8 @@ xehp_emit_cfe_state(struct intel_bb *ibb, uint32_t threads)
>  
>  #define _LEGACY_MODE (1 << 6)
>  	/* number of threads & urb entries */
> -	intel_bb_out(ibb, (max_t(threads, threads, 64) - 1) << 16 | (dfeud ? _LEGACY_MODE : 0));
> +	threads = max_t(threads, threads, 64);
> +	intel_bb_out(ibb, (u16minus1 ? threads - 1 : threads) << 16 | (dfeud ? _LEGACY_MODE : 0));
>  
>  	intel_bb_out(ibb, 0);
>  	intel_bb_out(ibb, 0);
> -- 
> 2.34.1
> 


More information about the igt-dev mailing list