drm/amdgpu/mes: change gfx_hqd mask set for mes v12_1
Subsystems (2)
Alex Deucher
maintainerPATCH 1/4 drm/amdgpu/mes: change gfx_hqd mask set for mes v12_1
From: Likun Gao <[email protected]>
Use mes->gfx_hqd_mask to set gfx_hqd_mask on mes hw res pkt for mes v12_1 just same as other mes ip.
--- drivers/gpu/drm/amd/amdgpu/mes_v12_1.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_v12_1.c +3 -12
@@ -633,17 +633,6 @@ static int mes_v12_1_set_hw_resources_1(struct amdgpu_mes *mes, offsetof(union MESAPI_SET_HW_RESOURCES_1, api_status)); } -static void mes_v12_1_set_gfx_hqd_mask (union MESAPI_SET_HW_RESOURCES *pkt) -{ -/* -* GFX V12 has only one GFX pipe, but 8 queues in it. -* GFX pipe 0 queue 0 is being used by Kernel queue. -* Set GFX pipe 0 queue 1-7 for MES scheduling -* mask = 1111 1110b -*/ - pkt->gfx_hqd_mask[0 ] =0xFE ; -} -static int mes_v12_1_set_hw_resources (struct amdgpu_mes *mes,int pipe,int xcc_id) {
@@ -667,7 +656,9 @@ static int mes_v12_1_set_hw_resources(struct amdgpu_mes *mes, mes_set_hw_res_pkt.compute_hqd_mask[i] = mes->compute_hqd_mask[i]; -mes_v12_1_set_gfx_hqd_mask (&mes_set_hw_res_pkt); +for (i =0 ; i <MAX_GFX_PIPES ; i++) + mes_set_hw_res_pkt.gfx_hqd_mask[i] = + mes->gfx_hqd_mask[i];for (i =0 ; i <MAX_SDMA_PIPES ; i++) mes_set_hw_res_pkt.sdma_hqd_mask[i] =
Signature · 1 line
2.53.0
Alex Deucher
maintainerPATCH 2/4 drm/amd/amdgpu : Distribute inv_tlbs on individual XCC
From: Shaoyun Liu <[email protected]>
From MES version 0x74 and above, pipe 1(kiq) support use the shared command buffer to distribute the tasks among the xccs within the same partition. It's more efficient for tlb invalidation been done individually on the each XCC at the same time compare to let master xcc loop all xccs.
This requires the coop_mode been set before kiq set_hw_resource.
--- drivers/gpu/drm/amd/amdgpu/mes_v12_1.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_v12_1.c +11 -8
@@ -44,6 +44,7 @@ static int mes_v12_1_hw_fini(struct amdgpu_ip_block *ip_block);static int mes_v12_1_kiq_hw_init (struct amdgpu_device *adev,uint32_t xcc_id);static int mes_v12_1_kiq_hw_fini (struct amdgpu_device *adev,uint32_t xcc_id);static int mes_v12_1_self_test (struct amdgpu_device *adev,int xcc_id); +static int mes_v12_1_setup_coop_mode (struct amdgpu_device *adev,int xcc_id);#define MES_EOP_SIZE 2048
@@ -621,11 +622,15 @@ static int mes_v12_1_set_hw_resources_1(struct amdgpu_mes *mes, mes_set_hw_res_1_pkt.header.dwsize =API_FRAME_SIZE_IN_DWORDS ; mes_set_hw_res_1_pkt.mes_kiq_unmap_timeout =100 ; -if (mes->enable_coop_mode && pipe ==AMDGPU_MES_SCHED_PIPE ) { +/* From version 0x74 above, pipe1 support use shared command buffer +to distribute some tasks on individual XCCs*/ +if (mes->enable_coop_mode && + ((pipe ==AMDGPU_MES_SCHED_PIPE ) || + ((mes->sched_version &AMDGPU_MES_VERSION_MASK ) >=0x74 ))) { master_xcc_id = mes->master_xcc_ids[inst]; mes_set_hw_res_1_pkt.mes_coop_mode =1 ; mes_set_hw_res_1_pkt.coop_sch_shared_mc_addr = - mes->shared_cmd_buf_gpu_addr[master_xcc_id]; + mes->shared_cmd_buf_gpu_addr[master_xcc_id + pipe]; } return mes_v12_1_submit_pkt_and_poll_completion(mes, xcc_id, pipe,
@@ -1148,9 +1153,6 @@ static int mes_v12_1_allocate_shared_cmd_buf(struct amdgpu_device *adev, {int r, inst =MES_PIPE_INST (xcc_id, pipe); -if (pipe ==AMDGPU_MES_KIQ_PIPE ) -return 0 ; - r = amdgpu_bo_create_kernel(adev, PAGE_SIZE, PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM, &adev->mes.shared_cmd_buf_obj[inst],
@@ -1714,6 +1716,10 @@ static int mes_v12_1_kiq_hw_init(struct amdgpu_device *adev, uint32_t xcc_id) goto failure;if (adev->enable_uni_mes) { + r =mes_v12_1_setup_coop_mode (adev, xcc_id); +if (r) + goto failure; + r =mes_v12_1_set_hw_resources (&adev->mes,AMDGPU_MES_KIQ_PIPE , xcc_id);if (r)
@@ -1836,9 +1842,6 @@ static int mes_v12_1_xcc_hw_init(struct amdgpu_ip_block *ip_block, int xcc_id) goto failure;if (adev->enable_uni_mes) { - r =mes_v12_1_setup_coop_mode (adev, xcc_id); -if (r) - goto failure;mes_v12_1_set_hw_resources_1 (&adev->mes,AMDGPU_MES_SCHED_PIPE , xcc_id); }
Signature · 1 line
2.53.0
Alex Deucher
maintainerPATCH 3/4 drm/amdgpu: Move get mes version info to the end of set_hw_resource
In reply to Alex DeucherFrom: Shaoyun Liu <[email protected]>
After init mes queue, it require some time for mes to execute init code including setup version info in CP_MES_GP3 register. Put it after first MES call(set_hw_resource package).
--- drivers/gpu/drm/amd/amdgpu/mes_v12_1.c | 32 ++++++++++++++------------ 1 file changed, 17 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_v12_1.c +17 -15
@@ -626,7 +626,7 @@ static int mes_v12_1_set_hw_resources_1(struct amdgpu_mes *mes,to distribute some tasks on individual XCCs*/ if (mes->enable_coop_mode && ((pipe ==AMDGPU_MES_SCHED_PIPE ) || - ((mes->sched_version &AMDGPU_MES_VERSION_MASK ) >=0x74 ))) { + ((mes->kiq_version &AMDGPU_MES_VERSION_MASK ) >=0x74 ))) { master_xcc_id = mes->master_xcc_ids[inst]; mes_set_hw_res_1_pkt.mes_coop_mode =1 ; mes_set_hw_res_1_pkt.coop_sch_shared_mc_addr =
@@ -641,7 +641,7 @@ static int mes_v12_1_set_hw_resources_1(struct amdgpu_mes *mes,static int mes_v12_1_set_hw_resources (struct amdgpu_mes *mes,int pipe,int xcc_id) { -int i; +int i, status;struct amdgpu_device *adev = mes->adev;union MESAPI_SET_HW_RESOURCES mes_set_hw_res_pkt;
@@ -711,9 +711,23 @@ static int mes_v12_1_set_hw_resources(struct amdgpu_mes *mes,if (adev->enforce_isolation[0 ] ==AMDGPU_ENFORCE_ISOLATION_ENABLE ) mes_set_hw_res_pkt.limit_single_process =1 ; -return mes_v12_1_submit_pkt_and_poll_completion (mes, xcc_id, pipe, + status =mes_v12_1_submit_pkt_and_poll_completion (mes, xcc_id, pipe, &mes_set_hw_res_pkt,sizeof (mes_set_hw_res_pkt), offsetof(union MESAPI_SET_HW_RESOURCES , api_status)); + +/* get MES scheduler versions */ +mutex_lock (&adev->srbm_mutex); +soc_v1_0_grbm_select (adev,3 , pipe,0 ,0 ,GET_INST (GC , xcc_id)); + +if (pipe ==AMDGPU_MES_SCHED_PIPE ) + adev->mes.sched_version =RREG32_SOC15 (GC ,GET_INST (GC , xcc_id), regCP_MES_GP3_LO); +else if (pipe ==AMDGPU_MES_KIQ_PIPE && adev->enable_mes_kiq) + adev->mes.kiq_version =RREG32_SOC15 (GC ,GET_INST (GC , xcc_id), regCP_MES_GP3_LO); + +soc_v1_0_grbm_select (adev,0 ,0 ,0 ,0 ,GET_INST (GC , xcc_id)); +mutex_unlock (&adev->srbm_mutex); + +return status; } static void mes_v12_1_init_aggregated_doorbell(struct amdgpu_mes *mes,
@@ -1398,18 +1412,6 @@ static int mes_v12_1_queue_init(struct amdgpu_device *adev,mes_v12_1_queue_init_register (ring, xcc_id); } -/* get MES scheduler/KIQ versions */ -mutex_lock (&adev->srbm_mutex); -soc_v1_0_grbm_select (adev,3 , pipe,0 ,0 ,GET_INST (GC , xcc_id)); - -if (pipe ==AMDGPU_MES_SCHED_PIPE ) - adev->mes.sched_version =RREG32_SOC15 (GC ,GET_INST (GC , xcc_id), regCP_MES_GP3_LO); -else if (pipe ==AMDGPU_MES_KIQ_PIPE && adev->enable_mes_kiq) - adev->mes.kiq_version =RREG32_SOC15 (GC ,GET_INST (GC , xcc_id), regCP_MES_GP3_LO); - -soc_v1_0_grbm_select (adev,0 ,0 ,0 ,0 ,GET_INST (GC , xcc_id)); -mutex_unlock (&adev->srbm_mutex); -return 0 ; }
Signature · 1 line
2.53.0
Alex Deucher
maintainerPATCH 4/4 drm/amdgpu: update cp cmd pkt for gfx v12_1 v2
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Update CP command package for gfx v12.1.
1. Update to common command pkg format for PACKET3_ACQUIRE_MEM.
2. Update to definition PACKET3_PRED_EXEC command pkt.
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c | 12 ++-- drivers/gpu/drm/amd/amdgpu/gfx_v12_1_pkt.h | 68 ++++++++++++++-------- 2 files changed, 51 insertions(+), 29 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c +6 -6
@@ -3825,12 +3825,12 @@ static int gfx_v12_1_rlc_poison_irq(struct amdgpu_device *adev,static void gfx_v12_1_emit_mem_sync (struct amdgpu_ring *ring) {const unsigned int gcr_cntl = -PACKET3_ACQUIRE_MEM_GCR_CNTL_GL2_INV (1 ) | -PACKET3_ACQUIRE_MEM_GCR_CNTL_GL2_WB (1 ) | -PACKET3_ACQUIRE_MEM_GCR_CNTL_GLV_INV (1 ) | -PACKET3_ACQUIRE_MEM_GCR_CNTL_GLK_INV (1 ) | -PACKET3_ACQUIRE_MEM_GCR_CNTL_GLI_INV (1 ) | -PACKET3_ACQUIRE_MEM_GCR_CNTL_GL2_SCOPE (2 ); +PACKET3_ACQUIRE_MEM__GCR_CNTL__GL2_INV (1 ) | +PACKET3_ACQUIRE_MEM__GCR_CNTL__GL2_WB (1 ) | +PACKET3_ACQUIRE_MEM__GCR_CNTL__GLV_INV (1 ) | +PACKET3_ACQUIRE_MEM__GCR_CNTL__GLK_INV (1 ) | +PACKET3_ACQUIRE_MEM__GCR_CNTL__GLI_INV (1 ) | +PACKET3_ACQUIRE_MEM__GCR_CNTL__GL2_SCOPE (2 );/* ACQUIRE_MEM - make one or more surfaces valid for use by the subsequent operations */ amdgpu_ring_write (ring,PACKET3 (PACKET3_ACQUIRE_MEM ,6 ));
drivers/gpu/drm/amd/amdgpu/gfx_v12_1_pkt.h +45 -23
109 lines not on this page · raw message
Signature · 1 line
2.53.0