[PATCH] drm/amdkfd: Preserve cp_hqd_pq_control on update_mqd

Jay Cornwall jay.cornwall at amd.com
Tue Feb 18 21:04:33 UTC 2025


On 2/18/2025 11:24, David Yat Sin wrote:

> --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c
> @@ -167,7 +167,9 @@ static void update_mqd(struct mqd_manager *mm, void *mqd,
>   
>   	m = get_mqd(mqd);
>   
> -	m->cp_hqd_pq_control = 5 << CP_HQD_PQ_CONTROL__RPTR_BLOCK_SIZE__SHIFT;
> +	m->cp_hqd_pq_control |= (5 << CP_HQD_PQ_CONTROL__RPTR_BLOCK_SIZE__SHIFT) &
> +			~CP_HQD_PQ_CONTROL__RPTR_BLOCK_SIZE_MASK;
> +

This would cause changes to the queue size field to OR with older 
values. I think it's not quite what was intended.

I would move the constant field initializations to init_mqd and change 
only this part:

+	m->cp_hqd_pq_control &= ~CP_HQD_PQ_CONTROL__QUEUE_SIZE_MASK;
>   	m->cp_hqd_pq_control |=
>   			ffs(q->queue_size / sizeof(unsigned int)) - 1 - 1


More information about the amd-gfx mailing list