<div dir="ltr"><div>It's correct according to our documentation.<br></div><div><br></div><div>Reviewed-by: Marek Olšák <<a href="mailto:marek.olsak@amd.com" target="_blank">marek.olsak@amd.com</a>></div><div><br></div><div>Marek<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Dec 8, 2023 at 5:47 AM Christian König <<a href="mailto:christian.koenig@amd.com" target="_blank">christian.koenig@amd.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Well longer story short Alex and I have been digging up the <br>
documentation for this and as far as we can tell this isn't correct.<br>
<br>
You need to do quite a bit more before you can turn on this feature. <br>
What userspace side do you refer to?<br>
<br>
Regards,<br>
Christian.<br>
<br>
Am 08.12.23 um 09:19 schrieb Friedrich Vock:<br>
> Friendly ping on this one.<br>
> Userspace side got merged, so would be great to land this patch too :)<br>
><br>
> On 02.12.23 01:17, Friedrich Vock wrote:<br>
>> This improves latency if the GPU is already busy with other work.<br>
>> This is useful for VR compositors that submit highly latency-sensitive<br>
>> compositing work on high-priority compute queues while the GPU is busy<br>
>> rendering the next frame.<br>
>><br>
>> Userspace merge request:<br>
>> <a href="https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26462" rel="noreferrer" target="_blank">https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26462</a><br>
>><br>
>> Signed-off-by: Friedrich Vock <<a href="mailto:friedrich.vock@gmx.de" target="_blank">friedrich.vock@gmx.de</a>><br>
>> ---<br>
>>   drivers/gpu/drm/amd/amdgpu/amdgpu.h      |  1 +<br>
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 10 ++++++----<br>
>>   drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c   |  3 ++-<br>
>>   drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c   |  3 ++-<br>
>>   4 files changed, 11 insertions(+), 6 deletions(-)<br>
>><br>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h <br>
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
>> index 9505dc8f9d69..4b923a156c4e 100644<br>
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
>> @@ -790,6 +790,7 @@ struct amdgpu_mqd_prop {<br>
>>       uint64_t eop_gpu_addr;<br>
>>       uint32_t hqd_pipe_priority;<br>
>>       uint32_t hqd_queue_priority;<br>
>> +    bool allow_tunneling;<br>
>>       bool hqd_active;<br>
>>   };<br>
>><br>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c <br>
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c<br>
>> index 231d49132a56..4d98e8879be8 100644<br>
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c<br>
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c<br>
>> @@ -620,6 +620,10 @@ static void amdgpu_ring_to_mqd_prop(struct <br>
>> amdgpu_ring *ring,<br>
>>                       struct amdgpu_mqd_prop *prop)<br>
>>   {<br>
>>       struct amdgpu_device *adev = ring->adev;<br>
>> +    bool is_high_prio_compute = ring->funcs->type == <br>
>> AMDGPU_RING_TYPE_COMPUTE &&<br>
>> + amdgpu_gfx_is_high_priority_compute_queue(adev, ring);<br>
>> +    bool is_high_prio_gfx = ring->funcs->type == <br>
>> AMDGPU_RING_TYPE_GFX &&<br>
>> + amdgpu_gfx_is_high_priority_graphics_queue(adev, ring);<br>
>><br>
>>       memset(prop, 0, sizeof(*prop));<br>
>><br>
>> @@ -637,10 +641,8 @@ static void amdgpu_ring_to_mqd_prop(struct <br>
>> amdgpu_ring *ring,<br>
>>        */<br>
>>       prop->hqd_active = ring->funcs->type == AMDGPU_RING_TYPE_KIQ;<br>
>><br>
>> -    if ((ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE &&<br>
>> -         amdgpu_gfx_is_high_priority_compute_queue(adev, ring)) ||<br>
>> -        (ring->funcs->type == AMDGPU_RING_TYPE_GFX &&<br>
>> -         amdgpu_gfx_is_high_priority_graphics_queue(adev, ring))) {<br>
>> +    prop->allow_tunneling = is_high_prio_compute;<br>
>> +    if (is_high_prio_compute || is_high_prio_gfx) {<br>
>>           prop->hqd_pipe_priority = AMDGPU_GFX_PIPE_PRIO_HIGH;<br>
>>           prop->hqd_queue_priority = AMDGPU_GFX_QUEUE_PRIORITY_MAXIMUM;<br>
>>       }<br>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c <br>
>> b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c<br>
>> index c8a3bf01743f..73f6d7e72c73 100644<br>
>> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c<br>
>> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c<br>
>> @@ -6593,7 +6593,8 @@ static int gfx_v10_0_compute_mqd_init(struct <br>
>> amdgpu_device *adev, void *m,<br>
>>       tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, ENDIAN_SWAP, 1);<br>
>>   #endif<br>
>>       tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, UNORD_DISPATCH, 0);<br>
>> -    tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, TUNNEL_DISPATCH, 0);<br>
>> +    tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, TUNNEL_DISPATCH,<br>
>> +                prop->allow_tunneling);<br>
>>       tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, PRIV_STATE, 1);<br>
>>       tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, KMD_QUEUE, 1);<br>
>>       mqd->cp_hqd_pq_control = tmp;<br>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c <br>
>> b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c<br>
>> index c659ef0f47ce..bdcf96df69e6 100644<br>
>> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c<br>
>> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c<br>
>> @@ -3847,7 +3847,8 @@ static int gfx_v11_0_compute_mqd_init(struct <br>
>> amdgpu_device *adev, void *m,<br>
>>       tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, RPTR_BLOCK_SIZE,<br>
>>                   (order_base_2(AMDGPU_GPU_PAGE_SIZE / 4) - 1));<br>
>>       tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, UNORD_DISPATCH, 0);<br>
>> -    tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, TUNNEL_DISPATCH, 0);<br>
>> +    tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, TUNNEL_DISPATCH,<br>
>> +                prop->allow_tunneling);<br>
>>       tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, PRIV_STATE, 1);<br>
>>       tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, KMD_QUEUE, 1);<br>
>>       mqd->cp_hqd_pq_control = tmp;<br>
>> -- <br>
>> 2.43.0<br>
>><br>
<br>
</blockquote></div>