Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 338 lines 7.3 kB view raw
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* Copyright (c) 2017 The Linux Foundation. All rights reserved. */ 3 4#ifndef _A6XX_HFI_H_ 5#define _A6XX_HFI_H_ 6 7#define HFI_MAX_QUEUES 3 8 9struct a6xx_hfi_queue_table_header { 10 u32 version; 11 u32 size; /* Size of the queue table in dwords */ 12 u32 qhdr0_offset; /* Offset of the first queue header */ 13 u32 qhdr_size; /* Size of the queue headers */ 14 u32 num_queues; /* Number of total queues */ 15 u32 active_queues; /* Number of active queues */ 16} __packed; 17 18struct a6xx_hfi_queue_header { 19 u32 status; 20 u32 iova; 21 u32 type; 22 u32 size; 23 u32 msg_size; 24 u32 dropped; 25 u32 rx_watermark; 26 u32 tx_watermark; 27 u32 rx_request; 28 u32 tx_request; 29 u32 read_index; 30 u32 write_index; 31} __packed; 32 33struct a6xx_hfi_queue { 34 struct a6xx_hfi_queue_header *header; 35 spinlock_t lock; 36 u32 *data; 37 atomic_t seqnum; 38 39 /* 40 * Tracking for the start index of the last N messages in the 41 * queue, for the benefit of devcore dump / crashdec (since 42 * parsing in the reverse direction to decode the last N 43 * messages is difficult to do and would rely on heuristics 44 * which are not guaranteed to be correct) 45 */ 46#define HFI_HISTORY_SZ 8 47 s32 history[HFI_HISTORY_SZ]; 48 u8 history_idx; 49}; 50 51/* This is the outgoing queue to the GMU */ 52#define HFI_COMMAND_QUEUE 0 53 54/* THis is the incoming response queue from the GMU */ 55#define HFI_RESPONSE_QUEUE 1 56 57#define HFI_HEADER_ID(msg) ((msg) & 0xff) 58#define HFI_HEADER_SIZE(msg) (((msg) >> 8) & 0xff) 59#define HFI_HEADER_SEQNUM(msg) (((msg) >> 20) & 0xfff) 60 61/* FIXME: Do we need this or can we use ARRAY_SIZE? */ 62#define HFI_RESPONSE_PAYLOAD_SIZE 16 63 64/* HFI message types */ 65 66#define HFI_MSG_CMD 0 67#define HFI_MSG_ACK 1 68#define HFI_MSG_ACK_V1 2 69 70#define HFI_F2H_MSG_ACK 126 71 72struct a6xx_hfi_msg_response { 73 u32 header; 74 u32 ret_header; 75 u32 error; 76 u32 payload[HFI_RESPONSE_PAYLOAD_SIZE]; 77} __packed; 78 79#define HFI_F2H_MSG_ERROR 100 80 81struct a6xx_hfi_msg_error { 82 u32 header; 83 u32 code; 84 u32 payload[2]; 85} __packed; 86 87#define HFI_H2F_MSG_INIT 0 88 89struct a6xx_hfi_msg_gmu_init_cmd { 90 u32 header; 91 u32 seg_id; 92 u32 dbg_buffer_addr; 93 u32 dbg_buffer_size; 94 u32 boot_state; 95} __packed; 96 97#define HFI_H2F_MSG_FW_VERSION 1 98 99struct a6xx_hfi_msg_fw_version { 100 u32 header; 101 u32 supported_version; 102} __packed; 103 104#define HFI_H2F_MSG_PERF_TABLE 4 105 106struct perf_level { 107 u32 vote; 108 u32 freq; 109} __packed; 110 111struct perf_gx_level { 112 u32 vote; 113 u32 acd; 114 u32 freq; 115} __packed; 116 117struct a6xx_hfi_msg_perf_table_v1 { 118 u32 header; 119 u32 num_gpu_levels; 120 u32 num_gmu_levels; 121 122 struct perf_level gx_votes[16]; 123 struct perf_level cx_votes[4]; 124} __packed; 125 126struct a6xx_hfi_msg_perf_table { 127 u32 header; 128 u32 num_gpu_levels; 129 u32 num_gmu_levels; 130 131 struct perf_gx_level gx_votes[16]; 132 struct perf_level cx_votes[4]; 133} __packed; 134 135#define HFI_H2F_MSG_BW_TABLE 3 136 137struct a6xx_hfi_msg_bw_table { 138 u32 header; 139 u32 bw_level_num; 140 u32 cnoc_cmds_num; 141 u32 ddr_cmds_num; 142 u32 cnoc_wait_bitmask; 143 u32 ddr_wait_bitmask; 144 u32 cnoc_cmds_addrs[6]; 145 u32 cnoc_cmds_data[2][6]; 146 u32 ddr_cmds_addrs[8]; 147 u32 ddr_cmds_data[16][8]; 148} __packed; 149 150#define HFI_H2F_MSG_TEST 5 151 152struct a6xx_hfi_msg_test { 153 u32 header; 154} __packed; 155 156#define HFI_H2F_MSG_ACD 7 157#define MAX_ACD_STRIDE 2 158 159struct a6xx_hfi_acd_table { 160 u32 header; 161 u32 version; 162 u32 enable_by_level; 163 u32 stride; 164 u32 num_levels; 165 u32 data[16 * MAX_ACD_STRIDE]; 166} __packed; 167 168#define CLX_DATA(irated, num_phases, clx_path, extd_intf) \ 169 ((extd_intf << 29) | \ 170 (clx_path << 28) | \ 171 (num_phases << 22) | \ 172 (irated << 16)) 173 174struct a6xx_hfi_clx_domain_v2 { 175 /** 176 * @data: BITS[0:15] Migration time 177 * BITS[16:21] Current rating 178 * BITS[22:27] Phases for domain 179 * BITS[28:28] Path notification 180 * BITS[29:31] Extra features 181 */ 182 u32 data; 183 /** @clxt: CLX time in microseconds */ 184 u32 clxt; 185 /** @clxh: CLH time in microseconds */ 186 u32 clxh; 187 /** @urg_mode: Urgent HW throttle mode of operation */ 188 u32 urg_mode; 189 /** @lkg_en: Enable leakage current estimate */ 190 u32 lkg_en; 191 /** curr_budget: Current Budget */ 192 u32 curr_budget; 193} __packed; 194 195#define HFI_H2F_MSG_CLX_TBL 8 196 197#define MAX_CLX_DOMAINS 2 198struct a6xx_hfi_clx_table_v2_cmd { 199 u32 hdr; 200 u32 version; 201 struct a6xx_hfi_clx_domain_v2 domain[MAX_CLX_DOMAINS]; 202} __packed; 203 204#define HFI_H2F_MSG_START 10 205 206struct a6xx_hfi_msg_start { 207 u32 header; 208} __packed; 209 210#define HFI_H2F_FEATURE_CTRL 11 211 212struct a6xx_hfi_msg_feature_ctrl { 213 u32 header; 214 u32 feature; 215#define HFI_FEATURE_DCVS 0 216#define HFI_FEATURE_HWSCHED 1 217#define HFI_FEATURE_PREEMPTION 2 218#define HFI_FEATURE_CLOCKS_ON 3 219#define HFI_FEATURE_BUS_ON 4 220#define HFI_FEATURE_RAIL_ON 5 221#define HFI_FEATURE_HWCG 6 222#define HFI_FEATURE_LM 7 223#define HFI_FEATURE_THROTTLE 8 224#define HFI_FEATURE_IFPC 9 225#define HFI_FEATURE_NAP 10 226#define HFI_FEATURE_BCL 11 227#define HFI_FEATURE_ACD 12 228#define HFI_FEATURE_DIDT 13 229#define HFI_FEATURE_DEPRECATED 14 230#define HFI_FEATURE_CB 15 231#define HFI_FEATURE_KPROF 16 232#define HFI_FEATURE_BAIL_OUT_TIMER 17 233#define HFI_FEATURE_GMU_STATS 18 234#define HFI_FEATURE_DBQ 19 235#define HFI_FEATURE_MINBW 20 236#define HFI_FEATURE_CLX 21 237#define HFI_FEATURE_LSR 23 238#define HFI_FEATURE_LPAC 24 239#define HFI_FEATURE_HW_FENCE 25 240#define HFI_FEATURE_PERF_NORETAIN 26 241#define HFI_FEATURE_DMS 27 242#define HFI_FEATURE_THERMAL 28 243#define HFI_FEATURE_AQE 29 244#define HFI_FEATURE_TDCVS 30 245#define HFI_FEATURE_DCE 31 246#define HFI_FEATURE_IFF_PCLX 32 247#define HFI_FEATURE_SOFT_RESET 0x10000001 248#define HFI_FEATURE_DCVS_PROFILE 0x10000002 249#define HFI_FEATURE_FAST_CTX_DESTROY 0x10000003 250 u32 enable; 251 u32 data; 252} __packed; 253 254#define HFI_H2F_MSG_CORE_FW_START 14 255 256struct a6xx_hfi_msg_core_fw_start { 257 u32 header; 258 u32 handle; 259} __packed; 260 261#define HFI_H2F_MSG_TABLE 15 262 263struct a6xx_hfi_table_entry { 264 u32 count; 265 u32 stride; 266 u32 data[]; 267} __packed; 268 269struct a6xx_hfi_table { 270 u32 header; 271 u32 version; 272 u32 type; 273#define HFI_TABLE_BW_VOTE 0 274#define HFI_TABLE_GPU_PERF 1 275#define HFI_TABLE_DIDT 2 276#define HFI_TABLE_ACD 3 277#define HFI_TABLE_CLX_V1 4 /* Unused */ 278#define HFI_TABLE_CLX_V2 5 279#define HFI_TABLE_THERM 6 280#define HFI_TABLE_DCVS 7 281#define HFI_TABLE_SYS_TIME 8 282#define HFI_TABLE_GMU_DCVS 9 283#define HFI_TABLE_LIMITS_MIT 10 284 struct a6xx_hfi_table_entry entry[]; 285} __packed; 286 287#define HFI_H2F_MSG_GX_BW_PERF_VOTE 30 288 289struct a6xx_hfi_gx_bw_perf_vote_cmd { 290 u32 header; 291 u32 ack_type; 292 u32 freq; 293 u32 bw; 294} __packed; 295 296#define AB_VOTE_MASK GENMASK(31, 16) 297#define MAX_AB_VOTE (FIELD_MAX(AB_VOTE_MASK) - 1) 298#define AB_VOTE(vote) FIELD_PREP(AB_VOTE_MASK, (vote)) 299#define AB_VOTE_ENABLE BIT(8) 300 301#define HFI_H2F_MSG_PREPARE_SLUMBER 33 302 303struct a6xx_hfi_prep_slumber_cmd { 304 u32 header; 305 u32 bw; 306 u32 freq; 307} __packed; 308 309struct a6xx_hfi_limits_cfg { 310 u32 enable; 311 u32 msg_path; 312 u32 lkg_en; 313 /* 314 * BIT[0]: 0 = (static) throttle to fixed sid level 315 * 1 = (dynamic) throttle to sid level calculated by HW 316 * BIT[1]: 0 = Mx 317 * 1 = Bx 318 */ 319 u32 mode; 320 u32 sid; 321 /* Mitigation time in microseconds */ 322 u32 mit_time; 323 /* Max current in mA during mitigation */ 324 u32 curr_limit; 325} __packed; 326 327struct a6xx_hfi_limits_tbl { 328 u8 feature_id; 329#define GMU_MIT_IFF 0 330#define GMU_MIT_PCLX 1 331 u8 domain; 332#define GMU_GX_DOMAIN 0 333#define GMU_MX_DOMAIN 1 334 u16 feature_rev; 335 struct a6xx_hfi_limits_cfg cfg; 336} __packed; 337 338#endif