@@ -142,13 +142,14 @@ static const char *mes_v12_0_get_misc_op_string(union MESAPI__MISC *x_pkt)
142142}
143143
144144static int mes_v12_0_submit_pkt_and_poll_completion (struct amdgpu_mes * mes ,
145- void * pkt , int size ,
146- int api_status_off )
145+ int pipe , void * pkt , int size ,
146+ int api_status_off )
147147{
148148 union MESAPI__QUERY_MES_STATUS mes_status_pkt ;
149149 signed long timeout = 3000000 ; /* 3000 ms */
150150 struct amdgpu_device * adev = mes -> adev ;
151- struct amdgpu_ring * ring = & mes -> ring [0 ];
151+ struct amdgpu_ring * ring = & mes -> ring [pipe ];
152+ spinlock_t * ring_lock = & mes -> ring_lock [pipe ];
152153 struct MES_API_STATUS * api_status ;
153154 union MESAPI__MISC * x_pkt = pkt ;
154155 const char * op_str , * misc_op_str ;
@@ -177,7 +178,7 @@ static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes,
177178 status_ptr = (u64 * )& adev -> wb .wb [status_offset ];
178179 * status_ptr = 0 ;
179180
180- spin_lock_irqsave (& mes -> ring_lock [ 0 ] , flags );
181+ spin_lock_irqsave (ring_lock , flags );
181182 r = amdgpu_ring_alloc (ring , (size + sizeof (mes_status_pkt )) / 4 );
182183 if (r )
183184 goto error_unlock_free ;
@@ -207,32 +208,33 @@ static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes,
207208 sizeof (mes_status_pkt ) / 4 );
208209
209210 amdgpu_ring_commit (ring );
210- spin_unlock_irqrestore (& mes -> ring_lock [ 0 ] , flags );
211+ spin_unlock_irqrestore (ring_lock , flags );
211212
212213 op_str = mes_v12_0_get_op_string (x_pkt );
213214 misc_op_str = mes_v12_0_get_misc_op_string (x_pkt );
214215
215216 if (misc_op_str )
216- dev_dbg (adev -> dev , "MES msg=%s (%s) was emitted\n" , op_str ,
217- misc_op_str );
217+ dev_dbg (adev -> dev , "MES(%d) msg=%s (%s) was emitted\n" ,
218+ pipe , op_str , misc_op_str );
218219 else if (op_str )
219- dev_dbg (adev -> dev , "MES msg=%s was emitted\n" , op_str );
220+ dev_dbg (adev -> dev , "MES(%d) msg=%s was emitted\n" ,
221+ pipe , op_str );
220222 else
221- dev_dbg (adev -> dev , "MES msg=%d was emitted\n" ,
222- x_pkt -> header .opcode );
223+ dev_dbg (adev -> dev , "MES(%d) msg=%d was emitted\n" ,
224+ pipe , x_pkt -> header .opcode );
223225
224226 r = amdgpu_fence_wait_polling (ring , seq , timeout );
225227 if (r < 1 || !* status_ptr ) {
226228
227229 if (misc_op_str )
228- dev_err (adev -> dev , "MES failed to respond to msg=%s (%s)\n" ,
229- op_str , misc_op_str );
230+ dev_err (adev -> dev , "MES(%d) failed to respond to msg=%s (%s)\n" ,
231+ pipe , op_str , misc_op_str );
230232 else if (op_str )
231- dev_err (adev -> dev , "MES failed to respond to msg=%s\n" ,
232- op_str );
233+ dev_err (adev -> dev , "MES(%d) failed to respond to msg=%s\n" ,
234+ pipe , op_str );
233235 else
234- dev_err (adev -> dev , "MES failed to respond to msg=%d\n" ,
235- x_pkt -> header .opcode );
236+ dev_err (adev -> dev , "MES(%d) failed to respond to msg=%d\n" ,
237+ pipe , x_pkt -> header .opcode );
236238
237239 while (halt_if_hws_hang )
238240 schedule ();
@@ -249,7 +251,7 @@ static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes,
249251 amdgpu_ring_undo (ring );
250252
251253error_unlock_free :
252- spin_unlock_irqrestore (& mes -> ring_lock [ 0 ] , flags );
254+ spin_unlock_irqrestore (ring_lock , flags );
253255
254256error_wb_free :
255257 amdgpu_device_wb_free (adev , status_offset );
@@ -321,6 +323,7 @@ static int mes_v12_0_add_hw_queue(struct amdgpu_mes *mes,
321323 mes_add_queue_pkt .gds_size = input -> queue_size ;
322324
323325 return mes_v12_0_submit_pkt_and_poll_completion (mes ,
326+ AMDGPU_MES_SCHED_PIPE ,
324327 & mes_add_queue_pkt , sizeof (mes_add_queue_pkt ),
325328 offsetof(union MESAPI__ADD_QUEUE , api_status ));
326329}
@@ -340,6 +343,7 @@ static int mes_v12_0_remove_hw_queue(struct amdgpu_mes *mes,
340343 mes_remove_queue_pkt .gang_context_addr = input -> gang_context_addr ;
341344
342345 return mes_v12_0_submit_pkt_and_poll_completion (mes ,
346+ AMDGPU_MES_SCHED_PIPE ,
343347 & mes_remove_queue_pkt , sizeof (mes_remove_queue_pkt ),
344348 offsetof(union MESAPI__REMOVE_QUEUE , api_status ));
345349}
@@ -365,6 +369,7 @@ static int mes_v12_0_map_legacy_queue(struct amdgpu_mes *mes,
365369 mes_add_queue_pkt .map_legacy_kq = 1 ;
366370
367371 return mes_v12_0_submit_pkt_and_poll_completion (mes ,
372+ AMDGPU_MES_SCHED_PIPE ,
368373 & mes_add_queue_pkt , sizeof (mes_add_queue_pkt ),
369374 offsetof(union MESAPI__ADD_QUEUE , api_status ));
370375}
@@ -398,6 +403,7 @@ static int mes_v12_0_unmap_legacy_queue(struct amdgpu_mes *mes,
398403 }
399404
400405 return mes_v12_0_submit_pkt_and_poll_completion (mes ,
406+ AMDGPU_MES_SCHED_PIPE ,
401407 & mes_remove_queue_pkt , sizeof (mes_remove_queue_pkt ),
402408 offsetof(union MESAPI__REMOVE_QUEUE , api_status ));
403409}
@@ -414,7 +420,7 @@ static int mes_v12_0_resume_gang(struct amdgpu_mes *mes,
414420 return 0 ;
415421}
416422
417- static int mes_v12_0_query_sched_status (struct amdgpu_mes * mes )
423+ static int mes_v12_0_query_sched_status (struct amdgpu_mes * mes , int pipe )
418424{
419425 union MESAPI__QUERY_MES_STATUS mes_status_pkt ;
420426
@@ -424,7 +430,7 @@ static int mes_v12_0_query_sched_status(struct amdgpu_mes *mes)
424430 mes_status_pkt .header .opcode = MES_SCH_API_QUERY_SCHEDULER_STATUS ;
425431 mes_status_pkt .header .dwsize = API_FRAME_SIZE_IN_DWORDS ;
426432
427- return mes_v12_0_submit_pkt_and_poll_completion (mes ,
433+ return mes_v12_0_submit_pkt_and_poll_completion (mes , pipe ,
428434 & mes_status_pkt , sizeof (mes_status_pkt ),
429435 offsetof(union MESAPI__QUERY_MES_STATUS , api_status ));
430436}
@@ -486,11 +492,12 @@ static int mes_v12_0_misc_op(struct amdgpu_mes *mes,
486492 }
487493
488494 return mes_v12_0_submit_pkt_and_poll_completion (mes ,
495+ AMDGPU_MES_SCHED_PIPE ,
489496 & misc_pkt , sizeof (misc_pkt ),
490497 offsetof(union MESAPI__MISC , api_status ));
491498}
492499
493- static int mes_v12_0_set_hw_resources_1 (struct amdgpu_mes * mes )
500+ static int mes_v12_0_set_hw_resources_1 (struct amdgpu_mes * mes , int pipe )
494501{
495502 union MESAPI_SET_HW_RESOURCES_1 mes_set_hw_res_1_pkt ;
496503
@@ -501,12 +508,12 @@ static int mes_v12_0_set_hw_resources_1(struct amdgpu_mes *mes)
501508 mes_set_hw_res_1_pkt .header .dwsize = API_FRAME_SIZE_IN_DWORDS ;
502509 mes_set_hw_res_1_pkt .mes_kiq_unmap_timeout = 100 ;
503510
504- return mes_v12_0_submit_pkt_and_poll_completion (mes ,
511+ return mes_v12_0_submit_pkt_and_poll_completion (mes , pipe ,
505512 & mes_set_hw_res_1_pkt , sizeof (mes_set_hw_res_1_pkt ),
506513 offsetof(union MESAPI_SET_HW_RESOURCES_1 , api_status ));
507514}
508515
509- static int mes_v12_0_set_hw_resources (struct amdgpu_mes * mes )
516+ static int mes_v12_0_set_hw_resources (struct amdgpu_mes * mes , int pipe )
510517{
511518 int i ;
512519 struct amdgpu_device * adev = mes -> adev ;
@@ -566,7 +573,7 @@ static int mes_v12_0_set_hw_resources(struct amdgpu_mes *mes)
566573 mes_set_hw_res_pkt .event_intr_history_gpu_mc_ptr = mes -> event_log_gpu_addr ;
567574 }
568575
569- return mes_v12_0_submit_pkt_and_poll_completion (mes ,
576+ return mes_v12_0_submit_pkt_and_poll_completion (mes , pipe ,
570577 & mes_set_hw_res_pkt , sizeof (mes_set_hw_res_pkt ),
571578 offsetof(union MESAPI_SET_HW_RESOURCES , api_status ));
572579}
@@ -1446,19 +1453,19 @@ static int mes_v12_0_hw_init(void *handle)
14461453 if (r )
14471454 goto failure ;
14481455
1449- r = mes_v12_0_set_hw_resources (& adev -> mes );
1456+ r = mes_v12_0_set_hw_resources (& adev -> mes , AMDGPU_MES_SCHED_PIPE );
14501457 if (r )
14511458 goto failure ;
14521459
14531460 if (adev -> enable_uni_mes )
1454- mes_v12_0_set_hw_resources_1 (& adev -> mes );
1461+ mes_v12_0_set_hw_resources_1 (& adev -> mes , AMDGPU_MES_SCHED_PIPE );
14551462
14561463 mes_v12_0_init_aggregated_doorbell (& adev -> mes );
14571464
14581465 /* Enable the MES to handle doorbell ring on unmapped queue */
14591466 mes_v12_0_enable_unmapped_doorbell_handling (& adev -> mes , true);
14601467
1461- r = mes_v12_0_query_sched_status (& adev -> mes );
1468+ r = mes_v12_0_query_sched_status (& adev -> mes , AMDGPU_MES_SCHED_PIPE );
14621469 if (r ) {
14631470 DRM_ERROR ("MES is busy\n" );
14641471 goto failure ;
0 commit comments