]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amdgpu: pass queue size and is_aql_queue to MES
authorGraham Sider <Graham.Sider@amd.com>
Mon, 19 Sep 2022 17:57:14 +0000 (13:57 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 27 Sep 2022 21:54:12 +0000 (17:54 -0400)
Update mes_v11_api_def.h add_queue API with is_aql_queue parameter. Also
re-use gds_size for the queue size (unused for KFD). MES requires the
queue size in order to compute the actual wptr offset within the queue
RB since it increases monotonically for AQL queues.

v2: Make is_aql_queue assign clearer

Signed-off-by: Graham Sider <Graham.Sider@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
drivers/gpu/drm/amd/include/mes_v11_api_def.h

index 7b46f6bf41875fea422aea1576927c56da89a9be..ad980f4b66e19143899169cc83e19d0e7c1efdf7 100644 (file)
@@ -222,6 +222,8 @@ struct mes_add_queue_input {
        uint64_t        tba_addr;
        uint64_t        tma_addr;
        uint32_t        is_kfd_process;
+       uint32_t        is_aql_queue;
+       uint32_t        queue_size;
 };
 
 struct mes_remove_queue_input {
index cc3fdbbcd3140ae6acc77d06e7994eb4fb7446e7..f92744b8d79dfcfc7c0b5536e50c7e4ce0be8661 100644 (file)
@@ -185,6 +185,10 @@ static int mes_v11_0_add_hw_queue(struct amdgpu_mes *mes,
        mes_add_queue_pkt.is_kfd_process = input->is_kfd_process;
        mes_add_queue_pkt.trap_en = 1;
 
+       /* For KFD, gds_size is re-used for queue size (needed in MES for AQL queues) */
+       mes_add_queue_pkt.is_aql_queue = input->is_aql_queue;
+       mes_add_queue_pkt.gds_size = input->queue_size;
+
        return mes_v11_0_submit_pkt_and_poll_completion(mes,
                        &mes_add_queue_pkt, sizeof(mes_add_queue_pkt),
                        offsetof(union MESAPI__ADD_QUEUE, api_status));
index e83725a281068b74ffa7d5f5870826329ce7e8e3..007a3db69df13a3069297171216c4c7594301a2b 100644 (file)
@@ -205,6 +205,8 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q,
        }
 
        queue_input.is_kfd_process = 1;
+       queue_input.is_aql_queue = (q->properties.format == KFD_QUEUE_FORMAT_AQL);
+       queue_input.queue_size = q->properties.queue_size >> 2;
 
        queue_input.paging = false;
        queue_input.tba_addr = qpd->tba_addr;
index 50bfa513cb35a618d281aff3b8e42fa14e79e844..7e85cdc5bd34ea842120ecfe11b5bf319725be1b 100644 (file)
@@ -269,7 +269,8 @@ union MESAPI__ADD_QUEUE {
                        uint32_t map_kiq_utility_queue  : 1;
                        uint32_t is_kfd_process         : 1;
                        uint32_t trap_en                : 1;
-                       uint32_t reserved               : 21;
+                       uint32_t is_aql_queue           : 1;
+                       uint32_t reserved               : 20;
                };
                struct MES_API_STATUS           api_status;
                uint64_t                        tma_addr;