@@ -1267,6 +1267,8 @@ int psp_xgmi_initialize(struct psp_context *psp, bool set_extended_data, bool lo
1267
1267
xgmi_cmd -> cmd_id = TA_COMMAND_XGMI__INITIALIZE ;
1268
1268
1269
1269
ret = psp_xgmi_invoke (psp , xgmi_cmd -> cmd_id );
1270
+ /* note down the capbility flag for XGMI TA */
1271
+ psp -> xgmi_context .xgmi_ta_caps = xgmi_cmd -> caps_flag ;
1270
1272
1271
1273
return ret ;
1272
1274
}
@@ -1425,35 +1427,52 @@ int psp_xgmi_get_topology_info(struct psp_context *psp,
1425
1427
/* Invoke xgmi ta again to get the link information */
1426
1428
if (psp_xgmi_peer_link_info_supported (psp )) {
1427
1429
struct ta_xgmi_cmd_get_peer_link_info * link_info_output ;
1430
+ struct ta_xgmi_cmd_get_extend_peer_link_info * link_extend_info_output ;
1428
1431
bool requires_reflection =
1429
1432
(psp -> xgmi_context .supports_extended_data &&
1430
1433
get_extended_data ) ||
1431
1434
amdgpu_ip_version (psp -> adev , MP0_HWIP , 0 ) ==
1432
1435
IP_VERSION (13 , 0 , 6 );
1436
+ bool ta_port_num_support = psp -> xgmi_context .xgmi_ta_caps &
1437
+ EXTEND_PEER_LINK_INFO_CMD_FLAG ;
1433
1438
1434
- link_info_output = & xgmi_cmd -> xgmi_out_message .get_link_info ;
1435
1439
/* popluate the shared output buffer rather than the cmd input buffer
1436
1440
* with node_ids as the input for GET_PEER_LINKS command execution.
1437
- * This is required for GET_PEER_LINKS only per xgmi ta implementation
1441
+ * This is required for GET_PEER_LINKS per xgmi ta implementation.
1442
+ * The same requirement for GET_EXTEND_PEER_LINKS command.
1438
1443
*/
1439
- for (i = 0 ; i < topology -> num_nodes ; i ++ ) {
1440
- link_info_output -> nodes [i ].node_id = topology -> nodes [i ].node_id ;
1441
- }
1442
- link_info_output -> num_nodes = topology -> num_nodes ;
1444
+ if (ta_port_num_support ) {
1445
+ link_extend_info_output = & xgmi_cmd -> xgmi_out_message .get_extend_link_info ;
1446
+
1447
+ for (i = 0 ; i < topology -> num_nodes ; i ++ )
1448
+ link_extend_info_output -> nodes [i ].node_id = topology -> nodes [i ].node_id ;
1449
+
1450
+ link_extend_info_output -> num_nodes = topology -> num_nodes ;
1451
+ xgmi_cmd -> cmd_id = TA_COMMAND_XGMI__GET_EXTEND_PEER_LINKS ;
1452
+ } else {
1453
+ link_info_output = & xgmi_cmd -> xgmi_out_message .get_link_info ;
1443
1454
1444
- xgmi_cmd -> cmd_id = TA_COMMAND_XGMI__GET_PEER_LINKS ;
1445
- ret = psp_xgmi_invoke ( psp , TA_COMMAND_XGMI__GET_PEER_LINKS ) ;
1455
+ for ( i = 0 ; i < topology -> num_nodes ; i ++ )
1456
+ link_info_output -> nodes [ i ]. node_id = topology -> nodes [ i ]. node_id ;
1446
1457
1458
+ link_info_output -> num_nodes = topology -> num_nodes ;
1459
+ xgmi_cmd -> cmd_id = TA_COMMAND_XGMI__GET_PEER_LINKS ;
1460
+ }
1461
+
1462
+ ret = psp_xgmi_invoke (psp , xgmi_cmd -> cmd_id );
1447
1463
if (ret )
1448
1464
return ret ;
1449
1465
1450
1466
for (i = 0 ; i < topology -> num_nodes ; i ++ ) {
1467
+ uint8_t node_num_links = ta_port_num_support ?
1468
+ link_extend_info_output -> nodes [i ].num_links : link_info_output -> nodes [i ].num_links ;
1451
1469
/* accumulate num_links on extended data */
1452
- topology -> nodes [i ].num_links = get_extended_data ?
1453
- topology -> nodes [i ].num_links +
1454
- link_info_output -> nodes [i ].num_links :
1455
- ((requires_reflection && topology -> nodes [i ].num_links ) ? topology -> nodes [i ].num_links :
1456
- link_info_output -> nodes [i ].num_links );
1470
+ if (get_extended_data ) {
1471
+ topology -> nodes [i ].num_links = topology -> nodes [i ].num_links + node_num_links ;
1472
+ } else {
1473
+ topology -> nodes [i ].num_links = (requires_reflection && topology -> nodes [i ].num_links ) ?
1474
+ topology -> nodes [i ].num_links : node_num_links ;
1475
+ }
1457
1476
1458
1477
/* reflect the topology information for bi-directionality */
1459
1478
if (requires_reflection && topology -> nodes [i ].num_hops )
0 commit comments