On Thu, Jan 22, 2026 at 4:07 AM Jesse.Zhang <[email protected]> wrote:
>
> This patch adds support for updating MQD
> properties for user queues, specifically focusing on CU mask updates.
>
> Signed-off-by: Jesse Zhang <[email protected]>
> ---
>  drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 34 ++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c 
> b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> index f2309d72bbe6..ae221eaa5b82 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> @@ -432,6 +432,39 @@ static int mes_userq_mqd_create(struct 
> amdgpu_usermode_queue *queue,
>         return r;
>  }
>
> +/**
> + * mes_userq_mqd_update - Core MQD update logic for user queues
> + * @queue: Target mes_user_queue structure
> + * @minfo: MQD update information (CU mask/priority etc.)
> + *
> + * Return: 0 on success, negative error code on failure
> + */
> +static int mes_userq_mqd_update(struct amdgpu_usermode_queue *queue,
> +                               struct amdgpu_mqd_update_info *minfo)
> +{
> +       int retval = 0;
> +       struct amdgpu_device *adev = queue->userq_mgr->adev;
> +       struct amdgpu_mqd_prop *props = queue->userq_prop;
> +       struct amdgpu_mqd *mqd_hw_default = &adev->mqds[queue->queue_type];
> +
> +       if (!queue || !props)
> +               return -EINVAL;
> +

Should return an error for non-compute queues.

Alex

> +       if (minfo) {
> +               props->cu_flags = minfo->update_flag;
> +               props->cu_mask_count = minfo->cu_mask.count;
> +               props->cu_mask = minfo->cu_mask.ptr;
> +       }
> +
> +       if (mqd_hw_default->update_mqd)
> +               retval = mqd_hw_default->update_mqd(adev, (void 
> *)queue->mqd.cpu_ptr, props);
> +
> +       if (!retval && minfo)
> +               props->is_user_cu_masked = true;
> +
> +       return retval;
> +}
> +
>  static void mes_userq_mqd_destroy(struct amdgpu_usermode_queue *queue)
>  {
>         struct amdgpu_userq_mgr *uq_mgr = queue->userq_mgr;
> @@ -513,6 +546,7 @@ static int mes_userq_restore(struct amdgpu_usermode_queue 
> *queue)
>
>  const struct amdgpu_userq_funcs userq_mes_funcs = {
>         .mqd_create = mes_userq_mqd_create,
> +       .mqd_update = mes_userq_mqd_update,
>         .mqd_destroy = mes_userq_mqd_destroy,
>         .unmap = mes_userq_unmap,
>         .map = mes_userq_map,
> --
> 2.49.0
>

Reply via email to