[PATCH 3/7] drm/amdgpu: add mes userq reset callback

Alex Deucher alexdeucher at gmail.com
Thu May 8 16:44:18 UTC 2025


On Wed, May 7, 2025 at 2:55 AM Zhang, Jesse(Jie) <Jesse.Zhang at amd.com> wrote:
>
> [AMD Official Use Only - AMD Internal Distribution Only]
>
> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Alex Deucher
> Sent: Tuesday, May 6, 2025 11:59 PM
> To: amd-gfx at lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher at amd.com>; Koenig, Christian <Christian.Koenig at amd.com>; Khatri, Sunil <Sunil.Khatri at amd.com>
> Subject: [PATCH 3/7] drm/amdgpu: add mes userq reset callback
>
> Used to reset a hung queue.
>
> Reviewed-by: Christian König <christian.koenig at amd.com>
> Reviewed-by: Sunil Khatri <sunil.khatri at amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> index d6f50b13e2ba0..650fdb68db127 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> @@ -347,9 +347,30 @@ mes_userq_mqd_destroy(struct amdgpu_userq_mgr *uq_mgr,
>         amdgpu_userq_destroy_object(uq_mgr, &queue->mqd);  }
>
> +static int mes_userq_reset(struct amdgpu_userq_mgr *uq_mgr,
> +                          struct amdgpu_usermode_queue *queue) {
> +       struct amdgpu_device *adev = uq_mgr->adev;
> +       struct mes_reset_queue_input queue_input;
> +       int r;
> +
> +       memset(&queue_input, 0x0, sizeof(struct mes_reset_queue_input));
> +
> +       queue_input.doorbell_offset = queue->doorbell_index;
> +       queue_input.queue_type = queue->queue_type;
>
> Do we need to set mqd addr and queue wptr  here ?  like this:
>         queue_input.mqd_addr = queue->mqd.gpu_addr;
>         queue_input.wptr_addr = queue->wptr_obj.gpu_addr;

No, those are only valid for kernel queues.

Alex

>
> Thanks
> Jesse
>
> +
> +       amdgpu_mes_lock(&adev->mes);
> +       r = adev->mes.funcs->reset_hw_queue(&adev->mes, &queue_input);
> +       amdgpu_mes_unlock(&adev->mes);
> +       if (r)
> +               dev_err(adev->dev, "Failed to reset queue, err (%d)\n", r);
> +       return r;
> +}
> +
>  const struct amdgpu_userq_funcs userq_mes_funcs = {
>         .mqd_create = mes_userq_mqd_create,
>         .mqd_destroy = mes_userq_mqd_destroy,
>         .unmap = mes_userq_unmap,
>         .map = mes_userq_map,
> +       .reset = mes_userq_reset,
>  };
> --
> 2.49.0
>


More information about the amd-gfx mailing list