@@ -142,13 +142,14 @@ static const char *mes_v12_0_get_misc_op_string(union MESAPI__MISC *x_pkt)
142
142
}
143
143
144
144
static 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 )
147
147
{
148
148
union MESAPI__QUERY_MES_STATUS mes_status_pkt ;
149
149
signed long timeout = 3000000 ; /* 3000 ms */
150
150
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 ];
152
153
struct MES_API_STATUS * api_status ;
153
154
union MESAPI__MISC * x_pkt = pkt ;
154
155
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,
177
178
status_ptr = (u64 * )& adev -> wb .wb [status_offset ];
178
179
* status_ptr = 0 ;
179
180
180
- spin_lock_irqsave (& mes -> ring_lock [ 0 ] , flags );
181
+ spin_lock_irqsave (ring_lock , flags );
181
182
r = amdgpu_ring_alloc (ring , (size + sizeof (mes_status_pkt )) / 4 );
182
183
if (r )
183
184
goto error_unlock_free ;
@@ -207,32 +208,33 @@ static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes,
207
208
sizeof (mes_status_pkt ) / 4 );
208
209
209
210
amdgpu_ring_commit (ring );
210
- spin_unlock_irqrestore (& mes -> ring_lock [ 0 ] , flags );
211
+ spin_unlock_irqrestore (ring_lock , flags );
211
212
212
213
op_str = mes_v12_0_get_op_string (x_pkt );
213
214
misc_op_str = mes_v12_0_get_misc_op_string (x_pkt );
214
215
215
216
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 );
218
219
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 );
220
222
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 );
223
225
224
226
r = amdgpu_fence_wait_polling (ring , seq , timeout );
225
227
if (r < 1 || !* status_ptr ) {
226
228
227
229
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 );
230
232
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 );
233
235
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 );
236
238
237
239
while (halt_if_hws_hang )
238
240
schedule ();
@@ -249,7 +251,7 @@ static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes,
249
251
amdgpu_ring_undo (ring );
250
252
251
253
error_unlock_free :
252
- spin_unlock_irqrestore (& mes -> ring_lock [ 0 ] , flags );
254
+ spin_unlock_irqrestore (ring_lock , flags );
253
255
254
256
error_wb_free :
255
257
amdgpu_device_wb_free (adev , status_offset );
@@ -321,6 +323,7 @@ static int mes_v12_0_add_hw_queue(struct amdgpu_mes *mes,
321
323
mes_add_queue_pkt .gds_size = input -> queue_size ;
322
324
323
325
return mes_v12_0_submit_pkt_and_poll_completion (mes ,
326
+ AMDGPU_MES_SCHED_PIPE ,
324
327
& mes_add_queue_pkt , sizeof (mes_add_queue_pkt ),
325
328
offsetof(union MESAPI__ADD_QUEUE , api_status ));
326
329
}
@@ -340,6 +343,7 @@ static int mes_v12_0_remove_hw_queue(struct amdgpu_mes *mes,
340
343
mes_remove_queue_pkt .gang_context_addr = input -> gang_context_addr ;
341
344
342
345
return mes_v12_0_submit_pkt_and_poll_completion (mes ,
346
+ AMDGPU_MES_SCHED_PIPE ,
343
347
& mes_remove_queue_pkt , sizeof (mes_remove_queue_pkt ),
344
348
offsetof(union MESAPI__REMOVE_QUEUE , api_status ));
345
349
}
@@ -365,6 +369,7 @@ static int mes_v12_0_map_legacy_queue(struct amdgpu_mes *mes,
365
369
mes_add_queue_pkt .map_legacy_kq = 1 ;
366
370
367
371
return mes_v12_0_submit_pkt_and_poll_completion (mes ,
372
+ AMDGPU_MES_SCHED_PIPE ,
368
373
& mes_add_queue_pkt , sizeof (mes_add_queue_pkt ),
369
374
offsetof(union MESAPI__ADD_QUEUE , api_status ));
370
375
}
@@ -398,6 +403,7 @@ static int mes_v12_0_unmap_legacy_queue(struct amdgpu_mes *mes,
398
403
}
399
404
400
405
return mes_v12_0_submit_pkt_and_poll_completion (mes ,
406
+ AMDGPU_MES_SCHED_PIPE ,
401
407
& mes_remove_queue_pkt , sizeof (mes_remove_queue_pkt ),
402
408
offsetof(union MESAPI__REMOVE_QUEUE , api_status ));
403
409
}
@@ -414,7 +420,7 @@ static int mes_v12_0_resume_gang(struct amdgpu_mes *mes,
414
420
return 0 ;
415
421
}
416
422
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 )
418
424
{
419
425
union MESAPI__QUERY_MES_STATUS mes_status_pkt ;
420
426
@@ -424,7 +430,7 @@ static int mes_v12_0_query_sched_status(struct amdgpu_mes *mes)
424
430
mes_status_pkt .header .opcode = MES_SCH_API_QUERY_SCHEDULER_STATUS ;
425
431
mes_status_pkt .header .dwsize = API_FRAME_SIZE_IN_DWORDS ;
426
432
427
- return mes_v12_0_submit_pkt_and_poll_completion (mes ,
433
+ return mes_v12_0_submit_pkt_and_poll_completion (mes , pipe ,
428
434
& mes_status_pkt , sizeof (mes_status_pkt ),
429
435
offsetof(union MESAPI__QUERY_MES_STATUS , api_status ));
430
436
}
@@ -486,11 +492,12 @@ static int mes_v12_0_misc_op(struct amdgpu_mes *mes,
486
492
}
487
493
488
494
return mes_v12_0_submit_pkt_and_poll_completion (mes ,
495
+ AMDGPU_MES_SCHED_PIPE ,
489
496
& misc_pkt , sizeof (misc_pkt ),
490
497
offsetof(union MESAPI__MISC , api_status ));
491
498
}
492
499
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 )
494
501
{
495
502
union MESAPI_SET_HW_RESOURCES_1 mes_set_hw_res_1_pkt ;
496
503
@@ -501,12 +508,12 @@ static int mes_v12_0_set_hw_resources_1(struct amdgpu_mes *mes)
501
508
mes_set_hw_res_1_pkt .header .dwsize = API_FRAME_SIZE_IN_DWORDS ;
502
509
mes_set_hw_res_1_pkt .mes_kiq_unmap_timeout = 100 ;
503
510
504
- return mes_v12_0_submit_pkt_and_poll_completion (mes ,
511
+ return mes_v12_0_submit_pkt_and_poll_completion (mes , pipe ,
505
512
& mes_set_hw_res_1_pkt , sizeof (mes_set_hw_res_1_pkt ),
506
513
offsetof(union MESAPI_SET_HW_RESOURCES_1 , api_status ));
507
514
}
508
515
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 )
510
517
{
511
518
int i ;
512
519
struct amdgpu_device * adev = mes -> adev ;
@@ -566,7 +573,7 @@ static int mes_v12_0_set_hw_resources(struct amdgpu_mes *mes)
566
573
mes_set_hw_res_pkt .event_intr_history_gpu_mc_ptr = mes -> event_log_gpu_addr ;
567
574
}
568
575
569
- return mes_v12_0_submit_pkt_and_poll_completion (mes ,
576
+ return mes_v12_0_submit_pkt_and_poll_completion (mes , pipe ,
570
577
& mes_set_hw_res_pkt , sizeof (mes_set_hw_res_pkt ),
571
578
offsetof(union MESAPI_SET_HW_RESOURCES , api_status ));
572
579
}
@@ -1446,19 +1453,19 @@ static int mes_v12_0_hw_init(void *handle)
1446
1453
if (r )
1447
1454
goto failure ;
1448
1455
1449
- r = mes_v12_0_set_hw_resources (& adev -> mes );
1456
+ r = mes_v12_0_set_hw_resources (& adev -> mes , AMDGPU_MES_SCHED_PIPE );
1450
1457
if (r )
1451
1458
goto failure ;
1452
1459
1453
1460
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 );
1455
1462
1456
1463
mes_v12_0_init_aggregated_doorbell (& adev -> mes );
1457
1464
1458
1465
/* Enable the MES to handle doorbell ring on unmapped queue */
1459
1466
mes_v12_0_enable_unmapped_doorbell_handling (& adev -> mes , true);
1460
1467
1461
- r = mes_v12_0_query_sched_status (& adev -> mes );
1468
+ r = mes_v12_0_query_sched_status (& adev -> mes , AMDGPU_MES_SCHED_PIPE );
1462
1469
if (r ) {
1463
1470
DRM_ERROR ("MES is busy\n" );
1464
1471
goto failure ;
0 commit comments