On 6/11/26 10:33, Prike Liang wrote:
> Initialize the userq xcp_id.
> 
> Signed-off-by: Prike Liang <[email protected]>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> index 3d6b1cfeca24..c1175cb6d242 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> @@ -585,6 +585,17 @@ static int amdgpu_userq_priority_permit(struct drm_file 
> *filp,
>       return -EACCES;
>  }
>  
> +
> +static u32 amdgpu_userq_get_xcp_id(struct amdgpu_fpriv *fpriv)

I don't think we need a separate function for this, just inline it below.

> +{
> +     /*
> +      * The enforce-isolation userq path uses idx 0 for non-partitioned
> +      * devices, matching the gfx ring isolation handling.
> +      */
> +     return fpriv->xcp_id == AMDGPU_XCP_NO_PARTITION ? 0 :
> +                                                    fpriv->xcp_id;

That can be shortened into fpriv->xcp_id != AMDGPU_XCP_NO_PARTITION ?: 0;

> +}
> +
>  static int
>  amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args)
>  {
> @@ -629,6 +640,7 @@ amdgpu_userq_create(struct drm_file *filp, union 
> drm_amdgpu_userq *args)
>       queue->queue_type = args->in.ip_type;
>       queue->vm = &fpriv->vm;
>       queue->priority = priority;
> +     queue->xcp_id = amdgpu_userq_get_xcp_id(fpriv);
>       queue->userq_mgr = uq_mgr;
>       INIT_DELAYED_WORK(&queue->hang_detect_work,
>                         amdgpu_userq_hang_detect_work);

Reply via email to