[PATCH 08/12] drm/amdgpu/gfx8: always restore kcq MQDs

Christian König christian.koenig at amd.com
Thu Apr 27 11:29:08 UTC 2023



Am 26.04.23 um 23:21 schrieb Alex Deucher:
> Always restore the MQD not just when we do a reset.
> This allows us to move the MQD to VRAM if we want.
>
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> index 5de44d7e92de..b1c6fc24f65c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> @@ -4651,14 +4651,14 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring)
>   
>   		if (adev->gfx.mec.mqd_backup[mqd_idx])
>   			memcpy(adev->gfx.mec.mqd_backup[mqd_idx], mqd, sizeof(struct vi_mqd_allocation));
> -	} else if (amdgpu_in_reset(adev)) { /* for GPU_RESET case */
> -		/* reset MQD to a clean status */
> +	} else {
> +		/* restore MQD to a clean status */
>   		if (adev->gfx.mec.mqd_backup[mqd_idx])
>   			memcpy(mqd, adev->gfx.mec.mqd_backup[mqd_idx], sizeof(struct vi_mqd_allocation));
> -		/* reset ring buffer */
> -		ring->wptr = 0;
> -		amdgpu_ring_clear_ring(ring);
> -	} else {
> +		if (amdgpu_in_reset(adev)) {
> +			/* reset ring buffer */
> +			ring->wptr = 0;
> +		}

I think this needs to be done on resume as well.

Essentially we want to always start from 0 or otherwise the whatever is 
in the ring will be executed first.

>   		amdgpu_ring_clear_ring(ring);

Which would explain why we need that here as well.

Christian.

>   	}
>   	return 0;



More information about the amd-gfx mailing list