drm/amdgpu: pass queue size and is_aql_queue to MES
Subsystems (3)
PATCH v2 1/1 drm/amdgpu: pass queue size and is_aql_queue to MES
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 <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 2 ++ drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 4 ++++ drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 2 ++ drivers/gpu/drm/amd/include/mes_v11_api_def.h | 3 ++- 4 files changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +2 -0
@@ -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 {
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +4 -0
@@ -187,6 +187,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));
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +2 -0
@@ -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;
drivers/gpu/drm/amd/include/mes_v11_api_def.h +2 -1
@@ -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;
Signature · 1 line
2.25.1
Am 2022-09-22 um 14:02 schrieb Graham Sider:
Quoted 8 lines
Update
mes_v11_api_def.hadd_queueAPI withis_aql_queueparameter. Also re-usegds_sizefor 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_queueassign clearerSigned-off-by Graham Sider <[email protected]>
Reviewed-by Felix Kuehling <[email protected]>
Quoted 62 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 2 ++ drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 4 ++++ drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 2 ++ drivers/gpu/drm/amd/include/mes_v11_api_def.h | 3 ++- 4 files changed, 10 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +2
-0@@ -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 {drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +4
-0@@ -187,6 +187,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));drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +2
-0@@ -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;drivers/gpu/drm/amd/include/mes_v11_api_def.h +2
-1@@ -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;