Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | **************************************************************************** |
| 3 | *** |
| 4 | *** This header was automatically generated from a Linux kernel header |
| 5 | *** of the same name, to make information necessary for userspace to |
| 6 | *** call into the kernel available to libc. It contains only constants, |
| 7 | *** structures, and macros generated from the original header, and thus, |
| 8 | *** contains no copyrightable information. |
| 9 | *** |
| 10 | *** To edit the content of this header, modify the corresponding |
| 11 | *** source file (e.g. under external/kernel-headers/original/) then |
| 12 | *** run bionic/libc/kernel/tools/update_all.py |
| 13 | *** |
| 14 | *** Any manual change here will be lost the next time this script will |
| 15 | *** be run. You've been warned! |
| 16 | *** |
| 17 | **************************************************************************** |
| 18 | ****************************************************************************/ |
| 19 | #ifndef HABANALABS_H_ |
| 20 | #define HABANALABS_H_ |
| 21 | #include <linux/types.h> |
| 22 | #include <linux/ioctl.h> |
| 23 | #define GOYA_KMD_SRAM_RESERVED_SIZE_FROM_START 0x8000 |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 24 | #define GAUDI_DRIVER_SRAM_RESERVED_SIZE_FROM_START 0x80 |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 25 | #define GAUDI_FIRST_AVAILABLE_W_S_SYNC_OBJECT 144 |
| 26 | #define GAUDI_FIRST_AVAILABLE_W_S_MONITOR 72 |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 27 | #define TS_MAX_ELEMENTS_NUM (1 << 20) |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 28 | enum goya_queue_id { |
| 29 | GOYA_QUEUE_ID_DMA_0 = 0, |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 30 | GOYA_QUEUE_ID_DMA_1 = 1, |
| 31 | GOYA_QUEUE_ID_DMA_2 = 2, |
| 32 | GOYA_QUEUE_ID_DMA_3 = 3, |
| 33 | GOYA_QUEUE_ID_DMA_4 = 4, |
| 34 | GOYA_QUEUE_ID_CPU_PQ = 5, |
| 35 | GOYA_QUEUE_ID_MME = 6, |
| 36 | GOYA_QUEUE_ID_TPC0 = 7, |
| 37 | GOYA_QUEUE_ID_TPC1 = 8, |
| 38 | GOYA_QUEUE_ID_TPC2 = 9, |
| 39 | GOYA_QUEUE_ID_TPC3 = 10, |
| 40 | GOYA_QUEUE_ID_TPC4 = 11, |
| 41 | GOYA_QUEUE_ID_TPC5 = 12, |
| 42 | GOYA_QUEUE_ID_TPC6 = 13, |
| 43 | GOYA_QUEUE_ID_TPC7 = 14, |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 44 | GOYA_QUEUE_ID_SIZE |
| 45 | }; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 46 | enum gaudi_queue_id { |
| 47 | GAUDI_QUEUE_ID_DMA_0_0 = 0, |
| 48 | GAUDI_QUEUE_ID_DMA_0_1 = 1, |
| 49 | GAUDI_QUEUE_ID_DMA_0_2 = 2, |
| 50 | GAUDI_QUEUE_ID_DMA_0_3 = 3, |
| 51 | GAUDI_QUEUE_ID_DMA_1_0 = 4, |
| 52 | GAUDI_QUEUE_ID_DMA_1_1 = 5, |
| 53 | GAUDI_QUEUE_ID_DMA_1_2 = 6, |
| 54 | GAUDI_QUEUE_ID_DMA_1_3 = 7, |
| 55 | GAUDI_QUEUE_ID_CPU_PQ = 8, |
| 56 | GAUDI_QUEUE_ID_DMA_2_0 = 9, |
| 57 | GAUDI_QUEUE_ID_DMA_2_1 = 10, |
| 58 | GAUDI_QUEUE_ID_DMA_2_2 = 11, |
| 59 | GAUDI_QUEUE_ID_DMA_2_3 = 12, |
| 60 | GAUDI_QUEUE_ID_DMA_3_0 = 13, |
| 61 | GAUDI_QUEUE_ID_DMA_3_1 = 14, |
| 62 | GAUDI_QUEUE_ID_DMA_3_2 = 15, |
| 63 | GAUDI_QUEUE_ID_DMA_3_3 = 16, |
| 64 | GAUDI_QUEUE_ID_DMA_4_0 = 17, |
| 65 | GAUDI_QUEUE_ID_DMA_4_1 = 18, |
| 66 | GAUDI_QUEUE_ID_DMA_4_2 = 19, |
| 67 | GAUDI_QUEUE_ID_DMA_4_3 = 20, |
| 68 | GAUDI_QUEUE_ID_DMA_5_0 = 21, |
| 69 | GAUDI_QUEUE_ID_DMA_5_1 = 22, |
| 70 | GAUDI_QUEUE_ID_DMA_5_2 = 23, |
| 71 | GAUDI_QUEUE_ID_DMA_5_3 = 24, |
| 72 | GAUDI_QUEUE_ID_DMA_6_0 = 25, |
| 73 | GAUDI_QUEUE_ID_DMA_6_1 = 26, |
| 74 | GAUDI_QUEUE_ID_DMA_6_2 = 27, |
| 75 | GAUDI_QUEUE_ID_DMA_6_3 = 28, |
| 76 | GAUDI_QUEUE_ID_DMA_7_0 = 29, |
| 77 | GAUDI_QUEUE_ID_DMA_7_1 = 30, |
| 78 | GAUDI_QUEUE_ID_DMA_7_2 = 31, |
| 79 | GAUDI_QUEUE_ID_DMA_7_3 = 32, |
| 80 | GAUDI_QUEUE_ID_MME_0_0 = 33, |
| 81 | GAUDI_QUEUE_ID_MME_0_1 = 34, |
| 82 | GAUDI_QUEUE_ID_MME_0_2 = 35, |
| 83 | GAUDI_QUEUE_ID_MME_0_3 = 36, |
| 84 | GAUDI_QUEUE_ID_MME_1_0 = 37, |
| 85 | GAUDI_QUEUE_ID_MME_1_1 = 38, |
| 86 | GAUDI_QUEUE_ID_MME_1_2 = 39, |
| 87 | GAUDI_QUEUE_ID_MME_1_3 = 40, |
| 88 | GAUDI_QUEUE_ID_TPC_0_0 = 41, |
| 89 | GAUDI_QUEUE_ID_TPC_0_1 = 42, |
| 90 | GAUDI_QUEUE_ID_TPC_0_2 = 43, |
| 91 | GAUDI_QUEUE_ID_TPC_0_3 = 44, |
| 92 | GAUDI_QUEUE_ID_TPC_1_0 = 45, |
| 93 | GAUDI_QUEUE_ID_TPC_1_1 = 46, |
| 94 | GAUDI_QUEUE_ID_TPC_1_2 = 47, |
| 95 | GAUDI_QUEUE_ID_TPC_1_3 = 48, |
| 96 | GAUDI_QUEUE_ID_TPC_2_0 = 49, |
| 97 | GAUDI_QUEUE_ID_TPC_2_1 = 50, |
| 98 | GAUDI_QUEUE_ID_TPC_2_2 = 51, |
| 99 | GAUDI_QUEUE_ID_TPC_2_3 = 52, |
| 100 | GAUDI_QUEUE_ID_TPC_3_0 = 53, |
| 101 | GAUDI_QUEUE_ID_TPC_3_1 = 54, |
| 102 | GAUDI_QUEUE_ID_TPC_3_2 = 55, |
| 103 | GAUDI_QUEUE_ID_TPC_3_3 = 56, |
| 104 | GAUDI_QUEUE_ID_TPC_4_0 = 57, |
| 105 | GAUDI_QUEUE_ID_TPC_4_1 = 58, |
| 106 | GAUDI_QUEUE_ID_TPC_4_2 = 59, |
| 107 | GAUDI_QUEUE_ID_TPC_4_3 = 60, |
| 108 | GAUDI_QUEUE_ID_TPC_5_0 = 61, |
| 109 | GAUDI_QUEUE_ID_TPC_5_1 = 62, |
| 110 | GAUDI_QUEUE_ID_TPC_5_2 = 63, |
| 111 | GAUDI_QUEUE_ID_TPC_5_3 = 64, |
| 112 | GAUDI_QUEUE_ID_TPC_6_0 = 65, |
| 113 | GAUDI_QUEUE_ID_TPC_6_1 = 66, |
| 114 | GAUDI_QUEUE_ID_TPC_6_2 = 67, |
| 115 | GAUDI_QUEUE_ID_TPC_6_3 = 68, |
| 116 | GAUDI_QUEUE_ID_TPC_7_0 = 69, |
| 117 | GAUDI_QUEUE_ID_TPC_7_1 = 70, |
| 118 | GAUDI_QUEUE_ID_TPC_7_2 = 71, |
| 119 | GAUDI_QUEUE_ID_TPC_7_3 = 72, |
| 120 | GAUDI_QUEUE_ID_NIC_0_0 = 73, |
| 121 | GAUDI_QUEUE_ID_NIC_0_1 = 74, |
| 122 | GAUDI_QUEUE_ID_NIC_0_2 = 75, |
| 123 | GAUDI_QUEUE_ID_NIC_0_3 = 76, |
| 124 | GAUDI_QUEUE_ID_NIC_1_0 = 77, |
| 125 | GAUDI_QUEUE_ID_NIC_1_1 = 78, |
| 126 | GAUDI_QUEUE_ID_NIC_1_2 = 79, |
| 127 | GAUDI_QUEUE_ID_NIC_1_3 = 80, |
| 128 | GAUDI_QUEUE_ID_NIC_2_0 = 81, |
| 129 | GAUDI_QUEUE_ID_NIC_2_1 = 82, |
| 130 | GAUDI_QUEUE_ID_NIC_2_2 = 83, |
| 131 | GAUDI_QUEUE_ID_NIC_2_3 = 84, |
| 132 | GAUDI_QUEUE_ID_NIC_3_0 = 85, |
| 133 | GAUDI_QUEUE_ID_NIC_3_1 = 86, |
| 134 | GAUDI_QUEUE_ID_NIC_3_2 = 87, |
| 135 | GAUDI_QUEUE_ID_NIC_3_3 = 88, |
| 136 | GAUDI_QUEUE_ID_NIC_4_0 = 89, |
| 137 | GAUDI_QUEUE_ID_NIC_4_1 = 90, |
| 138 | GAUDI_QUEUE_ID_NIC_4_2 = 91, |
| 139 | GAUDI_QUEUE_ID_NIC_4_3 = 92, |
| 140 | GAUDI_QUEUE_ID_NIC_5_0 = 93, |
| 141 | GAUDI_QUEUE_ID_NIC_5_1 = 94, |
| 142 | GAUDI_QUEUE_ID_NIC_5_2 = 95, |
| 143 | GAUDI_QUEUE_ID_NIC_5_3 = 96, |
| 144 | GAUDI_QUEUE_ID_NIC_6_0 = 97, |
| 145 | GAUDI_QUEUE_ID_NIC_6_1 = 98, |
| 146 | GAUDI_QUEUE_ID_NIC_6_2 = 99, |
| 147 | GAUDI_QUEUE_ID_NIC_6_3 = 100, |
| 148 | GAUDI_QUEUE_ID_NIC_7_0 = 101, |
| 149 | GAUDI_QUEUE_ID_NIC_7_1 = 102, |
| 150 | GAUDI_QUEUE_ID_NIC_7_2 = 103, |
| 151 | GAUDI_QUEUE_ID_NIC_7_3 = 104, |
| 152 | GAUDI_QUEUE_ID_NIC_8_0 = 105, |
| 153 | GAUDI_QUEUE_ID_NIC_8_1 = 106, |
| 154 | GAUDI_QUEUE_ID_NIC_8_2 = 107, |
| 155 | GAUDI_QUEUE_ID_NIC_8_3 = 108, |
| 156 | GAUDI_QUEUE_ID_NIC_9_0 = 109, |
| 157 | GAUDI_QUEUE_ID_NIC_9_1 = 110, |
| 158 | GAUDI_QUEUE_ID_NIC_9_2 = 111, |
| 159 | GAUDI_QUEUE_ID_NIC_9_3 = 112, |
| 160 | GAUDI_QUEUE_ID_SIZE |
| 161 | }; |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 162 | enum goya_engine_id { |
| 163 | GOYA_ENGINE_ID_DMA_0 = 0, |
| 164 | GOYA_ENGINE_ID_DMA_1, |
| 165 | GOYA_ENGINE_ID_DMA_2, |
| 166 | GOYA_ENGINE_ID_DMA_3, |
| 167 | GOYA_ENGINE_ID_DMA_4, |
| 168 | GOYA_ENGINE_ID_MME_0, |
| 169 | GOYA_ENGINE_ID_TPC_0, |
| 170 | GOYA_ENGINE_ID_TPC_1, |
| 171 | GOYA_ENGINE_ID_TPC_2, |
| 172 | GOYA_ENGINE_ID_TPC_3, |
| 173 | GOYA_ENGINE_ID_TPC_4, |
| 174 | GOYA_ENGINE_ID_TPC_5, |
| 175 | GOYA_ENGINE_ID_TPC_6, |
| 176 | GOYA_ENGINE_ID_TPC_7, |
| 177 | GOYA_ENGINE_ID_SIZE |
| 178 | }; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 179 | enum gaudi_engine_id { |
| 180 | GAUDI_ENGINE_ID_DMA_0 = 0, |
| 181 | GAUDI_ENGINE_ID_DMA_1, |
| 182 | GAUDI_ENGINE_ID_DMA_2, |
| 183 | GAUDI_ENGINE_ID_DMA_3, |
| 184 | GAUDI_ENGINE_ID_DMA_4, |
| 185 | GAUDI_ENGINE_ID_DMA_5, |
| 186 | GAUDI_ENGINE_ID_DMA_6, |
| 187 | GAUDI_ENGINE_ID_DMA_7, |
| 188 | GAUDI_ENGINE_ID_MME_0, |
| 189 | GAUDI_ENGINE_ID_MME_1, |
| 190 | GAUDI_ENGINE_ID_MME_2, |
| 191 | GAUDI_ENGINE_ID_MME_3, |
| 192 | GAUDI_ENGINE_ID_TPC_0, |
| 193 | GAUDI_ENGINE_ID_TPC_1, |
| 194 | GAUDI_ENGINE_ID_TPC_2, |
| 195 | GAUDI_ENGINE_ID_TPC_3, |
| 196 | GAUDI_ENGINE_ID_TPC_4, |
| 197 | GAUDI_ENGINE_ID_TPC_5, |
| 198 | GAUDI_ENGINE_ID_TPC_6, |
| 199 | GAUDI_ENGINE_ID_TPC_7, |
| 200 | GAUDI_ENGINE_ID_NIC_0, |
| 201 | GAUDI_ENGINE_ID_NIC_1, |
| 202 | GAUDI_ENGINE_ID_NIC_2, |
| 203 | GAUDI_ENGINE_ID_NIC_3, |
| 204 | GAUDI_ENGINE_ID_NIC_4, |
| 205 | GAUDI_ENGINE_ID_NIC_5, |
| 206 | GAUDI_ENGINE_ID_NIC_6, |
| 207 | GAUDI_ENGINE_ID_NIC_7, |
| 208 | GAUDI_ENGINE_ID_NIC_8, |
| 209 | GAUDI_ENGINE_ID_NIC_9, |
| 210 | GAUDI_ENGINE_ID_SIZE |
| 211 | }; |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 212 | enum hl_goya_pll_index { |
| 213 | HL_GOYA_CPU_PLL = 0, |
| 214 | HL_GOYA_IC_PLL, |
| 215 | HL_GOYA_MC_PLL, |
| 216 | HL_GOYA_MME_PLL, |
| 217 | HL_GOYA_PCI_PLL, |
| 218 | HL_GOYA_EMMC_PLL, |
| 219 | HL_GOYA_TPC_PLL, |
| 220 | HL_GOYA_PLL_MAX |
| 221 | }; |
| 222 | enum hl_gaudi_pll_index { |
| 223 | HL_GAUDI_CPU_PLL = 0, |
| 224 | HL_GAUDI_PCI_PLL, |
| 225 | HL_GAUDI_SRAM_PLL, |
| 226 | HL_GAUDI_HBM_PLL, |
| 227 | HL_GAUDI_NIC_PLL, |
| 228 | HL_GAUDI_DMA_PLL, |
| 229 | HL_GAUDI_MESH_PLL, |
| 230 | HL_GAUDI_MME_PLL, |
| 231 | HL_GAUDI_TPC_PLL, |
| 232 | HL_GAUDI_IF_PLL, |
| 233 | HL_GAUDI_PLL_MAX |
| 234 | }; |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 235 | enum hl_device_status { |
| 236 | HL_DEVICE_STATUS_OPERATIONAL, |
| 237 | HL_DEVICE_STATUS_IN_RESET, |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 238 | HL_DEVICE_STATUS_MALFUNCTION, |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 239 | HL_DEVICE_STATUS_NEEDS_RESET, |
| 240 | HL_DEVICE_STATUS_IN_DEVICE_CREATION, |
| 241 | HL_DEVICE_STATUS_LAST = HL_DEVICE_STATUS_IN_DEVICE_CREATION |
| 242 | }; |
| 243 | enum hl_server_type { |
| 244 | HL_SERVER_TYPE_UNKNOWN = 0, |
| 245 | HL_SERVER_GAUDI_HLS1 = 1, |
| 246 | HL_SERVER_GAUDI_HLS1H = 2, |
| 247 | HL_SERVER_GAUDI_TYPE1 = 3, |
| 248 | HL_SERVER_GAUDI_TYPE2 = 4 |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 249 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 250 | #define HL_INFO_HW_IP_INFO 0 |
| 251 | #define HL_INFO_HW_EVENTS 1 |
| 252 | #define HL_INFO_DRAM_USAGE 2 |
| 253 | #define HL_INFO_HW_IDLE 3 |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 254 | #define HL_INFO_DEVICE_STATUS 4 |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 255 | #define HL_INFO_DEVICE_UTILIZATION 6 |
| 256 | #define HL_INFO_HW_EVENTS_AGGREGATE 7 |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 257 | #define HL_INFO_CLK_RATE 8 |
| 258 | #define HL_INFO_RESET_COUNT 9 |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 259 | #define HL_INFO_TIME_SYNC 10 |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 260 | #define HL_INFO_CS_COUNTERS 11 |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 261 | #define HL_INFO_PCI_COUNTERS 12 |
| 262 | #define HL_INFO_CLK_THROTTLE_REASON 13 |
| 263 | #define HL_INFO_SYNC_MANAGER 14 |
| 264 | #define HL_INFO_TOTAL_ENERGY 15 |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 265 | #define HL_INFO_PLL_FREQUENCY 16 |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 266 | #define HL_INFO_POWER 17 |
Christopher Ferris | 3a39c0b | 2021-09-02 00:03:38 +0000 | [diff] [blame] | 267 | #define HL_INFO_OPEN_STATS 18 |
Christopher Ferris | 1ed5534 | 2022-03-22 16:06:25 -0700 | [diff] [blame] | 268 | #define HL_INFO_DRAM_REPLACED_ROWS 21 |
| 269 | #define HL_INFO_DRAM_PENDING_ROWS 22 |
| 270 | #define HL_INFO_LAST_ERR_OPEN_DEV_TIME 23 |
| 271 | #define HL_INFO_CS_TIMEOUT_EVENT 24 |
| 272 | #define HL_INFO_RAZWI_EVENT 25 |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame^] | 273 | #define HL_INFO_DEV_MEM_ALLOC_PAGE_SIZES 26 |
| 274 | #define HL_INFO_REGISTER_EVENTFD 28 |
| 275 | #define HL_INFO_UNREGISTER_EVENTFD 29 |
| 276 | #define HL_INFO_GET_EVENTS 30 |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 277 | #define HL_INFO_VERSION_MAX_LEN 128 |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 278 | #define HL_INFO_CARD_NAME_MAX_LEN 16 |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 279 | struct hl_info_hw_ip_info { |
| 280 | __u64 sram_base_address; |
| 281 | __u64 dram_base_address; |
| 282 | __u64 dram_size; |
| 283 | __u32 sram_size; |
| 284 | __u32 num_of_events; |
| 285 | __u32 device_id; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 286 | __u32 module_id; |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 287 | __u32 reserved; |
| 288 | __u16 first_available_interrupt_id; |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 289 | __u16 server_type; |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 290 | __u32 cpld_version; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 291 | __u32 psoc_pci_pll_nr; |
| 292 | __u32 psoc_pci_pll_nf; |
| 293 | __u32 psoc_pci_pll_od; |
| 294 | __u32 psoc_pci_pll_div_factor; |
| 295 | __u8 tpc_enabled_mask; |
| 296 | __u8 dram_enabled; |
| 297 | __u8 pad[2]; |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 298 | __u8 cpucp_version[HL_INFO_VERSION_MAX_LEN]; |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 299 | __u8 card_name[HL_INFO_CARD_NAME_MAX_LEN]; |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 300 | __u64 reserved2; |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 301 | __u64 dram_page_size; |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 302 | __u32 reserved3; |
| 303 | __u16 number_of_user_interrupts; |
| 304 | __u16 pad2; |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame^] | 305 | __u64 reserved4; |
| 306 | __u64 device_mem_alloc_default_page_size; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 307 | }; |
| 308 | struct hl_info_dram_usage { |
| 309 | __u64 dram_free_mem; |
| 310 | __u64 ctx_dram_mem; |
| 311 | }; |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 312 | #define HL_BUSY_ENGINES_MASK_EXT_SIZE 2 |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 313 | struct hl_info_hw_idle { |
| 314 | __u32 is_idle; |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 315 | __u32 busy_engines_mask; |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 316 | __u64 busy_engines_mask_ext[HL_BUSY_ENGINES_MASK_EXT_SIZE]; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 317 | }; |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 318 | struct hl_info_device_status { |
| 319 | __u32 status; |
| 320 | __u32 pad; |
| 321 | }; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 322 | struct hl_info_device_utilization { |
| 323 | __u32 utilization; |
| 324 | __u32 pad; |
| 325 | }; |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 326 | struct hl_info_clk_rate { |
| 327 | __u32 cur_clk_rate_mhz; |
| 328 | __u32 max_clk_rate_mhz; |
| 329 | }; |
| 330 | struct hl_info_reset_count { |
| 331 | __u32 hard_reset_cnt; |
| 332 | __u32 soft_reset_cnt; |
| 333 | }; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 334 | struct hl_info_time_sync { |
| 335 | __u64 device_time; |
| 336 | __u64 host_time; |
| 337 | }; |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 338 | struct hl_info_pci_counters { |
| 339 | __u64 rx_throughput; |
| 340 | __u64 tx_throughput; |
| 341 | __u64 replay_cnt; |
| 342 | }; |
Christopher Ferris | 1ed5534 | 2022-03-22 16:06:25 -0700 | [diff] [blame] | 343 | enum hl_clk_throttling_type { |
| 344 | HL_CLK_THROTTLE_TYPE_POWER, |
| 345 | HL_CLK_THROTTLE_TYPE_THERMAL, |
| 346 | HL_CLK_THROTTLE_TYPE_MAX |
| 347 | }; |
| 348 | #define HL_CLK_THROTTLE_POWER (1 << HL_CLK_THROTTLE_TYPE_POWER) |
| 349 | #define HL_CLK_THROTTLE_THERMAL (1 << HL_CLK_THROTTLE_TYPE_THERMAL) |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 350 | struct hl_info_clk_throttle { |
| 351 | __u32 clk_throttling_reason; |
Christopher Ferris | 1ed5534 | 2022-03-22 16:06:25 -0700 | [diff] [blame] | 352 | __u32 pad; |
| 353 | __u64 clk_throttling_timestamp_us[HL_CLK_THROTTLE_TYPE_MAX]; |
| 354 | __u64 clk_throttling_duration_ns[HL_CLK_THROTTLE_TYPE_MAX]; |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 355 | }; |
| 356 | struct hl_info_energy { |
| 357 | __u64 total_energy_consumption; |
| 358 | }; |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 359 | #define HL_PLL_NUM_OUTPUTS 4 |
| 360 | struct hl_pll_frequency_info { |
| 361 | __u16 output[HL_PLL_NUM_OUTPUTS]; |
| 362 | }; |
Christopher Ferris | 3a39c0b | 2021-09-02 00:03:38 +0000 | [diff] [blame] | 363 | struct hl_open_stats_info { |
| 364 | __u64 open_counter; |
| 365 | __u64 last_open_period_ms; |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame^] | 366 | __u8 is_compute_ctx_active; |
| 367 | __u8 compute_ctx_in_release; |
| 368 | __u8 pad[6]; |
Christopher Ferris | 3a39c0b | 2021-09-02 00:03:38 +0000 | [diff] [blame] | 369 | }; |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 370 | struct hl_power_info { |
| 371 | __u64 power; |
| 372 | }; |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 373 | struct hl_info_sync_manager { |
| 374 | __u32 first_available_sync_object; |
| 375 | __u32 first_available_monitor; |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 376 | __u32 first_available_cq; |
| 377 | __u32 reserved; |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 378 | }; |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 379 | struct hl_info_cs_counters { |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 380 | __u64 total_out_of_mem_drop_cnt; |
| 381 | __u64 ctx_out_of_mem_drop_cnt; |
| 382 | __u64 total_parsing_drop_cnt; |
| 383 | __u64 ctx_parsing_drop_cnt; |
| 384 | __u64 total_queue_full_drop_cnt; |
| 385 | __u64 ctx_queue_full_drop_cnt; |
| 386 | __u64 total_device_in_reset_drop_cnt; |
| 387 | __u64 ctx_device_in_reset_drop_cnt; |
| 388 | __u64 total_max_cs_in_flight_drop_cnt; |
| 389 | __u64 ctx_max_cs_in_flight_drop_cnt; |
| 390 | __u64 total_validation_drop_cnt; |
| 391 | __u64 ctx_validation_drop_cnt; |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 392 | }; |
Christopher Ferris | 1ed5534 | 2022-03-22 16:06:25 -0700 | [diff] [blame] | 393 | struct hl_info_last_err_open_dev_time { |
| 394 | __s64 timestamp; |
| 395 | }; |
| 396 | struct hl_info_cs_timeout_event { |
| 397 | __s64 timestamp; |
| 398 | __u64 seq; |
| 399 | }; |
| 400 | #define HL_RAZWI_PAGE_FAULT 0 |
| 401 | #define HL_RAZWI_MMU_ACCESS_ERROR 1 |
| 402 | struct hl_info_razwi_event { |
| 403 | __s64 timestamp; |
| 404 | __u64 addr; |
| 405 | __u16 engine_id_1; |
| 406 | __u16 engine_id_2; |
| 407 | __u8 no_engine_id; |
| 408 | __u8 error_type; |
| 409 | __u8 pad[2]; |
| 410 | }; |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame^] | 411 | struct hl_info_dev_memalloc_page_sizes { |
| 412 | __u64 page_order_bitmask; |
| 413 | }; |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 414 | enum gaudi_dcores { |
| 415 | HL_GAUDI_WS_DCORE, |
| 416 | HL_GAUDI_WN_DCORE, |
| 417 | HL_GAUDI_EN_DCORE, |
| 418 | HL_GAUDI_ES_DCORE |
| 419 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 420 | struct hl_info_args { |
| 421 | __u64 return_pointer; |
| 422 | __u32 return_size; |
| 423 | __u32 op; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 424 | union { |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 425 | __u32 dcore_id; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 426 | __u32 ctx_id; |
| 427 | __u32 period_ms; |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 428 | __u32 pll_index; |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame^] | 429 | __u32 eventfd; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 430 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 431 | __u32 pad; |
| 432 | }; |
| 433 | #define HL_CB_OP_CREATE 0 |
| 434 | #define HL_CB_OP_DESTROY 1 |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 435 | #define HL_CB_OP_INFO 2 |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 436 | #define HL_MAX_CB_SIZE (0x200000 - 32) |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 437 | #define HL_CB_FLAGS_MAP 0x1 |
Christopher Ferris | 1ed5534 | 2022-03-22 16:06:25 -0700 | [diff] [blame] | 438 | #define HL_CB_FLAGS_GET_DEVICE_VA 0x2 |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 439 | struct hl_cb_in { |
| 440 | __u64 cb_handle; |
| 441 | __u32 op; |
| 442 | __u32 cb_size; |
| 443 | __u32 ctx_id; |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 444 | __u32 flags; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 445 | }; |
| 446 | struct hl_cb_out { |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 447 | union { |
| 448 | __u64 cb_handle; |
Christopher Ferris | 1ed5534 | 2022-03-22 16:06:25 -0700 | [diff] [blame] | 449 | union { |
| 450 | struct { |
| 451 | __u32 usage_cnt; |
| 452 | __u32 pad; |
| 453 | }; |
| 454 | __u64 device_va; |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 455 | }; |
| 456 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 457 | }; |
| 458 | union hl_cb_args { |
| 459 | struct hl_cb_in in; |
| 460 | struct hl_cb_out out; |
| 461 | }; |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 462 | #define HL_CS_CHUNK_FLAGS_USER_ALLOC_CB 0x1 |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 463 | struct hl_cs_chunk { |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 464 | union { |
| 465 | __u64 cb_handle; |
| 466 | __u64 signal_seq_arr; |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 467 | __u64 encaps_signal_seq; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 468 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 469 | __u32 queue_index; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 470 | union { |
| 471 | __u32 cb_size; |
| 472 | __u32 num_signal_seq_arr; |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 473 | __u32 encaps_signal_offset; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 474 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 475 | __u32 cs_chunk_flags; |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 476 | __u32 collective_engine_id; |
| 477 | __u32 pad[10]; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 478 | }; |
| 479 | #define HL_CS_FLAGS_FORCE_RESTORE 0x1 |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 480 | #define HL_CS_FLAGS_SIGNAL 0x2 |
| 481 | #define HL_CS_FLAGS_WAIT 0x4 |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 482 | #define HL_CS_FLAGS_COLLECTIVE_WAIT 0x8 |
| 483 | #define HL_CS_FLAGS_TIMESTAMP 0x20 |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 484 | #define HL_CS_FLAGS_STAGED_SUBMISSION 0x40 |
| 485 | #define HL_CS_FLAGS_STAGED_SUBMISSION_FIRST 0x80 |
| 486 | #define HL_CS_FLAGS_STAGED_SUBMISSION_LAST 0x100 |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 487 | #define HL_CS_FLAGS_CUSTOM_TIMEOUT 0x200 |
Christopher Ferris | 3a39c0b | 2021-09-02 00:03:38 +0000 | [diff] [blame] | 488 | #define HL_CS_FLAGS_SKIP_RESET_ON_TIMEOUT 0x400 |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 489 | #define HL_CS_FLAGS_ENCAP_SIGNALS 0x800 |
| 490 | #define HL_CS_FLAGS_RESERVE_SIGNALS_ONLY 0x1000 |
| 491 | #define HL_CS_FLAGS_UNRESERVE_SIGNALS_ONLY 0x2000 |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 492 | #define HL_CS_STATUS_SUCCESS 0 |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 493 | #define HL_MAX_JOBS_PER_CS 512 |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 494 | struct hl_cs_in { |
| 495 | __u64 chunks_restore; |
| 496 | __u64 chunks_execute; |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 497 | union { |
| 498 | __u64 seq; |
| 499 | __u32 encaps_sig_handle_id; |
| 500 | struct { |
| 501 | __u32 encaps_signals_count; |
| 502 | __u32 encaps_signals_q_idx; |
| 503 | }; |
| 504 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 505 | __u32 num_chunks_restore; |
| 506 | __u32 num_chunks_execute; |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 507 | __u32 timeout; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 508 | __u32 cs_flags; |
| 509 | __u32 ctx_id; |
| 510 | }; |
| 511 | struct hl_cs_out { |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 512 | union { |
| 513 | __u64 seq; |
| 514 | struct { |
| 515 | __u32 handle_id; |
| 516 | __u32 count; |
| 517 | }; |
| 518 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 519 | __u32 status; |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 520 | __u32 sob_base_addr_offset; |
Christopher Ferris | 1ed5534 | 2022-03-22 16:06:25 -0700 | [diff] [blame] | 521 | __u16 sob_count_before_submission; |
| 522 | __u16 pad[3]; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 523 | }; |
| 524 | union hl_cs_args { |
| 525 | struct hl_cs_in in; |
| 526 | struct hl_cs_out out; |
| 527 | }; |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 528 | #define HL_WAIT_CS_FLAGS_INTERRUPT 0x2 |
| 529 | #define HL_WAIT_CS_FLAGS_INTERRUPT_MASK 0xFFF00000 |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 530 | #define HL_WAIT_CS_FLAGS_MULTI_CS 0x4 |
Christopher Ferris | 1ed5534 | 2022-03-22 16:06:25 -0700 | [diff] [blame] | 531 | #define HL_WAIT_CS_FLAGS_INTERRUPT_KERNEL_CQ 0x10 |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 532 | #define HL_WAIT_CS_FLAGS_REGISTER_INTERRUPT 0x20 |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 533 | #define HL_WAIT_MULTI_CS_LIST_MAX_LEN 32 |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 534 | struct hl_wait_cs_in { |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 535 | union { |
| 536 | struct { |
| 537 | __u64 seq; |
| 538 | __u64 timeout_us; |
| 539 | }; |
| 540 | struct { |
Christopher Ferris | 1ed5534 | 2022-03-22 16:06:25 -0700 | [diff] [blame] | 541 | union { |
| 542 | __u64 addr; |
| 543 | __u64 cq_counters_handle; |
| 544 | }; |
Christopher Ferris | a479261 | 2022-01-10 13:51:15 -0800 | [diff] [blame] | 545 | __u64 target; |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 546 | }; |
| 547 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 548 | __u32 ctx_id; |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 549 | __u32 flags; |
Christopher Ferris | 1ed5534 | 2022-03-22 16:06:25 -0700 | [diff] [blame] | 550 | union { |
| 551 | struct { |
| 552 | __u8 seq_arr_len; |
| 553 | __u8 pad[7]; |
| 554 | }; |
| 555 | __u64 interrupt_timeout_us; |
| 556 | }; |
| 557 | __u64 cq_counters_offset; |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 558 | __u64 timestamp_handle; |
| 559 | __u64 timestamp_offset; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 560 | }; |
| 561 | #define HL_WAIT_CS_STATUS_COMPLETED 0 |
| 562 | #define HL_WAIT_CS_STATUS_BUSY 1 |
| 563 | #define HL_WAIT_CS_STATUS_TIMEDOUT 2 |
| 564 | #define HL_WAIT_CS_STATUS_ABORTED 3 |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 565 | #define HL_WAIT_CS_STATUS_FLAG_GONE 0x1 |
| 566 | #define HL_WAIT_CS_STATUS_FLAG_TIMESTAMP_VLD 0x2 |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 567 | struct hl_wait_cs_out { |
| 568 | __u32 status; |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 569 | __u32 flags; |
| 570 | __s64 timestamp_nsec; |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 571 | __u32 cs_completion_map; |
| 572 | __u32 pad; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 573 | }; |
| 574 | union hl_wait_cs_args { |
| 575 | struct hl_wait_cs_in in; |
| 576 | struct hl_wait_cs_out out; |
| 577 | }; |
| 578 | #define HL_MEM_OP_ALLOC 0 |
| 579 | #define HL_MEM_OP_FREE 1 |
| 580 | #define HL_MEM_OP_MAP 2 |
| 581 | #define HL_MEM_OP_UNMAP 3 |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 582 | #define HL_MEM_OP_MAP_BLOCK 4 |
Christopher Ferris | a479261 | 2022-01-10 13:51:15 -0800 | [diff] [blame] | 583 | #define HL_MEM_OP_EXPORT_DMABUF_FD 5 |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 584 | #define HL_MEM_OP_TS_ALLOC 6 |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 585 | #define HL_MEM_CONTIGUOUS 0x1 |
| 586 | #define HL_MEM_SHARED 0x2 |
| 587 | #define HL_MEM_USERPTR 0x4 |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 588 | #define HL_MEM_FORCE_HINT 0x8 |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame^] | 589 | #define HL_MEM_PREFETCH 0x40 |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 590 | struct hl_mem_in { |
| 591 | union { |
| 592 | struct { |
| 593 | __u64 mem_size; |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 594 | __u64 page_size; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 595 | } alloc; |
| 596 | struct { |
| 597 | __u64 handle; |
| 598 | } free; |
| 599 | struct { |
| 600 | __u64 hint_addr; |
| 601 | __u64 handle; |
| 602 | } map_device; |
| 603 | struct { |
| 604 | __u64 host_virt_addr; |
| 605 | __u64 hint_addr; |
| 606 | __u64 mem_size; |
| 607 | } map_host; |
| 608 | struct { |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 609 | __u64 block_addr; |
| 610 | } map_block; |
| 611 | struct { |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 612 | __u64 device_virt_addr; |
| 613 | } unmap; |
Christopher Ferris | a479261 | 2022-01-10 13:51:15 -0800 | [diff] [blame] | 614 | struct { |
| 615 | __u64 handle; |
| 616 | __u64 mem_size; |
| 617 | } export_dmabuf_fd; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 618 | }; |
| 619 | __u32 op; |
| 620 | __u32 flags; |
| 621 | __u32 ctx_id; |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 622 | __u32 num_of_elements; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 623 | }; |
| 624 | struct hl_mem_out { |
| 625 | union { |
| 626 | __u64 device_virt_addr; |
| 627 | __u64 handle; |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 628 | struct { |
| 629 | __u64 block_handle; |
| 630 | __u32 block_size; |
| 631 | __u32 pad; |
| 632 | }; |
Christopher Ferris | a479261 | 2022-01-10 13:51:15 -0800 | [diff] [blame] | 633 | __s32 fd; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 634 | }; |
| 635 | }; |
| 636 | union hl_mem_args { |
| 637 | struct hl_mem_in in; |
| 638 | struct hl_mem_out out; |
| 639 | }; |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 640 | #define HL_DEBUG_MAX_AUX_VALUES 10 |
| 641 | struct hl_debug_params_etr { |
| 642 | __u64 buffer_address; |
| 643 | __u64 buffer_size; |
| 644 | __u32 sink_mode; |
| 645 | __u32 pad; |
| 646 | }; |
| 647 | struct hl_debug_params_etf { |
| 648 | __u64 buffer_address; |
| 649 | __u64 buffer_size; |
| 650 | __u32 sink_mode; |
| 651 | __u32 pad; |
| 652 | }; |
| 653 | struct hl_debug_params_stm { |
| 654 | __u64 he_mask; |
| 655 | __u64 sp_mask; |
| 656 | __u32 id; |
| 657 | __u32 frequency; |
| 658 | }; |
| 659 | struct hl_debug_params_bmon { |
| 660 | __u64 start_addr0; |
| 661 | __u64 addr_mask0; |
| 662 | __u64 start_addr1; |
| 663 | __u64 addr_mask1; |
| 664 | __u32 bw_win; |
| 665 | __u32 win_capture; |
| 666 | __u32 id; |
| 667 | __u32 pad; |
| 668 | }; |
| 669 | struct hl_debug_params_spmu { |
| 670 | __u64 event_types[HL_DEBUG_MAX_AUX_VALUES]; |
| 671 | __u32 event_types_num; |
| 672 | __u32 pad; |
| 673 | }; |
| 674 | #define HL_DEBUG_OP_ETR 0 |
| 675 | #define HL_DEBUG_OP_ETF 1 |
| 676 | #define HL_DEBUG_OP_STM 2 |
| 677 | #define HL_DEBUG_OP_FUNNEL 3 |
| 678 | #define HL_DEBUG_OP_BMON 4 |
| 679 | #define HL_DEBUG_OP_SPMU 5 |
| 680 | #define HL_DEBUG_OP_TIMESTAMP 6 |
| 681 | #define HL_DEBUG_OP_SET_MODE 7 |
| 682 | struct hl_debug_args { |
| 683 | __u64 input_ptr; |
| 684 | __u64 output_ptr; |
| 685 | __u32 input_size; |
| 686 | __u32 output_size; |
| 687 | __u32 op; |
| 688 | __u32 reg_idx; |
| 689 | __u32 enable; |
| 690 | __u32 ctx_id; |
| 691 | }; |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame^] | 692 | #define HL_NOTIFIER_EVENT_TPC_ASSERT (1 << 0) |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 693 | #define HL_IOCTL_INFO _IOWR('H', 0x01, struct hl_info_args) |
| 694 | #define HL_IOCTL_CB _IOWR('H', 0x02, union hl_cb_args) |
| 695 | #define HL_IOCTL_CS _IOWR('H', 0x03, union hl_cs_args) |
| 696 | #define HL_IOCTL_WAIT_CS _IOWR('H', 0x04, union hl_wait_cs_args) |
| 697 | #define HL_IOCTL_MEMORY _IOWR('H', 0x05, union hl_mem_args) |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 698 | #define HL_IOCTL_DEBUG _IOWR('H', 0x06, struct hl_debug_args) |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 699 | #define HL_COMMAND_START 0x01 |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 700 | #define HL_COMMAND_END 0x07 |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 701 | #endif |