drm/amdgpu: add and populate the port num into xgmi topology info
authorShiwu Zhang <shiwu.zhang@amd.com>
Tue, 31 Oct 2023 03:02:49 +0000 (11:02 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 17 Nov 2023 05:53:49 +0000 (00:53 -0500)
The port num info is firstly introduced with 20.00.01.13 xgmi ta and
make them as part of topology info.

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>
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h

index 32b701cc0376d3451f480e50dd0405e142ebedc9..a21045d018f2b6efe6a281c1cec74fd25357c064 100644 (file)
@@ -1473,6 +1473,11 @@ int psp_xgmi_get_topology_info(struct psp_context *psp,
                                topology->nodes[i].num_links = (requires_reflection && topology->nodes[i].num_links) ?
                                                                topology->nodes[i].num_links : node_num_links;
                        }
+                       /* popluate the connected port num info if supported and available */
+                       if (ta_port_num_support && topology->nodes[i].num_links) {
+                               memcpy(topology->nodes[i].port_num, link_extend_info_output->nodes[i].port_num,
+                                      sizeof(struct xgmi_connected_port_num) * TA_XGMI__MAX_PORT_NUM);
+                       }
 
                        /* reflect the topology information for bi-directionality */
                        if (requires_reflection && topology->nodes[i].num_hops)
index 5d36ad3f48c74ac298ddec9c27cef9494c19979a..c4d9cbde55b9bc58799aa1acc9fe4eea29d1a98a 100644 (file)
@@ -150,6 +150,7 @@ struct psp_xgmi_node_info {
        uint8_t                                 is_sharing_enabled;
        enum ta_xgmi_assigned_sdma_engine       sdma_engine;
        uint8_t                                 num_links;
+       struct xgmi_connected_port_num          port_num[TA_XGMI__MAX_PORT_NUM];
 };
 
 struct psp_xgmi_topology_info {