[PATCH 5/5] drm/amdgpu: Correct the position in patch_cond_exec for gfx9

Christian König ckoenig.leichtzumerken at gmail.com
Wed Sep 21 13:02:47 UTC 2022


Am 21.09.22 um 11:41 schrieb jiadong.zhu at amd.com:
> From: "Jiadong.Zhu" <Jiadong.Zhu at amd.com>
>
> The current position calulated in gfx_v9_0_ring_emit_patch_cond_exec
> underflows when the wptr is divisible by ring->buf_mask + 1.

Good catch, looks like a completely independent bug fix to me. So please 
push separately.

> Signed-off-by: Jiadong.Zhu <Jiadong.Zhu at amd.com>

Reviewed-by: Christian König <christian.koenig at amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> index c568a4f5b81e..65f8c8d4f4ae 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> @@ -5754,7 +5754,7 @@ static void gfx_v9_0_ring_emit_patch_cond_exec(struct amdgpu_ring *ring, unsigne
>   	BUG_ON(offset > ring->buf_mask);
>   	BUG_ON(ring->ring[offset] != 0x55aa55aa);
>   
> -	cur = (ring->wptr & ring->buf_mask) - 1;
> +	cur = (ring->wptr - 1) & ring->buf_mask;
>   	if (likely(cur > offset))
>   		ring->ring[offset] = cur - offset;
>   	else



More information about the amd-gfx mailing list