drm/amdgpu: update the xgmi ta interface header
Subsystems (2)
PATCH 1/3 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
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 6 +-- drivers/gpu/drm/amd/amdgpu/ta_xgmi_if.h | 62 +++++++++++++++++++------ 2 files changed, 51 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +3 -3
@@ -1388,7 +1388,7 @@ int psp_xgmi_get_topology_info(struct psp_context *psp,/* Fill in the shared memory with topology information as input */ topology_info_input = &xgmi_cmd->xgmi_in_message.get_topology_info; - xgmi_cmd->cmd_id =TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO ; + xgmi_cmd->cmd_id =TA_COMMAND_XGMI__GET_TOPOLOGY_INFO ; topology_info_input->num_nodes = number_devices;for (i =0 ; i < topology_info_input->num_nodes; i++) {
@@ -1399,7 +1399,7 @@ int psp_xgmi_get_topology_info(struct psp_context *psp, }/* Invoke xgmi ta to get the topology information */ - ret =psp_xgmi_invoke (psp,TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO ); + ret =psp_xgmi_invoke (psp,TA_COMMAND_XGMI__GET_TOPOLOGY_INFO );if (ret)return ret;
@@ -1424,7 +1424,7 @@ int psp_xgmi_get_topology_info(struct psp_context *psp,/* Invoke xgmi ta again to get the link information */ if (psp_xgmi_peer_link_info_supported (psp)) { -struct ta_xgmi_cmd_get_peer_link_info_output *link_info_output; +struct ta_xgmi_cmd_get_peer_link_info *link_info_output;bool requires_reflection = (psp->xgmi_context.supports_extended_data && get_extended_data) ||
drivers/gpu/drm/amd/amdgpu/ta_xgmi_if.h +48 -14
118 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 2/3 drm/amdgpu: prepare the output buffer for GET_PEER_LINKS command
Per the xgmi ta implementation, KGD needs to fill in node_ids in concern into the shared command output buffer rather than the command input buffer.
Input buffer is not used for GET_PEER_LINKS command execution.
In this way, xgmi ta can reuse the node info in the output buffer just filled in and populate the same buffer with link info directly.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +10 -2
@@ -1431,14 +1431,22 @@ int psp_xgmi_get_topology_info(struct psp_context *psp,amdgpu_ip_version (psp->adev,MP0_HWIP ,0 ) ==IP_VERSION (13 ,0 ,6 ); - xgmi_cmd->cmd_id =TA_COMMAND_XGMI__GET_PEER_LINKS ; + link_info_output = &xgmi_cmd->xgmi_out_message.get_link_info; +/* popluate the shared output buffer rather than the cmd input buffer +* with node_ids as the input for GET_PEER_LINKS command execution. +* This is required for GET_PEER_LINKS only per xgmi ta implementation +*/ +for (i =0 ; i < topology->num_nodes; i++) { + link_info_output->nodes[i].node_id = topology->nodes[i].node_id; + } + link_info_output->num_nodes = topology->num_nodes; + xgmi_cmd->cmd_id =TA_COMMAND_XGMI__GET_PEER_LINKS ; ret =psp_xgmi_invoke (psp,TA_COMMAND_XGMI__GET_PEER_LINKS );if (ret)return ret; - link_info_output = &xgmi_cmd->xgmi_out_message.get_link_info;for (i =0 ; i < topology->num_nodes; i++) {/* accumulate num_links on extended data */ topology->nodes[i].num_links = get_extended_data ?
Signature · 1 line
2.17.1
PATCH 3/3 drm/amdgpu: support the port num info based on the capability flag
In reply to Shiwu ZhangXGMI TA will set the capability flag to indicate whether the port_num info is supported or not. KGD checks the flag and accordingly picks up the right buffer format and send the right command to TA to retrieve the info.
v2: simplify the code by reusing the same statement (lijo)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 45 ++++++++++++++++++------- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 1 + 2 files changed, 33 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +32 -13
@@ -1267,6 +1267,8 @@ int psp_xgmi_initialize(struct psp_context *psp, bool set_extended_data, bool lo xgmi_cmd->cmd_id =TA_COMMAND_XGMI__INITIALIZE ; ret =psp_xgmi_invoke (psp, xgmi_cmd->cmd_id); +/* note down the capbility flag for XGMI TA */ + psp->xgmi_context.xgmi_ta_caps = xgmi_cmd->caps_flag;return ret; }
@@ -1425,35 +1427,52 @@ int psp_xgmi_get_topology_info(struct psp_context *psp,/* Invoke xgmi ta again to get the link information */ if (psp_xgmi_peer_link_info_supported (psp)) {struct ta_xgmi_cmd_get_peer_link_info *link_info_output; +struct ta_xgmi_cmd_get_extend_peer_link_info *link_extend_info_output;bool requires_reflection = (psp->xgmi_context.supports_extended_data && get_extended_data) ||amdgpu_ip_version (psp->adev,MP0_HWIP ,0 ) ==IP_VERSION (13 ,0 ,6 ); +bool ta_port_num_support = psp->xgmi_context.xgmi_ta_caps & +EXTEND_PEER_LINK_INFO_CMD_FLAG ; - link_info_output = &xgmi_cmd->xgmi_out_message.get_link_info;/* popluate the shared output buffer rather than the cmd input buffer * with node_ids as the input for GET_PEER_LINKS command execution. -* This is required for GET_PEER_LINKS only per xgmi ta implementation +* This is required for GET_PEER_LINKS per xgmi ta implementation. +* The same requirement for GET_EXTEND_PEER_LINKS command. */ -for (i =0 ; i < topology->num_nodes; i++) { - link_info_output->nodes[i].node_id = topology->nodes[i].node_id; - } - link_info_output->num_nodes = topology->num_nodes; +if (ta_port_num_support) { + link_extend_info_output = &xgmi_cmd->xgmi_out_message.get_extend_link_info; + +for (i =0 ; i < topology->num_nodes; i++) + link_extend_info_output->nodes[i].node_id = topology->nodes[i].node_id; + + link_extend_info_output->num_nodes = topology->num_nodes; + xgmi_cmd->cmd_id =TA_COMMAND_XGMI__GET_EXTEND_PEER_LINKS ; + }else { + link_info_output = &xgmi_cmd->xgmi_out_message.get_link_info; - xgmi_cmd->cmd_id =TA_COMMAND_XGMI__GET_PEER_LINKS ; - ret =psp_xgmi_invoke (psp,TA_COMMAND_XGMI__GET_PEER_LINKS ); +for (i =0 ; i < topology->num_nodes; i++) + link_info_output->nodes[i].node_id = topology->nodes[i].node_id; + link_info_output->num_nodes = topology->num_nodes; + xgmi_cmd->cmd_id =TA_COMMAND_XGMI__GET_PEER_LINKS ; + } + + ret =psp_xgmi_invoke (psp, xgmi_cmd->cmd_id);if (ret)return ret;for (i =0 ; i < topology->num_nodes; i++) { +uint8_t node_num_links = ta_port_num_support ? + link_extend_info_output->nodes[i].num_links : link_info_output->nodes[i].num_links;/* accumulate num_links on extended data */ - topology->nodes[i].num_links = get_extended_data ? - topology->nodes[i].num_links + - link_info_output->nodes[i].num_links : - ((requires_reflection && topology->nodes[i].num_links) ? topology->nodes[i].num_links : - link_info_output->nodes[i].num_links); +if (get_extended_data) { + topology->nodes[i].num_links = topology->nodes[i].num_links + node_num_links; + }else { + topology->nodes[i].num_links = (requires_reflection && topology->nodes[i].num_links) ? + topology->nodes[i].num_links : node_num_links; + }/* reflect the topology information for bi-directionality */ if (requires_reflection && topology->nodes[i].num_hops)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +1 -0
@@ -189,6 +189,7 @@ struct psp_xgmi_context {struct ta_context context;struct psp_xgmi_topology_info top_info;bool supports_extended_data; +uint8_t xgmi_ta_caps; };struct psp_ras_context {
Signature · 1 line
2.17.1