diff options
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c index 7b248915489a..f56f8e376b62 100644 --- a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | |||
@@ -570,6 +570,45 @@ static int psp_v11_0_mode1_reset(struct psp_context *psp) | |||
570 | static int psp_v11_0_xgmi_get_topology_info(struct psp_context *psp, | 570 | static int psp_v11_0_xgmi_get_topology_info(struct psp_context *psp, |
571 | int number_devices, struct psp_xgmi_topology_info *topology) | 571 | int number_devices, struct psp_xgmi_topology_info *topology) |
572 | { | 572 | { |
573 | struct ta_xgmi_shared_memory *xgmi_cmd; | ||
574 | struct ta_xgmi_cmd_get_topology_info_input *topology_info_input; | ||
575 | struct ta_xgmi_cmd_get_topology_info_output *topology_info_output; | ||
576 | int i; | ||
577 | int ret; | ||
578 | |||
579 | if (!topology || topology->num_nodes > TA_XGMI__MAX_CONNECTED_NODES) | ||
580 | return -EINVAL; | ||
581 | |||
582 | xgmi_cmd = (struct ta_xgmi_shared_memory*)psp->xgmi_context.xgmi_shared_buf; | ||
583 | memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory)); | ||
584 | |||
585 | /* Fill in the shared memory with topology information as input */ | ||
586 | topology_info_input = &xgmi_cmd->xgmi_in_message.get_topology_info; | ||
587 | xgmi_cmd->cmd_id = TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO; | ||
588 | topology_info_input->num_nodes = number_devices; | ||
589 | |||
590 | for (i = 0; i < topology_info_input->num_nodes; i++) { | ||
591 | topology_info_input->nodes[i].node_id = topology->nodes[i].node_id; | ||
592 | topology_info_input->nodes[i].num_hops = topology->nodes[i].num_hops; | ||
593 | topology_info_input->nodes[i].is_sharing_enabled = topology->nodes[i].is_sharing_enabled; | ||
594 | topology_info_input->nodes[i].sdma_engine = topology->nodes[i].sdma_engine; | ||
595 | } | ||
596 | |||
597 | /* Invoke xgmi ta to get the topology information */ | ||
598 | ret = psp_xgmi_invoke(psp, TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO); | ||
599 | if (ret) | ||
600 | return ret; | ||
601 | |||
602 | /* Read the output topology information from the shared memory */ | ||
603 | topology_info_output = &xgmi_cmd->xgmi_out_message.get_topology_info; | ||
604 | topology->num_nodes = xgmi_cmd->xgmi_out_message.get_topology_info.num_nodes; | ||
605 | for (i = 0; i < topology->num_nodes; i++) { | ||
606 | topology->nodes[i].node_id = topology_info_output->nodes[i].node_id; | ||
607 | topology->nodes[i].num_hops = topology_info_output->nodes[i].num_hops; | ||
608 | topology->nodes[i].is_sharing_enabled = topology_info_output->nodes[i].is_sharing_enabled; | ||
609 | topology->nodes[i].sdma_engine = topology_info_output->nodes[i].sdma_engine; | ||
610 | } | ||
611 | |||
573 | return 0; | 612 | return 0; |
574 | } | 613 | } |
575 | 614 | ||