Skip to content

Commit 626121f

Browse files
Shiwu Zhangalexdeucher
authored andcommitted
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 <[email protected]> Reviewed-by: Le Ma <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 8096df7 commit 626121f

File tree

2 files changed

+51
-17
lines changed

2 files changed

+51
-17
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,7 +1388,7 @@ int psp_xgmi_get_topology_info(struct psp_context *psp,
13881388

13891389
/* Fill in the shared memory with topology information as input */
13901390
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;
13921392
topology_info_input->num_nodes = number_devices;
13931393

13941394
for (i = 0; i < topology_info_input->num_nodes; i++) {
@@ -1399,7 +1399,7 @@ int psp_xgmi_get_topology_info(struct psp_context *psp,
13991399
}
14001400

14011401
/* 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);
14031403
if (ret)
14041404
return ret;
14051405

@@ -1424,7 +1424,7 @@ int psp_xgmi_get_topology_info(struct psp_context *psp,
14241424

14251425
/* Invoke xgmi ta again to get the link information */
14261426
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;
14281428
bool requires_reflection =
14291429
(psp->xgmi_context.supports_extended_data &&
14301430
get_extended_data) ||

drivers/gpu/drm/amd/amdgpu/ta_xgmi_if.h

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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"),
@@ -20,28 +20,38 @@
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+
3132
enum 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

4656
enum 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+
84106
struct 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 */
118145
union 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

133160
struct 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

Comments
 (0)