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
26
/* Responses have bit 31 set */
28
27
#define RSP_ID_MASK (1U << 31)
29
28
#define RSP_ID (cmdId ) (((uint32_t)(cmdId)) | RSP_ID_MASK)
30
29
30
+ #define EXTEND_PEER_LINK_INFO_CMD_FLAG 1
31
+
31
32
enum ta_command_xgmi {
33
+ /* Initialize the Context and Session Topology */
32
34
TA_COMMAND_XGMI__INITIALIZE = 0x00 ,
35
+ /* Gets the current GPU's node ID */
33
36
TA_COMMAND_XGMI__GET_NODE_ID = 0x01 ,
37
+ /* Gets the current GPU's hive ID */
34
38
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 */
36
42
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
38
47
};
39
48
40
49
/* XGMI related enumerations */
41
50
/**********************************************************/ ;
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 };
45
55
46
56
enum ta_xgmi_status {
47
57
TA_XGMI_STATUS__SUCCESS = 0x00 ,
@@ -81,6 +91,18 @@ struct ta_xgmi_peer_link_info {
81
91
uint8_t num_links ;
82
92
};
83
93
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
+
84
106
struct ta_xgmi_cmd_initialize_output {
85
107
uint32_t status ;
86
108
};
@@ -103,16 +125,21 @@ struct ta_xgmi_cmd_get_topology_info_output {
103
125
struct ta_xgmi_node_info nodes [TA_XGMI__MAX_CONNECTED_NODES ];
104
126
};
105
127
106
- struct ta_xgmi_cmd_get_peer_link_info_output {
128
+ struct ta_xgmi_cmd_set_topology_info_input {
107
129
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 ];
109
131
};
110
132
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 {
112
135
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 ];
114
137
};
115
138
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
+ };
116
143
/**********************************************************/
117
144
/* Common input structure for XGMI callbacks */
118
145
union ta_xgmi_cmd_input {
@@ -126,16 +153,23 @@ union ta_xgmi_cmd_output {
126
153
struct ta_xgmi_cmd_get_node_id_output get_node_id ;
127
154
struct ta_xgmi_cmd_get_hive_id_output get_hive_id ;
128
155
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 ;
130
158
};
131
- /**********************************************************/
132
159
133
160
struct ta_xgmi_shared_memory {
134
161
uint32_t cmd_id ;
135
162
uint32_t resp_id ;
136
163
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
+ */
137
169
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 ];
139
173
union ta_xgmi_cmd_input xgmi_in_message ;
140
174
union ta_xgmi_cmd_output xgmi_out_message ;
141
175
};
0 commit comments