[PATCH v2] drm/amdgpu: make mes_userq_unmap as int from void

Khatri, Sunil sukhatri at amd.com
Mon Apr 7 05:58:27 UTC 2025


Ping ?

On 4/2/2025 5:41 PM, Sunil Khatri wrote:
> mes_userq_unmap could fail due to MES fw unable to
> unmap the queue and the return value needs is not
> to be ignored and handled on first step itself.
>
> Also queue->queue_active set to false in this function
> but only when the queue is removed successfully. If the
> queue is not removed successfully then dont change the active
> state of the queue.
>
> Signed-off-by: Sunil Khatri <sunil.khatri at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 16 +++++++++-------
>   1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> index b469b800119f..8f6c12a78f3a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> @@ -144,7 +144,7 @@ static int mes_userq_map(struct amdgpu_userq_mgr *uq_mgr,
>   	return 0;
>   }
>   
> -static void mes_userq_unmap(struct amdgpu_userq_mgr *uq_mgr,
> +static int mes_userq_unmap(struct amdgpu_userq_mgr *uq_mgr,
>   			    struct amdgpu_usermode_queue *queue)
>   {
>   	struct amdgpu_device *adev = uq_mgr->adev;
> @@ -159,9 +159,12 @@ static void mes_userq_unmap(struct amdgpu_userq_mgr *uq_mgr,
>   	amdgpu_mes_lock(&adev->mes);
>   	r = adev->mes.funcs->remove_hw_queue(&adev->mes, &queue_input);
>   	amdgpu_mes_unlock(&adev->mes);
> -	if (r)
> +	if (r) {
>   		DRM_ERROR("Failed to unmap queue in HW, err (%d)\n", r);
> +		return r;
> +	}
>   	queue->queue_active = false;
> +	return 0;
>   }
>   
>   static int mes_userq_create_ctx_space(struct amdgpu_userq_mgr *uq_mgr,
> @@ -345,7 +348,8 @@ mes_userq_mqd_destroy(struct amdgpu_userq_mgr *uq_mgr,
>   	struct amdgpu_device *adev = uq_mgr->adev;
>   
>   	if (queue->queue_active)
> -		mes_userq_unmap(uq_mgr, queue);
> +		if (mes_userq_unmap(uq_mgr, queue))
> +			return;
>   
>   	amdgpu_userqueue_destroy_object(uq_mgr, &queue->fw_obj);
>   	kfree(queue->userq_prop);
> @@ -358,10 +362,8 @@ mes_userq_mqd_destroy(struct amdgpu_userq_mgr *uq_mgr,
>   static int mes_userq_suspend(struct amdgpu_userq_mgr *uq_mgr,
>   				   struct amdgpu_usermode_queue *queue)
>   {
> -	if (queue->queue_active) {
> -		mes_userq_unmap(uq_mgr, queue);
> -		queue->queue_active = false;
> -	}
> +	if (queue->queue_active)
> +		return mes_userq_unmap(uq_mgr, queue);
>   
>   	return 0;
>   }


More information about the amd-gfx mailing list