Linux Audio

Check our new training course

Embedded Linux training

Mar 10-20, 2025, special US time zones
Register
Loading...
v6.9.4
  1/*
  2 * Copyright 2018-2022 Advanced Micro Devices, Inc.
  3 *
  4 * Permission is hereby granted, free of charge, to any person obtaining a
  5 * copy of this software and associated documentation files (the "Software"),
  6 * to deal in the Software without restriction, including without limitation
  7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8 * and/or sell copies of the Software, and to permit persons to whom the
  9 * Software is furnished to do so, subject to the following conditions:
 10 *
 11 * The above copyright notice and this permission notice shall be included in
 12 * all copies or substantial portions of the Software.
 13 *
 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 20 * OTHER DEALINGS IN THE SOFTWARE.
 21 *
 22 */
 
 23#ifndef _TA_XGMI_IF_H
 24#define _TA_XGMI_IF_H
 25
 26/* Responses have bit 31 set */
 27#define RSP_ID_MASK (1U << 31)
 28#define RSP_ID(cmdId) (((uint32_t)(cmdId)) | RSP_ID_MASK)
 29
 30#define EXTEND_PEER_LINK_INFO_CMD_FLAG 1
 31
 32enum ta_command_xgmi {
 33	/* Initialize the Context and Session Topology */
 34	TA_COMMAND_XGMI__INITIALIZE			= 0x00,
 35	/* Gets the current GPU's node ID */
 36	TA_COMMAND_XGMI__GET_NODE_ID			= 0x01,
 37	/* Gets the current GPU's hive ID */
 38	TA_COMMAND_XGMI__GET_HIVE_ID			= 0x02,
 39	/* Gets the Peer's topology Information */
 40	TA_COMMAND_XGMI__GET_TOPOLOGY_INFO		= 0x03,
 41	/* Sets the Peer's topology Information */
 42	TA_COMMAND_XGMI__SET_TOPOLOGY_INFO		= 0x04,
 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
 47};
 48
 49/* XGMI related enumerations */
 50/**********************************************************/;
 51enum { TA_XGMI__MAX_CONNECTED_NODES = 64 };
 52enum { TA_XGMI__MAX_INTERNAL_STATE = 32 };
 53enum { TA_XGMI__MAX_INTERNAL_STATE_BUFFER = 128 };
 54enum { TA_XGMI__MAX_PORT_NUM = 8 };
 55
 56enum ta_xgmi_status {
 57	TA_XGMI_STATUS__SUCCESS				= 0x00,
 58	TA_XGMI_STATUS__GENERIC_FAILURE			= 0x01,
 59	TA_XGMI_STATUS__NULL_POINTER			= 0x02,
 60	TA_XGMI_STATUS__INVALID_PARAMETER		= 0x03,
 61	TA_XGMI_STATUS__NOT_INITIALIZED			= 0x04,
 62	TA_XGMI_STATUS__INVALID_NODE_NUM		= 0x05,
 63	TA_XGMI_STATUS__INVALID_NODE_ID			= 0x06,
 64	TA_XGMI_STATUS__INVALID_TOPOLOGY		= 0x07,
 65	TA_XGMI_STATUS__FAILED_ID_GEN			= 0x08,
 66	TA_XGMI_STATUS__FAILED_TOPOLOGY_INIT		= 0x09,
 67	TA_XGMI_STATUS__SET_SHARING_ERROR		= 0x0A
 68};
 69
 70enum ta_xgmi_assigned_sdma_engine {
 71	TA_XGMI_ASSIGNED_SDMA_ENGINE__NOT_ASSIGNED	= -1,
 72	TA_XGMI_ASSIGNED_SDMA_ENGINE__SDMA0		= 0,
 73	TA_XGMI_ASSIGNED_SDMA_ENGINE__SDMA1		= 1,
 74	TA_XGMI_ASSIGNED_SDMA_ENGINE__SDMA2		= 2,
 75	TA_XGMI_ASSIGNED_SDMA_ENGINE__SDMA3		= 3,
 76	TA_XGMI_ASSIGNED_SDMA_ENGINE__SDMA4		= 4,
 77	TA_XGMI_ASSIGNED_SDMA_ENGINE__SDMA5		= 5
 78};
 79
 80/* input/output structures for XGMI commands */
 81/**********************************************************/
 82struct ta_xgmi_node_info {
 83	uint64_t				node_id;
 84	uint8_t					num_hops;
 85	uint8_t					is_sharing_enabled;
 86	enum ta_xgmi_assigned_sdma_engine	sdma_engine;
 87};
 88
 89struct ta_xgmi_peer_link_info {
 90	uint64_t				node_id;
 91	uint8_t					num_links;
 92};
 93
 94struct 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 */
100struct 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
106struct ta_xgmi_cmd_initialize_output {
107	uint32_t	status;
108};
109
110struct ta_xgmi_cmd_get_node_id_output {
111	uint64_t	node_id;
112};
113
114struct ta_xgmi_cmd_get_hive_id_output {
115	uint64_t	hive_id;
116};
117
118struct ta_xgmi_cmd_get_topology_info_input {
119	uint32_t			num_nodes;
120	struct ta_xgmi_node_info	nodes[TA_XGMI__MAX_CONNECTED_NODES];
121};
122
123struct ta_xgmi_cmd_get_topology_info_output {
124	uint32_t			num_nodes;
125	struct ta_xgmi_node_info	nodes[TA_XGMI__MAX_CONNECTED_NODES];
126};
127
128struct ta_xgmi_cmd_set_topology_info_input {
129	uint32_t			num_nodes;
130	struct ta_xgmi_node_info	nodes[TA_XGMI__MAX_CONNECTED_NODES];
131};
132
133/* support XGMI TA w/ and w/o port_num both so two similar structs defined */
134struct ta_xgmi_cmd_get_peer_link_info {
135	uint32_t			num_nodes;
136	struct ta_xgmi_peer_link_info	nodes[TA_XGMI__MAX_CONNECTED_NODES];
137};
138
139struct 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};
143/**********************************************************/
144/* Common input structure for XGMI callbacks */
145union ta_xgmi_cmd_input {
146	struct ta_xgmi_cmd_get_topology_info_input	get_topology_info;
147	struct ta_xgmi_cmd_set_topology_info_input	set_topology_info;
148};
149
150/* Common output structure for XGMI callbacks */
151union ta_xgmi_cmd_output {
152	struct ta_xgmi_cmd_initialize_output		initialize;
153	struct ta_xgmi_cmd_get_node_id_output		get_node_id;
154	struct ta_xgmi_cmd_get_hive_id_output		get_hive_id;
155	struct ta_xgmi_cmd_get_topology_info_output	get_topology_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;
158};
 
159
160struct ta_xgmi_shared_memory {
161	uint32_t			cmd_id;
162	uint32_t			resp_id;
163	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	 */
169	uint8_t				flag_extend_link_record;
170	/* bit0: port_num info support flag for GET_EXTEND_PEER_LINKS commmand */
171	uint8_t				caps_flag;
172	uint8_t				reserved[2];
173	union ta_xgmi_cmd_input		xgmi_in_message;
174	union ta_xgmi_cmd_output	xgmi_out_message;
175};
176
177#endif   //_TA_XGMI_IF_H
v5.9
  1/*
  2 * Copyright 2018 Advanced Micro Devices, Inc.
  3 *
  4 * Permission is hereby granted, free of charge, to any person obtaining a
  5 * copy of this software and associated documentation files (the "Software"),
  6 * to deal in the Software without restriction, including without limitation
  7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8 * and/or sell copies of the Software, and to permit persons to whom the
  9 * Software is furnished to do so, subject to the following conditions:
 10 *
 11 * The above copyright notice and this permission notice shall be included in
 12 * all copies or substantial portions of the Software.
 13 *
 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 20 * OTHER DEALINGS IN THE SOFTWARE.
 21 *
 22 */
 23
 24#ifndef _TA_XGMI_IF_H
 25#define _TA_XGMI_IF_H
 26
 27/* Responses have bit 31 set */
 28#define RSP_ID_MASK (1U << 31)
 29#define RSP_ID(cmdId) (((uint32_t)(cmdId)) | RSP_ID_MASK)
 30
 
 
 31enum ta_command_xgmi {
 
 32	TA_COMMAND_XGMI__INITIALIZE			= 0x00,
 
 33	TA_COMMAND_XGMI__GET_NODE_ID			= 0x01,
 
 34	TA_COMMAND_XGMI__GET_HIVE_ID			= 0x02,
 35	TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO		= 0x03,
 36	TA_COMMAND_XGMI__SET_TOPOLOGY_INFO		= 0x04
 
 
 
 
 
 
 37};
 38
 39/* XGMI related enumerations */
 40/**********************************************************/;
 41enum ta_xgmi_connected_nodes {
 42	TA_XGMI__MAX_CONNECTED_NODES			= 64
 43};
 
 44
 45enum ta_xgmi_status {
 46	TA_XGMI_STATUS__SUCCESS				= 0x00,
 47	TA_XGMI_STATUS__GENERIC_FAILURE			= 0x01,
 48	TA_XGMI_STATUS__NULL_POINTER			= 0x02,
 49	TA_XGMI_STATUS__INVALID_PARAMETER		= 0x03,
 50	TA_XGMI_STATUS__NOT_INITIALIZED			= 0x04,
 51	TA_XGMI_STATUS__INVALID_NODE_NUM		= 0x05,
 52	TA_XGMI_STATUS__INVALID_NODE_ID			= 0x06,
 53	TA_XGMI_STATUS__INVALID_TOPOLOGY		= 0x07,
 54	TA_XGMI_STATUS__FAILED_ID_GEN			= 0x08,
 55	TA_XGMI_STATUS__FAILED_TOPOLOGY_INIT		= 0x09,
 56	TA_XGMI_STATUS__SET_SHARING_ERROR		= 0x0A
 57};
 58
 59enum ta_xgmi_assigned_sdma_engine {
 60	TA_XGMI_ASSIGNED_SDMA_ENGINE__NOT_ASSIGNED	= -1,
 61	TA_XGMI_ASSIGNED_SDMA_ENGINE__SDMA0		= 0,
 62	TA_XGMI_ASSIGNED_SDMA_ENGINE__SDMA1		= 1,
 63	TA_XGMI_ASSIGNED_SDMA_ENGINE__SDMA2		= 2,
 64	TA_XGMI_ASSIGNED_SDMA_ENGINE__SDMA3		= 3,
 65	TA_XGMI_ASSIGNED_SDMA_ENGINE__SDMA4		= 4,
 66	TA_XGMI_ASSIGNED_SDMA_ENGINE__SDMA5		= 5
 67};
 68
 69/* input/output structures for XGMI commands */
 70/**********************************************************/
 71struct ta_xgmi_node_info {
 72	uint64_t				node_id;
 73	uint8_t					num_hops;
 74	uint8_t					is_sharing_enabled;
 75	enum ta_xgmi_assigned_sdma_engine	sdma_engine;
 76};
 77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 78struct ta_xgmi_cmd_initialize_output {
 79	uint32_t	status;
 80};
 81
 82struct ta_xgmi_cmd_get_node_id_output {
 83	uint64_t	node_id;
 84};
 85
 86struct ta_xgmi_cmd_get_hive_id_output {
 87	uint64_t	hive_id;
 88};
 89
 90struct ta_xgmi_cmd_get_topology_info_input {
 91	uint32_t			num_nodes;
 92	struct ta_xgmi_node_info	nodes[TA_XGMI__MAX_CONNECTED_NODES];
 93};
 94
 95struct ta_xgmi_cmd_get_topology_info_output {
 96	uint32_t			num_nodes;
 97	struct ta_xgmi_node_info	nodes[TA_XGMI__MAX_CONNECTED_NODES];
 98};
 99
100struct ta_xgmi_cmd_set_topology_info_input {
101	uint32_t			num_nodes;
102	struct ta_xgmi_node_info	nodes[TA_XGMI__MAX_CONNECTED_NODES];
103};
104
 
 
 
 
 
 
 
 
 
 
105/**********************************************************/
106/* Common input structure for XGMI callbacks */
107union ta_xgmi_cmd_input {
108	struct ta_xgmi_cmd_get_topology_info_input	get_topology_info;
109	struct ta_xgmi_cmd_set_topology_info_input	set_topology_info;
110};
111
112/* Common output structure for XGMI callbacks */
113union ta_xgmi_cmd_output {
114	struct ta_xgmi_cmd_initialize_output		initialize;
115	struct ta_xgmi_cmd_get_node_id_output		get_node_id;
116	struct ta_xgmi_cmd_get_hive_id_output		get_hive_id;
117	struct ta_xgmi_cmd_get_topology_info_output	get_topology_info;
 
 
118};
119/**********************************************************/
120
121struct ta_xgmi_shared_memory {
122	uint32_t			cmd_id;
123	uint32_t			resp_id;
124	enum ta_xgmi_status		xgmi_status;
125	uint32_t			reserved;
 
 
 
 
 
 
 
 
126	union ta_xgmi_cmd_input		xgmi_in_message;
127	union ta_xgmi_cmd_output	xgmi_out_message;
128};
129
130#endif   //_TA_XGMI_IF_H