11/*
2- * Copyright 2018 Advanced Micro Devices, Inc.
2+ * Copyright 2018-2022 Advanced Micro Devices, Inc.
33 *
44 * Permission is hereby granted, free of charge, to any person obtaining a
55 * copy of this software and associated documentation files (the "Software"),
2020 * OTHER DEALINGS IN THE SOFTWARE.
2121 *
2222 */
23-
2423#ifndef _TA_XGMI_IF_H
2524#define _TA_XGMI_IF_H
2625
2726/* Responses have bit 31 set */
2827#define RSP_ID_MASK (1U << 31)
2928#define RSP_ID (cmdId ) (((uint32_t)(cmdId)) | RSP_ID_MASK)
3029
30+ #define EXTEND_PEER_LINK_INFO_CMD_FLAG 1
31+
3132enum ta_command_xgmi {
33+ /* Initialize the Context and Session Topology */
3234 TA_COMMAND_XGMI__INITIALIZE = 0x00 ,
35+ /* Gets the current GPU's node ID */
3336 TA_COMMAND_XGMI__GET_NODE_ID = 0x01 ,
37+ /* Gets the current GPU's hive ID */
3438 TA_COMMAND_XGMI__GET_HIVE_ID = 0x02 ,
35- TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO = 0x03 ,
39+ /* Gets the Peer's topology Information */
40+ TA_COMMAND_XGMI__GET_TOPOLOGY_INFO = 0x03 ,
41+ /* Sets the Peer's topology Information */
3642 TA_COMMAND_XGMI__SET_TOPOLOGY_INFO = 0x04 ,
37- TA_COMMAND_XGMI__GET_PEER_LINKS = 0x0B
43+ /* Gets the total links between adjacent peer dies in hive */
44+ TA_COMMAND_XGMI__GET_PEER_LINKS = 0x0B ,
45+ /* Gets the total links and connected port numbers between adjacent peer dies in hive */
46+ TA_COMMAND_XGMI__GET_EXTEND_PEER_LINKS = 0x0C
3847};
3948
4049/* XGMI related enumerations */
4150/**********************************************************/ ;
42- enum ta_xgmi_connected_nodes {
43- TA_XGMI__MAX_CONNECTED_NODES = 64
44- };
51+ enum { TA_XGMI__MAX_CONNECTED_NODES = 64 };
52+ enum { TA_XGMI__MAX_INTERNAL_STATE = 32 };
53+ enum { TA_XGMI__MAX_INTERNAL_STATE_BUFFER = 128 };
54+ enum { TA_XGMI__MAX_PORT_NUM = 8 };
4555
4656enum ta_xgmi_status {
4757 TA_XGMI_STATUS__SUCCESS = 0x00 ,
@@ -81,6 +91,18 @@ struct ta_xgmi_peer_link_info {
8191 uint8_t num_links ;
8292};
8393
94+ struct xgmi_connected_port_num {
95+ uint8_t dst_xgmi_port_num ;
96+ uint8_t src_xgmi_port_num ;
97+ };
98+
99+ /* support both the port num and num_links */
100+ struct ta_xgmi_extend_peer_link_info {
101+ uint64_t node_id ;
102+ uint8_t num_links ;
103+ struct xgmi_connected_port_num port_num [TA_XGMI__MAX_PORT_NUM ];
104+ };
105+
84106struct ta_xgmi_cmd_initialize_output {
85107 uint32_t status ;
86108};
@@ -103,16 +125,21 @@ struct ta_xgmi_cmd_get_topology_info_output {
103125 struct ta_xgmi_node_info nodes [TA_XGMI__MAX_CONNECTED_NODES ];
104126};
105127
106- struct ta_xgmi_cmd_get_peer_link_info_output {
128+ struct ta_xgmi_cmd_set_topology_info_input {
107129 uint32_t num_nodes ;
108- struct ta_xgmi_peer_link_info nodes [TA_XGMI__MAX_CONNECTED_NODES ];
130+ struct ta_xgmi_node_info nodes [TA_XGMI__MAX_CONNECTED_NODES ];
109131};
110132
111- struct ta_xgmi_cmd_set_topology_info_input {
133+ /* support XGMI TA w/ and w/o port_num both so two similar structs defined */
134+ struct ta_xgmi_cmd_get_peer_link_info {
112135 uint32_t num_nodes ;
113- struct ta_xgmi_node_info nodes [TA_XGMI__MAX_CONNECTED_NODES ];
136+ struct ta_xgmi_peer_link_info nodes [TA_XGMI__MAX_CONNECTED_NODES ];
114137};
115138
139+ struct ta_xgmi_cmd_get_extend_peer_link_info {
140+ uint32_t num_nodes ;
141+ struct ta_xgmi_extend_peer_link_info nodes [TA_XGMI__MAX_CONNECTED_NODES ];
142+ };
116143/**********************************************************/
117144/* Common input structure for XGMI callbacks */
118145union ta_xgmi_cmd_input {
@@ -126,16 +153,23 @@ union ta_xgmi_cmd_output {
126153 struct ta_xgmi_cmd_get_node_id_output get_node_id ;
127154 struct ta_xgmi_cmd_get_hive_id_output get_hive_id ;
128155 struct ta_xgmi_cmd_get_topology_info_output get_topology_info ;
129- struct ta_xgmi_cmd_get_peer_link_info_output get_link_info ;
156+ struct ta_xgmi_cmd_get_peer_link_info get_link_info ;
157+ struct ta_xgmi_cmd_get_extend_peer_link_info get_extend_link_info ;
130158};
131- /**********************************************************/
132159
133160struct ta_xgmi_shared_memory {
134161 uint32_t cmd_id ;
135162 uint32_t resp_id ;
136163 enum ta_xgmi_status xgmi_status ;
164+
165+ /* if the number of xgmi link record is more than 128, driver will set the
166+ * flag 0 to get the first 128 of the link records and will set to 1, to get
167+ * the second set
168+ */
137169 uint8_t flag_extend_link_record ;
138- uint8_t reserved0 [3 ];
170+ /* bit0: port_num info support flag for GET_EXTEND_PEER_LINKS commmand */
171+ uint8_t caps_flag ;
172+ uint8_t reserved [2 ];
139173 union ta_xgmi_cmd_input xgmi_in_message ;
140174 union ta_xgmi_cmd_output xgmi_out_message ;
141175};
0 commit comments