]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/amdgpu: update the xgmi ta interface header
authorShiwu Zhang <shiwu.zhang@amd.com>
Wed, 20 Sep 2023 09:05:41 +0000 (17:05 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 20 Oct 2023 19:11:28 +0000 (15:11 -0400)
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 <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/ta_xgmi_if.h

index b153acf9ed053dbc88a454ceeb0816e4918915a8..bd398e10fa0aa5bf256caf2bc714201fb875ad49 100644 (file)
@@ -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) ||
index da815a93d46e42a8523df3176f33f6192c378412..d5748032674ee7bd1a6a75e415a631fcdf9b8834 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 Advanced Micro Devices, Inc.
+ * Copyright 2018-2022 Advanced Micro Devices, Inc.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -20,7 +20,6 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  *
  */
-
 #ifndef _TA_XGMI_IF_H
 #define _TA_XGMI_IF_H
 
 #define RSP_ID_MASK (1U << 31)
 #define RSP_ID(cmdId) (((uint32_t)(cmdId)) | RSP_ID_MASK)
 
+#define EXTEND_PEER_LINK_INFO_CMD_FLAG 1
+
 enum ta_command_xgmi {
+       /* Initialize the Context and Session Topology */
        TA_COMMAND_XGMI__INITIALIZE                     = 0x00,
+       /* Gets the current GPU's node ID */
        TA_COMMAND_XGMI__GET_NODE_ID                    = 0x01,
+       /* Gets the current GPU's hive ID */
        TA_COMMAND_XGMI__GET_HIVE_ID                    = 0x02,
-       TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO          = 0x03,
+       /* Gets the Peer's topology Information */
+       TA_COMMAND_XGMI__GET_TOPOLOGY_INFO              = 0x03,
+       /* Sets the Peer's topology Information */
        TA_COMMAND_XGMI__SET_TOPOLOGY_INFO              = 0x04,
-       TA_COMMAND_XGMI__GET_PEER_LINKS                 = 0x0B
+       /* Gets the total links between adjacent peer dies in hive */
+       TA_COMMAND_XGMI__GET_PEER_LINKS                 = 0x0B,
+       /* Gets the total links and connected port numbers between adjacent peer dies in hive */
+       TA_COMMAND_XGMI__GET_EXTEND_PEER_LINKS          = 0x0C
 };
 
 /* XGMI related enumerations */
 /**********************************************************/;
-enum ta_xgmi_connected_nodes {
-       TA_XGMI__MAX_CONNECTED_NODES                    = 64
-};
+enum { TA_XGMI__MAX_CONNECTED_NODES = 64 };
+enum { TA_XGMI__MAX_INTERNAL_STATE = 32 };
+enum { TA_XGMI__MAX_INTERNAL_STATE_BUFFER = 128 };
+enum { TA_XGMI__MAX_PORT_NUM = 8 };
 
 enum ta_xgmi_status {
        TA_XGMI_STATUS__SUCCESS                         = 0x00,
@@ -81,6 +91,18 @@ struct ta_xgmi_peer_link_info {
        uint8_t                                 num_links;
 };
 
+struct xgmi_connected_port_num {
+       uint8_t         dst_xgmi_port_num;
+       uint8_t         src_xgmi_port_num;
+};
+
+/* support both the port num and num_links */
+struct ta_xgmi_extend_peer_link_info {
+       uint64_t                                node_id;
+       uint8_t                                 num_links;
+       struct xgmi_connected_port_num          port_num[TA_XGMI__MAX_PORT_NUM];
+};
+
 struct ta_xgmi_cmd_initialize_output {
        uint32_t        status;
 };
@@ -103,16 +125,21 @@ struct ta_xgmi_cmd_get_topology_info_output {
        struct ta_xgmi_node_info        nodes[TA_XGMI__MAX_CONNECTED_NODES];
 };
 
-struct ta_xgmi_cmd_get_peer_link_info_output {
+struct ta_xgmi_cmd_set_topology_info_input {
        uint32_t                        num_nodes;
-       struct ta_xgmi_peer_link_info   nodes[TA_XGMI__MAX_CONNECTED_NODES];
+       struct ta_xgmi_node_info        nodes[TA_XGMI__MAX_CONNECTED_NODES];
 };
 
-struct ta_xgmi_cmd_set_topology_info_input {
+/* support XGMI TA w/ and w/o port_num both so two similar structs defined */
+struct ta_xgmi_cmd_get_peer_link_info {
        uint32_t                        num_nodes;
-       struct ta_xgmi_node_info        nodes[TA_XGMI__MAX_CONNECTED_NODES];
+       struct ta_xgmi_peer_link_info   nodes[TA_XGMI__MAX_CONNECTED_NODES];
 };
 
+struct ta_xgmi_cmd_get_extend_peer_link_info {
+       uint32_t                                num_nodes;
+       struct ta_xgmi_extend_peer_link_info nodes[TA_XGMI__MAX_CONNECTED_NODES];
+};
 /**********************************************************/
 /* Common input structure for XGMI callbacks */
 union ta_xgmi_cmd_input {
@@ -126,16 +153,23 @@ union ta_xgmi_cmd_output {
        struct ta_xgmi_cmd_get_node_id_output           get_node_id;
        struct ta_xgmi_cmd_get_hive_id_output           get_hive_id;
        struct ta_xgmi_cmd_get_topology_info_output     get_topology_info;
-       struct ta_xgmi_cmd_get_peer_link_info_output    get_link_info;
+       struct ta_xgmi_cmd_get_peer_link_info           get_link_info;
+       struct ta_xgmi_cmd_get_extend_peer_link_info    get_extend_link_info;
 };
-/**********************************************************/
 
 struct ta_xgmi_shared_memory {
        uint32_t                        cmd_id;
        uint32_t                        resp_id;
        enum ta_xgmi_status             xgmi_status;
+
+       /* if the number of xgmi link record is more than 128, driver will set the
+        * flag 0 to get the first 128 of the link records and will set to 1, to get
+        * the second set
+        */
        uint8_t                         flag_extend_link_record;
-       uint8_t                         reserved0[3];
+       /* bit0: port_num info support flag for GET_EXTEND_PEER_LINKS commmand */
+       uint8_t                         caps_flag;
+       uint8_t                         reserved[2];
        union ta_xgmi_cmd_input         xgmi_in_message;
        union ta_xgmi_cmd_output        xgmi_out_message;
 };