Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: update the xgmi ta interface header

Update the header file to the v20.00.00.13

v1: rename TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO to
TA_COMMAND_XGMI__GET_TOPOLOGY_INFO

And also rename struct ta_xgmi_cmd_get_peer_link_info_output to
ta_xgmi_cmd_get_peer_link_info accordingly

v2: add structs to support xgmi GET_EXTEND_PEER_LINK command

Signed-off-by: Shiwu Zhang <shiwu.zhang@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Shiwu Zhang and committed by
Alex Deucher
626121fc 8096df76

+52 -18
+3 -3
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
··· 1388 1388 1389 1389 /* Fill in the shared memory with topology information as input */ 1390 1390 topology_info_input = &xgmi_cmd->xgmi_in_message.get_topology_info; 1391 - xgmi_cmd->cmd_id = TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO; 1391 + xgmi_cmd->cmd_id = TA_COMMAND_XGMI__GET_TOPOLOGY_INFO; 1392 1392 topology_info_input->num_nodes = number_devices; 1393 1393 1394 1394 for (i = 0; i < topology_info_input->num_nodes; i++) { ··· 1399 1399 } 1400 1400 1401 1401 /* Invoke xgmi ta to get the topology information */ 1402 - ret = psp_xgmi_invoke(psp, TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO); 1402 + ret = psp_xgmi_invoke(psp, TA_COMMAND_XGMI__GET_TOPOLOGY_INFO); 1403 1403 if (ret) 1404 1404 return ret; 1405 1405 ··· 1424 1424 1425 1425 /* Invoke xgmi ta again to get the link information */ 1426 1426 if (psp_xgmi_peer_link_info_supported(psp)) { 1427 - struct ta_xgmi_cmd_get_peer_link_info_output *link_info_output; 1427 + struct ta_xgmi_cmd_get_peer_link_info *link_info_output; 1428 1428 bool requires_reflection = 1429 1429 (psp->xgmi_context.supports_extended_data && 1430 1430 get_extended_data) ||
+49 -15
drivers/gpu/drm/amd/amdgpu/ta_xgmi_if.h
··· 1 1 /* 2 - * Copyright 2018 Advanced Micro Devices, Inc. 2 + * Copyright 2018-2022 Advanced Micro Devices, Inc. 3 3 * 4 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 5 * copy of this software and associated documentation files (the "Software"), ··· 20 20 * OTHER DEALINGS IN THE SOFTWARE. 21 21 * 22 22 */ 23 - 24 23 #ifndef _TA_XGMI_IF_H 25 24 #define _TA_XGMI_IF_H 26 25 ··· 27 28 #define RSP_ID_MASK (1U << 31) 28 29 #define RSP_ID(cmdId) (((uint32_t)(cmdId)) | RSP_ID_MASK) 29 30 31 + #define EXTEND_PEER_LINK_INFO_CMD_FLAG 1 32 + 30 33 enum ta_command_xgmi { 34 + /* Initialize the Context and Session Topology */ 31 35 TA_COMMAND_XGMI__INITIALIZE = 0x00, 36 + /* Gets the current GPU's node ID */ 32 37 TA_COMMAND_XGMI__GET_NODE_ID = 0x01, 38 + /* Gets the current GPU's hive ID */ 33 39 TA_COMMAND_XGMI__GET_HIVE_ID = 0x02, 34 - TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO = 0x03, 40 + /* Gets the Peer's topology Information */ 41 + TA_COMMAND_XGMI__GET_TOPOLOGY_INFO = 0x03, 42 + /* Sets the Peer's topology Information */ 35 43 TA_COMMAND_XGMI__SET_TOPOLOGY_INFO = 0x04, 36 - TA_COMMAND_XGMI__GET_PEER_LINKS = 0x0B 44 + /* Gets the total links between adjacent peer dies in hive */ 45 + TA_COMMAND_XGMI__GET_PEER_LINKS = 0x0B, 46 + /* Gets the total links and connected port numbers between adjacent peer dies in hive */ 47 + TA_COMMAND_XGMI__GET_EXTEND_PEER_LINKS = 0x0C 37 48 }; 38 49 39 50 /* XGMI related enumerations */ 40 51 /**********************************************************/; 41 - enum ta_xgmi_connected_nodes { 42 - TA_XGMI__MAX_CONNECTED_NODES = 64 43 - }; 52 + enum { TA_XGMI__MAX_CONNECTED_NODES = 64 }; 53 + enum { TA_XGMI__MAX_INTERNAL_STATE = 32 }; 54 + enum { TA_XGMI__MAX_INTERNAL_STATE_BUFFER = 128 }; 55 + enum { TA_XGMI__MAX_PORT_NUM = 8 }; 44 56 45 57 enum ta_xgmi_status { 46 58 TA_XGMI_STATUS__SUCCESS = 0x00, ··· 91 81 uint8_t num_links; 92 82 }; 93 83 84 + struct xgmi_connected_port_num { 85 + uint8_t dst_xgmi_port_num; 86 + uint8_t src_xgmi_port_num; 87 + }; 88 + 89 + /* support both the port num and num_links */ 90 + struct ta_xgmi_extend_peer_link_info { 91 + uint64_t node_id; 92 + uint8_t num_links; 93 + struct xgmi_connected_port_num port_num[TA_XGMI__MAX_PORT_NUM]; 94 + }; 95 + 94 96 struct ta_xgmi_cmd_initialize_output { 95 97 uint32_t status; 96 98 }; ··· 125 103 struct ta_xgmi_node_info nodes[TA_XGMI__MAX_CONNECTED_NODES]; 126 104 }; 127 105 128 - struct ta_xgmi_cmd_get_peer_link_info_output { 129 - uint32_t num_nodes; 130 - struct ta_xgmi_peer_link_info nodes[TA_XGMI__MAX_CONNECTED_NODES]; 131 - }; 132 - 133 106 struct ta_xgmi_cmd_set_topology_info_input { 134 107 uint32_t num_nodes; 135 108 struct ta_xgmi_node_info nodes[TA_XGMI__MAX_CONNECTED_NODES]; 136 109 }; 137 110 111 + /* support XGMI TA w/ and w/o port_num both so two similar structs defined */ 112 + struct ta_xgmi_cmd_get_peer_link_info { 113 + uint32_t num_nodes; 114 + struct ta_xgmi_peer_link_info nodes[TA_XGMI__MAX_CONNECTED_NODES]; 115 + }; 116 + 117 + struct ta_xgmi_cmd_get_extend_peer_link_info { 118 + uint32_t num_nodes; 119 + struct ta_xgmi_extend_peer_link_info nodes[TA_XGMI__MAX_CONNECTED_NODES]; 120 + }; 138 121 /**********************************************************/ 139 122 /* Common input structure for XGMI callbacks */ 140 123 union ta_xgmi_cmd_input { ··· 153 126 struct ta_xgmi_cmd_get_node_id_output get_node_id; 154 127 struct ta_xgmi_cmd_get_hive_id_output get_hive_id; 155 128 struct ta_xgmi_cmd_get_topology_info_output get_topology_info; 156 - struct ta_xgmi_cmd_get_peer_link_info_output get_link_info; 129 + struct ta_xgmi_cmd_get_peer_link_info get_link_info; 130 + struct ta_xgmi_cmd_get_extend_peer_link_info get_extend_link_info; 157 131 }; 158 - /**********************************************************/ 159 132 160 133 struct ta_xgmi_shared_memory { 161 134 uint32_t cmd_id; 162 135 uint32_t resp_id; 163 136 enum ta_xgmi_status xgmi_status; 137 + 138 + /* if the number of xgmi link record is more than 128, driver will set the 139 + * flag 0 to get the first 128 of the link records and will set to 1, to get 140 + * the second set 141 + */ 164 142 uint8_t flag_extend_link_record; 165 - uint8_t reserved0[3]; 143 + /* bit0: port_num info support flag for GET_EXTEND_PEER_LINKS commmand */ 144 + uint8_t caps_flag; 145 + uint8_t reserved[2]; 166 146 union ta_xgmi_cmd_input xgmi_in_message; 167 147 union ta_xgmi_cmd_output xgmi_out_message; 168 148 };