1 /* SPDX-License-Identifier: MIT */ 2 /* 3 * Copyright (c) 2020-2024, Intel Corporation. 4 */ 5 6 /** 7 * @file 8 * @brief JSM shared definitions 9 * 10 * @ingroup Jsm 11 * @brief JSM shared definitions 12 * @{ 13 */ 14 #ifndef VPU_JSM_API_H 15 #define VPU_JSM_API_H 16 17 /* 18 * Major version changes that break backward compatibility 19 */ 20 #define VPU_JSM_API_VER_MAJOR 3 21 22 /* 23 * Minor version changes when API backward compatibility is preserved. 24 */ 25 #define VPU_JSM_API_VER_MINOR 16 26 27 /* 28 * API header changed (field names, documentation, formatting) but API itself has not been changed 29 */ 30 #define VPU_JSM_API_VER_PATCH 0 31 32 /* 33 * Index in the API version table 34 */ 35 #define VPU_JSM_API_VER_INDEX 4 36 37 /* 38 * Number of Priority Bands for Hardware Scheduling 39 * Bands: RealTime, Focus, Normal, Idle 40 */ 41 #define VPU_HWS_NUM_PRIORITY_BANDS 4 42 43 /* Max number of impacted contexts that can be dealt with the engine reset command */ 44 #define VPU_MAX_ENGINE_RESET_IMPACTED_CONTEXTS 3 45 46 /* 47 * Pack the API structures to enforce binary compatibility 48 * Align to 8 bytes for optimal performance 49 */ 50 #pragma pack(push, 8) 51 52 /* 53 * Engine indexes. 54 */ 55 #define VPU_ENGINE_COMPUTE 0 56 #define VPU_ENGINE_COPY 1 57 #define VPU_ENGINE_NB 2 58 59 /* 60 * VPU status values. 61 */ 62 #define VPU_JSM_STATUS_SUCCESS 0x0U 63 #define VPU_JSM_STATUS_PARSING_ERR 0x1U 64 #define VPU_JSM_STATUS_PROCESSING_ERR 0x2U 65 #define VPU_JSM_STATUS_PREEMPTED 0x3U 66 #define VPU_JSM_STATUS_ABORTED 0x4U 67 #define VPU_JSM_STATUS_USER_CTX_VIOL_ERR 0x5U 68 #define VPU_JSM_STATUS_GLOBAL_CTX_VIOL_ERR 0x6U 69 #define VPU_JSM_STATUS_MVNCI_WRONG_INPUT_FORMAT 0x7U 70 #define VPU_JSM_STATUS_MVNCI_UNSUPPORTED_NETWORK_ELEMENT 0x8U 71 #define VPU_JSM_STATUS_MVNCI_INVALID_HANDLE 0x9U 72 #define VPU_JSM_STATUS_MVNCI_OUT_OF_RESOURCES 0xAU 73 #define VPU_JSM_STATUS_MVNCI_NOT_IMPLEMENTED 0xBU 74 #define VPU_JSM_STATUS_MVNCI_INTERNAL_ERROR 0xCU 75 /* Job status returned when the job was preempted mid-inference */ 76 #define VPU_JSM_STATUS_PREEMPTED_MID_INFERENCE 0xDU 77 78 /* 79 * Host <-> VPU IPC channels. 80 * ASYNC commands use a high priority channel, other messages use low-priority ones. 81 */ 82 #define VPU_IPC_CHAN_ASYNC_CMD 0 83 #define VPU_IPC_CHAN_GEN_CMD 10 84 #define VPU_IPC_CHAN_JOB_RET 11 85 86 /* 87 * Job flags bit masks. 88 */ 89 #define VPU_JOB_FLAGS_NULL_SUBMISSION_MASK 0x00000001 90 #define VPU_JOB_FLAGS_PRIVATE_DATA_MASK 0xFF000000 91 92 /* 93 * Sizes of the reserved areas in jobs, in bytes. 94 */ 95 #define VPU_JOB_RESERVED_BYTES 8 96 97 /* 98 * Sizes of the reserved areas in job queues, in bytes. 99 */ 100 #define VPU_JOB_QUEUE_RESERVED_BYTES 52 101 102 /* 103 * Max length (including trailing NULL char) of trace entity name (e.g., the 104 * name of a logging destination or a loggable HW component). 105 */ 106 #define VPU_TRACE_ENTITY_NAME_MAX_LEN 32 107 108 /* 109 * Max length (including trailing NULL char) of a dyndbg command. 110 * 111 * NOTE: 96 is used so that the size of 'struct vpu_ipc_msg' in the JSM API is 112 * 128 bytes (multiple of 64 bytes, the cache line size). 113 */ 114 #define VPU_DYNDBG_CMD_MAX_LEN 96 115 116 /* 117 * For HWS command queue scheduling, we can prioritise command queues inside the 118 * same process with a relative in-process priority. Valid values for relative 119 * priority are given below - max and min. 120 */ 121 #define VPU_HWS_COMMAND_QUEUE_MAX_IN_PROCESS_PRIORITY 7 122 #define VPU_HWS_COMMAND_QUEUE_MIN_IN_PROCESS_PRIORITY -7 123 124 /* 125 * For HWS priority scheduling, we can have multiple realtime priority bands. 126 * They are numbered 0 to a MAX. 127 */ 128 #define VPU_HWS_MAX_REALTIME_PRIORITY_LEVEL 31U 129 130 /* 131 * vpu_jsm_engine_reset_context flag definitions 132 */ 133 #define VPU_ENGINE_RESET_CONTEXT_FLAG_COLLATERAL_DAMAGE_MASK BIT(0) 134 #define VPU_ENGINE_RESET_CONTEXT_HANG_PRIMARY_CAUSE 0 135 #define VPU_ENGINE_RESET_CONTEXT_COLLATERAL_DAMAGE 1 136 137 /* 138 * Invalid command queue handle identifier. Applies to cmdq_id and cmdq_group 139 * in this API. 140 */ 141 #define VPU_HWS_INVALID_CMDQ_HANDLE 0ULL 142 143 /* 144 * Job format. 145 */ 146 struct vpu_job_queue_entry { 147 u64 batch_buf_addr; /**< Address of VPU commands batch buffer */ 148 u32 job_id; /**< Job ID */ 149 u32 flags; /**< Flags bit field, see VPU_JOB_FLAGS_* above */ 150 u64 root_page_table_addr; /**< Address of root page table to use for this job */ 151 u64 root_page_table_update_counter; /**< Page tables update events counter */ 152 u64 primary_preempt_buf_addr; 153 /**< Address of the primary preemption buffer to use for this job */ 154 u32 primary_preempt_buf_size; 155 /**< Size of the primary preemption buffer to use for this job */ 156 u32 secondary_preempt_buf_size; 157 /**< Size of secondary preemption buffer to use for this job */ 158 u64 secondary_preempt_buf_addr; 159 /**< Address of secondary preemption buffer to use for this job */ 160 u8 reserved_0[VPU_JOB_RESERVED_BYTES]; 161 }; 162 163 /* 164 * Job queue control registers. 165 */ 166 struct vpu_job_queue_header { 167 u32 engine_idx; 168 u32 head; 169 u32 tail; 170 u8 reserved_0[VPU_JOB_QUEUE_RESERVED_BYTES]; 171 }; 172 173 /* 174 * Job queue format. 175 */ 176 struct vpu_job_queue { 177 struct vpu_job_queue_header header; 178 struct vpu_job_queue_entry job[]; 179 }; 180 181 /** 182 * Logging entity types. 183 * 184 * This enum defines the different types of entities involved in logging. 185 */ 186 enum vpu_trace_entity_type { 187 /** Logging destination (entity where logs can be stored / printed). */ 188 VPU_TRACE_ENTITY_TYPE_DESTINATION = 1, 189 /** Loggable HW component (HW entity that can be logged). */ 190 VPU_TRACE_ENTITY_TYPE_HW_COMPONENT = 2, 191 }; 192 193 /* 194 * HWS specific log buffer header details. 195 * Total size is 32 bytes. 196 */ 197 struct vpu_hws_log_buffer_header { 198 /* Written by VPU after adding a log entry. Initialised by host to 0. */ 199 u32 first_free_entry_index; 200 /* Incremented by VPU every time the VPU overwrites the 0th entry; 201 * initialised by host to 0. 202 */ 203 u32 wraparound_count; 204 /* 205 * This is the number of buffers that can be stored in the log buffer provided by the host. 206 * It is written by host before passing buffer to VPU. VPU should consider it read-only. 207 */ 208 u64 num_of_entries; 209 u64 reserved[2]; 210 }; 211 212 /* 213 * HWS specific log buffer entry details. 214 * Total size is 32 bytes. 215 */ 216 struct vpu_hws_log_buffer_entry { 217 /* VPU timestamp must be an invariant timer tick (not impacted by DVFS) */ 218 u64 vpu_timestamp; 219 /* 220 * Operation type: 221 * 0 - context state change 222 * 1 - queue new work 223 * 2 - queue unwait sync object 224 * 3 - queue no more work 225 * 4 - queue wait sync object 226 */ 227 u32 operation_type; 228 u32 reserved; 229 /* Operation data depends on operation type */ 230 u64 operation_data[2]; 231 }; 232 233 /* 234 * Host <-> VPU IPC messages types. 235 */ 236 enum vpu_ipc_msg_type { 237 VPU_JSM_MSG_UNKNOWN = 0xFFFFFFFF, 238 /* IPC Host -> Device, Async commands */ 239 VPU_JSM_MSG_ASYNC_CMD = 0x1100, 240 VPU_JSM_MSG_ENGINE_RESET = VPU_JSM_MSG_ASYNC_CMD, 241 VPU_JSM_MSG_ENGINE_PREEMPT = 0x1101, 242 VPU_JSM_MSG_REGISTER_DB = 0x1102, 243 VPU_JSM_MSG_UNREGISTER_DB = 0x1103, 244 VPU_JSM_MSG_QUERY_ENGINE_HB = 0x1104, 245 VPU_JSM_MSG_GET_POWER_LEVEL_COUNT = 0x1105, 246 VPU_JSM_MSG_GET_POWER_LEVEL = 0x1106, 247 VPU_JSM_MSG_SET_POWER_LEVEL = 0x1107, 248 /* @deprecated */ 249 VPU_JSM_MSG_METRIC_STREAMER_OPEN = 0x1108, 250 /* @deprecated */ 251 VPU_JSM_MSG_METRIC_STREAMER_CLOSE = 0x1109, 252 /** Configure logging (used to modify configuration passed in boot params). */ 253 VPU_JSM_MSG_TRACE_SET_CONFIG = 0x110a, 254 /** Return current logging configuration. */ 255 VPU_JSM_MSG_TRACE_GET_CONFIG = 0x110b, 256 /** 257 * Get masks of destinations and HW components supported by the firmware 258 * (may vary between HW generations and FW compile 259 * time configurations) 260 */ 261 VPU_JSM_MSG_TRACE_GET_CAPABILITY = 0x110c, 262 /** Get the name of a destination or HW component. */ 263 VPU_JSM_MSG_TRACE_GET_NAME = 0x110d, 264 /** 265 * Release resource associated with host ssid . All jobs that belong to the host_ssid 266 * aborted and removed from internal scheduling queues. All doorbells assigned 267 * to the host_ssid are unregistered and any internal FW resources belonging to 268 * the host_ssid are released. 269 */ 270 VPU_JSM_MSG_SSID_RELEASE = 0x110e, 271 /** 272 * Start collecting metric data. 273 * @see vpu_jsm_metric_streamer_start 274 */ 275 VPU_JSM_MSG_METRIC_STREAMER_START = 0x110f, 276 /** 277 * Stop collecting metric data. This command will return success if it is called 278 * for a metric stream that has already been stopped or was never started. 279 * @see vpu_jsm_metric_streamer_stop 280 */ 281 VPU_JSM_MSG_METRIC_STREAMER_STOP = 0x1110, 282 /** 283 * Update current and next buffer for metric data collection. This command can 284 * also be used to request information about the number of collected samples 285 * and the amount of data written to the buffer. 286 * @see vpu_jsm_metric_streamer_update 287 */ 288 VPU_JSM_MSG_METRIC_STREAMER_UPDATE = 0x1111, 289 /** 290 * Request description of selected metric groups and metric counters within 291 * each group. The VPU will write the description of groups and counters to 292 * the buffer specified in the command structure. 293 * @see vpu_jsm_metric_streamer_start 294 */ 295 VPU_JSM_MSG_METRIC_STREAMER_INFO = 0x1112, 296 /** Control command: Priority band setup */ 297 VPU_JSM_MSG_SET_PRIORITY_BAND_SETUP = 0x1113, 298 /** Control command: Create command queue */ 299 VPU_JSM_MSG_CREATE_CMD_QUEUE = 0x1114, 300 /** Control command: Destroy command queue */ 301 VPU_JSM_MSG_DESTROY_CMD_QUEUE = 0x1115, 302 /** Control command: Set context scheduling properties */ 303 VPU_JSM_MSG_SET_CONTEXT_SCHED_PROPERTIES = 0x1116, 304 /* 305 * Register a doorbell to notify VPU of new work. The doorbell may later be 306 * deallocated or reassigned to another context. 307 */ 308 VPU_JSM_MSG_HWS_REGISTER_DB = 0x1117, 309 /** Control command: Log buffer setting */ 310 VPU_JSM_MSG_HWS_SET_SCHEDULING_LOG = 0x1118, 311 /* Control command: Suspend command queue. */ 312 VPU_JSM_MSG_HWS_SUSPEND_CMDQ = 0x1119, 313 /* Control command: Resume command queue */ 314 VPU_JSM_MSG_HWS_RESUME_CMDQ = 0x111a, 315 /* Control command: Resume engine after reset */ 316 VPU_JSM_MSG_HWS_ENGINE_RESUME = 0x111b, 317 /* Control command: Enable survivability/DCT mode */ 318 VPU_JSM_MSG_DCT_ENABLE = 0x111c, 319 /* Control command: Disable survivability/DCT mode */ 320 VPU_JSM_MSG_DCT_DISABLE = 0x111d, 321 /** 322 * Dump VPU state. To be used for debug purposes only. 323 * NOTE: Please introduce new ASYNC commands before this one. * 324 */ 325 VPU_JSM_MSG_STATE_DUMP = 0x11FF, 326 /* IPC Host -> Device, General commands */ 327 VPU_JSM_MSG_GENERAL_CMD = 0x1200, 328 VPU_JSM_MSG_BLOB_DEINIT = VPU_JSM_MSG_GENERAL_CMD, 329 /** 330 * Control dyndbg behavior by executing a dyndbg command; equivalent to 331 * Linux command: `echo '<dyndbg_cmd>' > <debugfs>/dynamic_debug/control`. 332 */ 333 VPU_JSM_MSG_DYNDBG_CONTROL = 0x1201, 334 /** 335 * Perform the save procedure for the D0i3 entry 336 */ 337 VPU_JSM_MSG_PWR_D0I3_ENTER = 0x1202, 338 /* IPC Device -> Host, Job completion */ 339 VPU_JSM_MSG_JOB_DONE = 0x2100, 340 /* IPC Device -> Host, Async command completion */ 341 VPU_JSM_MSG_ASYNC_CMD_DONE = 0x2200, 342 VPU_JSM_MSG_ENGINE_RESET_DONE = VPU_JSM_MSG_ASYNC_CMD_DONE, 343 VPU_JSM_MSG_ENGINE_PREEMPT_DONE = 0x2201, 344 VPU_JSM_MSG_REGISTER_DB_DONE = 0x2202, 345 VPU_JSM_MSG_UNREGISTER_DB_DONE = 0x2203, 346 VPU_JSM_MSG_QUERY_ENGINE_HB_DONE = 0x2204, 347 VPU_JSM_MSG_GET_POWER_LEVEL_COUNT_DONE = 0x2205, 348 VPU_JSM_MSG_GET_POWER_LEVEL_DONE = 0x2206, 349 VPU_JSM_MSG_SET_POWER_LEVEL_DONE = 0x2207, 350 /* @deprecated */ 351 VPU_JSM_MSG_METRIC_STREAMER_OPEN_DONE = 0x2208, 352 /* @deprecated */ 353 VPU_JSM_MSG_METRIC_STREAMER_CLOSE_DONE = 0x2209, 354 /** Response to VPU_JSM_MSG_TRACE_SET_CONFIG. */ 355 VPU_JSM_MSG_TRACE_SET_CONFIG_RSP = 0x220a, 356 /** Response to VPU_JSM_MSG_TRACE_GET_CONFIG. */ 357 VPU_JSM_MSG_TRACE_GET_CONFIG_RSP = 0x220b, 358 /** Response to VPU_JSM_MSG_TRACE_GET_CAPABILITY. */ 359 VPU_JSM_MSG_TRACE_GET_CAPABILITY_RSP = 0x220c, 360 /** Response to VPU_JSM_MSG_TRACE_GET_NAME. */ 361 VPU_JSM_MSG_TRACE_GET_NAME_RSP = 0x220d, 362 /** Response to VPU_JSM_MSG_SSID_RELEASE. */ 363 VPU_JSM_MSG_SSID_RELEASE_DONE = 0x220e, 364 /** 365 * Response to VPU_JSM_MSG_METRIC_STREAMER_START. 366 * VPU will return an error result if metric collection cannot be started, 367 * e.g. when the specified metric mask is invalid. 368 * @see vpu_jsm_metric_streamer_done 369 */ 370 VPU_JSM_MSG_METRIC_STREAMER_START_DONE = 0x220f, 371 /** 372 * Response to VPU_JSM_MSG_METRIC_STREAMER_STOP. 373 * Returns information about collected metric data. 374 * @see vpu_jsm_metric_streamer_done 375 */ 376 VPU_JSM_MSG_METRIC_STREAMER_STOP_DONE = 0x2210, 377 /** 378 * Response to VPU_JSM_MSG_METRIC_STREAMER_UPDATE. 379 * Returns information about collected metric data. 380 * @see vpu_jsm_metric_streamer_done 381 */ 382 VPU_JSM_MSG_METRIC_STREAMER_UPDATE_DONE = 0x2211, 383 /** 384 * Response to VPU_JSM_MSG_METRIC_STREAMER_INFO. 385 * Returns a description of the metric groups and metric counters. 386 * @see vpu_jsm_metric_streamer_done 387 */ 388 VPU_JSM_MSG_METRIC_STREAMER_INFO_DONE = 0x2212, 389 /** 390 * Asynchronous event sent from the VPU to the host either when the current 391 * metric buffer is full or when the VPU has collected a multiple of 392 * @notify_sample_count samples as indicated through the start command 393 * (VPU_JSM_MSG_METRIC_STREAMER_START). Returns information about collected 394 * metric data. 395 * @see vpu_jsm_metric_streamer_done 396 */ 397 VPU_JSM_MSG_METRIC_STREAMER_NOTIFICATION = 0x2213, 398 /** Response to control command: Priority band setup */ 399 VPU_JSM_MSG_SET_PRIORITY_BAND_SETUP_RSP = 0x2214, 400 /** Response to control command: Create command queue */ 401 VPU_JSM_MSG_CREATE_CMD_QUEUE_RSP = 0x2215, 402 /** Response to control command: Destroy command queue */ 403 VPU_JSM_MSG_DESTROY_CMD_QUEUE_RSP = 0x2216, 404 /** Response to control command: Set context scheduling properties */ 405 VPU_JSM_MSG_SET_CONTEXT_SCHED_PROPERTIES_RSP = 0x2217, 406 /** Response to control command: Log buffer setting */ 407 VPU_JSM_MSG_HWS_SET_SCHEDULING_LOG_RSP = 0x2218, 408 /* IPC Device -> Host, HWS notify index entry of log buffer written */ 409 VPU_JSM_MSG_HWS_SCHEDULING_LOG_NOTIFICATION = 0x2219, 410 /* IPC Device -> Host, HWS completion of a context suspend request */ 411 VPU_JSM_MSG_HWS_SUSPEND_CMDQ_DONE = 0x221a, 412 /* Response to control command: Resume command queue */ 413 VPU_JSM_MSG_HWS_RESUME_CMDQ_RSP = 0x221b, 414 /* Response to control command: Resume engine command response */ 415 VPU_JSM_MSG_HWS_RESUME_ENGINE_DONE = 0x221c, 416 /* Response to control command: Enable survivability/DCT mode */ 417 VPU_JSM_MSG_DCT_ENABLE_DONE = 0x221d, 418 /* Response to control command: Disable survivability/DCT mode */ 419 VPU_JSM_MSG_DCT_DISABLE_DONE = 0x221e, 420 /** 421 * Response to state dump control command. 422 * NOTE: Please introduce new ASYNC responses before this one. * 423 */ 424 VPU_JSM_MSG_STATE_DUMP_RSP = 0x22FF, 425 /* IPC Device -> Host, General command completion */ 426 VPU_JSM_MSG_GENERAL_CMD_DONE = 0x2300, 427 VPU_JSM_MSG_BLOB_DEINIT_DONE = VPU_JSM_MSG_GENERAL_CMD_DONE, 428 /** Response to VPU_JSM_MSG_DYNDBG_CONTROL. */ 429 VPU_JSM_MSG_DYNDBG_CONTROL_RSP = 0x2301, 430 /** 431 * Acknowledgment of completion of the save procedure initiated by 432 * VPU_JSM_MSG_PWR_D0I3_ENTER 433 */ 434 VPU_JSM_MSG_PWR_D0I3_ENTER_DONE = 0x2302, 435 }; 436 437 enum vpu_ipc_msg_status { VPU_JSM_MSG_FREE, VPU_JSM_MSG_ALLOCATED }; 438 439 /* 440 * Host <-> LRT IPC message payload definitions 441 */ 442 struct vpu_ipc_msg_payload_engine_reset { 443 /* Engine to be reset. */ 444 u32 engine_idx; 445 /* Reserved */ 446 u32 reserved_0; 447 }; 448 449 struct vpu_ipc_msg_payload_engine_preempt { 450 /* Engine to be preempted. */ 451 u32 engine_idx; 452 /* ID of the preemption request. */ 453 u32 preempt_id; 454 }; 455 456 /* 457 * @brief Register doorbell command structure. 458 * This structure supports doorbell registration for only OS scheduling. 459 * @see VPU_JSM_MSG_REGISTER_DB 460 */ 461 struct vpu_ipc_msg_payload_register_db { 462 /* Index of the doorbell to register. */ 463 u32 db_idx; 464 /* Reserved */ 465 u32 reserved_0; 466 /* Virtual address in Global GTT pointing to the start of job queue. */ 467 u64 jobq_base; 468 /* Size of the job queue in bytes. */ 469 u32 jobq_size; 470 /* Host sub-stream ID for the context assigned to the doorbell. */ 471 u32 host_ssid; 472 }; 473 474 /** 475 * @brief Unregister doorbell command structure. 476 * Request structure to unregister a doorbell for both HW and OS scheduling. 477 * @see VPU_JSM_MSG_UNREGISTER_DB 478 */ 479 struct vpu_ipc_msg_payload_unregister_db { 480 /* Index of the doorbell to unregister. */ 481 u32 db_idx; 482 /* Reserved */ 483 u32 reserved_0; 484 }; 485 486 struct vpu_ipc_msg_payload_query_engine_hb { 487 /* Engine to return heartbeat value. */ 488 u32 engine_idx; 489 /* Reserved */ 490 u32 reserved_0; 491 }; 492 493 struct vpu_ipc_msg_payload_power_level { 494 /** 495 * Requested power level. The power level value is in the 496 * range [0, power_level_count-1] where power_level_count 497 * is the number of available power levels as returned by 498 * the get power level count command. A power level of 0 499 * corresponds to the maximum possible power level, while 500 * power_level_count-1 corresponds to the minimum possible 501 * power level. Values outside of this range are not 502 * considered to be valid. 503 */ 504 u32 power_level; 505 /* Reserved */ 506 u32 reserved_0; 507 }; 508 509 struct vpu_ipc_msg_payload_ssid_release { 510 /* Host sub-stream ID for the context to be released. */ 511 u32 host_ssid; 512 /* Reserved */ 513 u32 reserved_0; 514 }; 515 516 /** 517 * @brief Metric streamer start command structure. 518 * This structure is also used with VPU_JSM_MSG_METRIC_STREAMER_INFO to request metric 519 * groups and metric counters description from the firmware. 520 * @see VPU_JSM_MSG_METRIC_STREAMER_START 521 * @see VPU_JSM_MSG_METRIC_STREAMER_INFO 522 */ 523 struct vpu_jsm_metric_streamer_start { 524 /** 525 * Bitmask to select the desired metric groups. 526 * A metric group can belong only to one metric streamer instance at a time. 527 * Since each metric streamer instance has a unique set of metric groups, it 528 * can also identify a metric streamer instance if more than one instance was 529 * started. If the VPU device does not support multiple metric streamer instances, 530 * then VPU_JSM_MSG_METRIC_STREAMER_START will return an error even if the second 531 * instance has different groups to the first. 532 */ 533 u64 metric_group_mask; 534 /** Sampling rate in nanoseconds. */ 535 u64 sampling_rate; 536 /** 537 * If > 0 the VPU will send a VPU_JSM_MSG_METRIC_STREAMER_NOTIFICATION message 538 * after every @notify_sample_count samples is collected or dropped by the VPU. 539 * If set to UINT_MAX the VPU will only generate a notification when the metric 540 * buffer is full. If set to 0 the VPU will never generate a notification. 541 */ 542 u32 notify_sample_count; 543 u32 reserved_0; 544 /** 545 * Address and size of the buffer where the VPU will write metric data. The 546 * VPU writes all counters from enabled metric groups one after another. If 547 * there is no space left to write data at the next sample period the VPU 548 * will switch to the next buffer (@see next_buffer_addr) and will optionally 549 * send a notification to the host driver if @notify_sample_count is non-zero. 550 * If @next_buffer_addr is NULL the VPU will stop collecting metric data. 551 */ 552 u64 buffer_addr; 553 u64 buffer_size; 554 /** 555 * Address and size of the next buffer to write metric data to after the initial 556 * buffer is full. If the address is NULL the VPU will stop collecting metric 557 * data. 558 */ 559 u64 next_buffer_addr; 560 u64 next_buffer_size; 561 }; 562 563 /** 564 * @brief Metric streamer stop command structure. 565 * @see VPU_JSM_MSG_METRIC_STREAMER_STOP 566 */ 567 struct vpu_jsm_metric_streamer_stop { 568 /** Bitmask to select the desired metric groups. */ 569 u64 metric_group_mask; 570 }; 571 572 /** 573 * Provide VPU FW with buffers to write metric data. 574 * @see VPU_JSM_MSG_METRIC_STREAMER_UPDATE 575 */ 576 struct vpu_jsm_metric_streamer_update { 577 /** Metric group mask that identifies metric streamer instance. */ 578 u64 metric_group_mask; 579 /** 580 * Address and size of the buffer where the VPU will write metric data. If 581 * the buffer address is 0 or same as the currently used buffer the VPU will 582 * continue writing metric data to the current buffer. In this case the 583 * buffer size is ignored and the size of the current buffer is unchanged. 584 * If the address is non-zero and differs from the current buffer address the 585 * VPU will immediately switch data collection to the new buffer. 586 */ 587 u64 buffer_addr; 588 u64 buffer_size; 589 /** 590 * Address and size of the next buffer to write metric data after the initial 591 * buffer is full. If the address is NULL the VPU will stop collecting metric 592 * data but will continue to record dropped samples. 593 * 594 * Note that there is a hazard possible if both buffer_addr and the next_buffer_addr 595 * are non-zero in same update request. It is the host's responsibility to ensure 596 * that both addresses make sense even if the VPU just switched to writing samples 597 * from the current to the next buffer. 598 */ 599 u64 next_buffer_addr; 600 u64 next_buffer_size; 601 }; 602 603 struct vpu_ipc_msg_payload_blob_deinit { 604 /* 64-bit unique ID for the blob to be de-initialized. */ 605 u64 blob_id; 606 }; 607 608 struct vpu_ipc_msg_payload_job_done { 609 /* Engine to which the job was submitted. */ 610 u32 engine_idx; 611 /* Index of the doorbell to which the job was submitted */ 612 u32 db_idx; 613 /* ID of the completed job */ 614 u32 job_id; 615 /* Status of the completed job */ 616 u32 job_status; 617 /* Host SSID */ 618 u32 host_ssid; 619 /* Zero Padding */ 620 u32 reserved_0; 621 /* Command queue id */ 622 u64 cmdq_id; 623 }; 624 625 struct vpu_jsm_engine_reset_context { 626 /* Host SSID */ 627 u32 host_ssid; 628 /* Zero Padding */ 629 u32 reserved_0; 630 /* Command queue id */ 631 u64 cmdq_id; 632 /* See VPU_ENGINE_RESET_CONTEXT_* defines */ 633 u64 flags; 634 }; 635 636 struct vpu_ipc_msg_payload_engine_reset_done { 637 /* Engine ordinal */ 638 u32 engine_idx; 639 /* Number of impacted contexts */ 640 u32 num_impacted_contexts; 641 /* Array of impacted command queue ids and their flags */ 642 struct vpu_jsm_engine_reset_context 643 impacted_contexts[VPU_MAX_ENGINE_RESET_IMPACTED_CONTEXTS]; 644 }; 645 646 struct vpu_ipc_msg_payload_engine_preempt_done { 647 /* Engine preempted. */ 648 u32 engine_idx; 649 /* ID of the preemption request. */ 650 u32 preempt_id; 651 }; 652 653 /** 654 * Response structure for register doorbell command for both OS 655 * and HW scheduling. 656 * @see VPU_JSM_MSG_REGISTER_DB 657 * @see VPU_JSM_MSG_HWS_REGISTER_DB 658 */ 659 struct vpu_ipc_msg_payload_register_db_done { 660 /* Index of the registered doorbell. */ 661 u32 db_idx; 662 /* Reserved */ 663 u32 reserved_0; 664 }; 665 666 /** 667 * Response structure for unregister doorbell command for both OS 668 * and HW scheduling. 669 * @see VPU_JSM_MSG_UNREGISTER_DB 670 */ 671 struct vpu_ipc_msg_payload_unregister_db_done { 672 /* Index of the unregistered doorbell. */ 673 u32 db_idx; 674 /* Reserved */ 675 u32 reserved_0; 676 }; 677 678 struct vpu_ipc_msg_payload_query_engine_hb_done { 679 /* Engine returning heartbeat value. */ 680 u32 engine_idx; 681 /* Reserved */ 682 u32 reserved_0; 683 /* Heartbeat value. */ 684 u64 heartbeat; 685 }; 686 687 struct vpu_ipc_msg_payload_get_power_level_count_done { 688 /** 689 * Number of supported power levels. The maximum possible 690 * value of power_level_count is 16 but this may vary across 691 * implementations. 692 */ 693 u32 power_level_count; 694 /* Reserved */ 695 u32 reserved_0; 696 /** 697 * Power consumption limit for each supported power level in 698 * [0-100%] range relative to power level 0. 699 */ 700 u8 power_limit[16]; 701 }; 702 703 struct vpu_ipc_msg_payload_blob_deinit_done { 704 /* 64-bit unique ID for the blob de-initialized. */ 705 u64 blob_id; 706 }; 707 708 /* HWS priority band setup request / response */ 709 struct vpu_ipc_msg_payload_hws_priority_band_setup { 710 /* 711 * Grace period in 100ns units when preempting another priority band for 712 * this priority band 713 */ 714 u32 grace_period[VPU_HWS_NUM_PRIORITY_BANDS]; 715 /* 716 * Default quantum in 100ns units for scheduling across processes 717 * within a priority band 718 */ 719 u32 process_quantum[VPU_HWS_NUM_PRIORITY_BANDS]; 720 /* 721 * Default grace period in 100ns units for processes that preempt each 722 * other within a priority band 723 */ 724 u32 process_grace_period[VPU_HWS_NUM_PRIORITY_BANDS]; 725 /* 726 * For normal priority band, specifies the target VPU percentage 727 * in situations when it's starved by the focus band. 728 */ 729 u32 normal_band_percentage; 730 /* Reserved */ 731 u32 reserved_0; 732 }; 733 734 /* 735 * @brief HWS create command queue request. 736 * Host will create a command queue via this command. 737 * Note: Cmdq group is a handle of an object which 738 * may contain one or more command queues. 739 * @see VPU_JSM_MSG_CREATE_CMD_QUEUE 740 * @see VPU_JSM_MSG_CREATE_CMD_QUEUE_RSP 741 */ 742 struct vpu_ipc_msg_payload_hws_create_cmdq { 743 /* Process id */ 744 u64 process_id; 745 /* Host SSID */ 746 u32 host_ssid; 747 /* Engine for which queue is being created */ 748 u32 engine_idx; 749 /* Cmdq group: only used for HWS logging of state changes */ 750 u64 cmdq_group; 751 /* Command queue id */ 752 u64 cmdq_id; 753 /* Command queue base */ 754 u64 cmdq_base; 755 /* Command queue size */ 756 u32 cmdq_size; 757 /* Zero padding */ 758 u32 reserved_0; 759 }; 760 761 /* 762 * @brief HWS create command queue response. 763 * @see VPU_JSM_MSG_CREATE_CMD_QUEUE 764 * @see VPU_JSM_MSG_CREATE_CMD_QUEUE_RSP 765 */ 766 struct vpu_ipc_msg_payload_hws_create_cmdq_rsp { 767 /* Process id */ 768 u64 process_id; 769 /* Host SSID */ 770 u32 host_ssid; 771 /* Engine for which queue is being created */ 772 u32 engine_idx; 773 /* Command queue group */ 774 u64 cmdq_group; 775 /* Command queue id */ 776 u64 cmdq_id; 777 }; 778 779 /* HWS destroy command queue request / response */ 780 struct vpu_ipc_msg_payload_hws_destroy_cmdq { 781 /* Host SSID */ 782 u32 host_ssid; 783 /* Zero Padding */ 784 u32 reserved; 785 /* Command queue id */ 786 u64 cmdq_id; 787 }; 788 789 /* HWS set context scheduling properties request / response */ 790 struct vpu_ipc_msg_payload_hws_set_context_sched_properties { 791 /* Host SSID */ 792 u32 host_ssid; 793 /* Zero Padding */ 794 u32 reserved_0; 795 /* Command queue id */ 796 u64 cmdq_id; 797 /* Priority band to assign to work of this context */ 798 u32 priority_band; 799 /* Inside realtime band assigns a further priority */ 800 u32 realtime_priority_level; 801 /* Priority relative to other contexts in the same process */ 802 s32 in_process_priority; 803 /* Zero padding / Reserved */ 804 u32 reserved_1; 805 /* Context quantum relative to other contexts of same priority in the same process */ 806 u64 context_quantum; 807 /* Grace period when preempting context of the same priority within the same process */ 808 u64 grace_period_same_priority; 809 /* Grace period when preempting context of a lower priority within the same process */ 810 u64 grace_period_lower_priority; 811 }; 812 813 /* 814 * @brief Register doorbell command structure. 815 * This structure supports doorbell registration for both HW and OS scheduling. 816 * Note: Queue base and size are added here so that the same structure can be used for 817 * OS scheduling and HW scheduling. For OS scheduling, cmdq_id will be ignored 818 * and cmdq_base and cmdq_size will be used. For HW scheduling, cmdq_base and cmdq_size will be 819 * ignored and cmdq_id is used. 820 * @see VPU_JSM_MSG_HWS_REGISTER_DB 821 */ 822 struct vpu_jsm_hws_register_db { 823 /* Index of the doorbell to register. */ 824 u32 db_id; 825 /* Host sub-stream ID for the context assigned to the doorbell. */ 826 u32 host_ssid; 827 /* ID of the command queue associated with the doorbell. */ 828 u64 cmdq_id; 829 /* Virtual address pointing to the start of command queue. */ 830 u64 cmdq_base; 831 /* Size of the command queue in bytes. */ 832 u64 cmdq_size; 833 }; 834 835 /* 836 * @brief Structure to set another buffer to be used for scheduling-related logging. 837 * The size of the logging buffer and the number of entries is defined as part of the 838 * buffer itself as described next. 839 * The log buffer received from the host is made up of; 840 * - header: 32 bytes in size, as shown in 'struct vpu_hws_log_buffer_header'. 841 * The header contains the number of log entries in the buffer. 842 * - log entry: 0 to n-1, each log entry is 32 bytes in size, as shown in 843 * 'struct vpu_hws_log_buffer_entry'. 844 * The entry contains the VPU timestamp, operation type and data. 845 * The host should provide the notify index value of log buffer to VPU. This is a 846 * value defined within the log buffer and when written to will generate the 847 * scheduling log notification. 848 * The host should set engine_idx and vpu_log_buffer_va to 0 to disable logging 849 * for a particular engine. 850 * VPU will handle one log buffer for each of supported engines. 851 * VPU should allow the logging to consume one host_ssid. 852 * @see VPU_JSM_MSG_HWS_SET_SCHEDULING_LOG 853 * @see VPU_JSM_MSG_HWS_SET_SCHEDULING_LOG_RSP 854 * @see VPU_JSM_MSG_HWS_SCHEDULING_LOG_NOTIFICATION 855 */ 856 struct vpu_ipc_msg_payload_hws_set_scheduling_log { 857 /* Engine ordinal */ 858 u32 engine_idx; 859 /* Host SSID */ 860 u32 host_ssid; 861 /* 862 * VPU log buffer virtual address. 863 * Set to 0 to disable logging for this engine. 864 */ 865 u64 vpu_log_buffer_va; 866 /* 867 * Notify index of log buffer. VPU_JSM_MSG_HWS_SCHEDULING_LOG_NOTIFICATION 868 * is generated when an event log is written to this index. 869 */ 870 u64 notify_index; 871 /* 872 * Enable extra events to be output to log for debug of scheduling algorithm. 873 * Interpreted by VPU as a boolean to enable or disable, expected values are 874 * 0 and 1. 875 */ 876 u32 enable_extra_events; 877 /* Zero Padding */ 878 u32 reserved_0; 879 }; 880 881 /* 882 * @brief The scheduling log notification is generated by VPU when it writes 883 * an event into the log buffer at the notify_index. VPU notifies host with 884 * VPU_JSM_MSG_HWS_SCHEDULING_LOG_NOTIFICATION. This is an asynchronous 885 * message from VPU to host. 886 * @see VPU_JSM_MSG_HWS_SCHEDULING_LOG_NOTIFICATION 887 * @see VPU_JSM_MSG_HWS_SET_SCHEDULING_LOG 888 */ 889 struct vpu_ipc_msg_payload_hws_scheduling_log_notification { 890 /* Engine ordinal */ 891 u32 engine_idx; 892 /* Zero Padding */ 893 u32 reserved_0; 894 }; 895 896 /* 897 * @brief HWS suspend command queue request and done structure. 898 * Host will request the suspend of contexts and VPU will; 899 * - Suspend all work on this context 900 * - Preempt any running work 901 * - Asynchronously perform the above and return success immediately once 902 * all items above are started successfully 903 * - Notify the host of completion of these operations via 904 * VPU_JSM_MSG_HWS_SUSPEND_CMDQ_DONE 905 * - Reject any other context operations on a context with an in-flight 906 * suspend request running 907 * Same structure used when VPU notifies host of completion of a context suspend 908 * request. The ids and suspend fence value reported in this command will match 909 * the one in the request from the host to suspend the context. Once suspend is 910 * complete, VPU will not access any data relating to this command queue until 911 * it is resumed. 912 * @see VPU_JSM_MSG_HWS_SUSPEND_CMDQ 913 * @see VPU_JSM_MSG_HWS_SUSPEND_CMDQ_DONE 914 */ 915 struct vpu_ipc_msg_payload_hws_suspend_cmdq { 916 /* Host SSID */ 917 u32 host_ssid; 918 /* Zero Padding */ 919 u32 reserved_0; 920 /* Command queue id */ 921 u64 cmdq_id; 922 /* 923 * Suspend fence value - reported by the VPU suspend context 924 * completed once suspend is complete. 925 */ 926 u64 suspend_fence_value; 927 }; 928 929 /* 930 * @brief HWS Resume command queue request / response structure. 931 * Host will request the resume of a context; 932 * - VPU will resume all work on this context 933 * - Scheduler will allow this context to be scheduled 934 * @see VPU_JSM_MSG_HWS_RESUME_CMDQ 935 * @see VPU_JSM_MSG_HWS_RESUME_CMDQ_RSP 936 */ 937 struct vpu_ipc_msg_payload_hws_resume_cmdq { 938 /* Host SSID */ 939 u32 host_ssid; 940 /* Zero Padding */ 941 u32 reserved_0; 942 /* Command queue id */ 943 u64 cmdq_id; 944 }; 945 946 /* 947 * @brief HWS Resume engine request / response structure. 948 * After a HWS engine reset, all scheduling is stopped on VPU until a engine resume. 949 * Host shall send this command to resume scheduling of any valid queue. 950 * @see VPU_JSM_MSG_HWS_RESUME_ENGINE 951 * @see VPU_JSM_MSG_HWS_RESUME_ENGINE_DONE 952 */ 953 struct vpu_ipc_msg_payload_hws_resume_engine { 954 /* Engine to be resumed */ 955 u32 engine_idx; 956 /* Reserved */ 957 u32 reserved_0; 958 }; 959 960 /** 961 * Payload for VPU_JSM_MSG_TRACE_SET_CONFIG[_RSP] and 962 * VPU_JSM_MSG_TRACE_GET_CONFIG_RSP messages. 963 * 964 * The payload is interpreted differently depending on the type of message: 965 * 966 * - For VPU_JSM_MSG_TRACE_SET_CONFIG, the payload specifies the desired 967 * logging configuration to be set. 968 * 969 * - For VPU_JSM_MSG_TRACE_SET_CONFIG_RSP, the payload reports the logging 970 * configuration that was set after a VPU_JSM_MSG_TRACE_SET_CONFIG request. 971 * The host can compare this payload with the one it sent in the 972 * VPU_JSM_MSG_TRACE_SET_CONFIG request to check whether or not the 973 * configuration was set as desired. 974 * 975 * - VPU_JSM_MSG_TRACE_GET_CONFIG_RSP, the payload reports the current logging 976 * configuration. 977 */ 978 struct vpu_ipc_msg_payload_trace_config { 979 /** 980 * Logging level (currently set or to be set); see 'mvLog_t' enum for 981 * acceptable values. The specified logging level applies to all 982 * destinations and HW components 983 */ 984 u32 trace_level; 985 /** 986 * Bitmask of logging destinations (currently enabled or to be enabled); 987 * bitwise OR of values defined in logging_destination enum. 988 */ 989 u32 trace_destination_mask; 990 /** 991 * Bitmask of loggable HW components (currently enabled or to be enabled); 992 * bitwise OR of values defined in loggable_hw_component enum. 993 */ 994 u64 trace_hw_component_mask; 995 u64 reserved_0; /**< Reserved for future extensions. */ 996 }; 997 998 /** 999 * Payload for VPU_JSM_MSG_TRACE_GET_CAPABILITY_RSP messages. 1000 */ 1001 struct vpu_ipc_msg_payload_trace_capability_rsp { 1002 u32 trace_destination_mask; /**< Bitmask of supported logging destinations. */ 1003 u32 reserved_0; 1004 u64 trace_hw_component_mask; /**< Bitmask of supported loggable HW components. */ 1005 u64 reserved_1; /**< Reserved for future extensions. */ 1006 }; 1007 1008 /** 1009 * Payload for VPU_JSM_MSG_TRACE_GET_NAME requests. 1010 */ 1011 struct vpu_ipc_msg_payload_trace_get_name { 1012 /** 1013 * The type of the entity to query name for; see logging_entity_type for 1014 * possible values. 1015 */ 1016 u32 entity_type; 1017 u32 reserved_0; 1018 /** 1019 * The ID of the entity to query name for; possible values depends on the 1020 * entity type. 1021 */ 1022 u64 entity_id; 1023 }; 1024 1025 /** 1026 * Payload for VPU_JSM_MSG_TRACE_GET_NAME_RSP responses. 1027 */ 1028 struct vpu_ipc_msg_payload_trace_get_name_rsp { 1029 /** 1030 * The type of the entity whose name was queried; see logging_entity_type 1031 * for possible values. 1032 */ 1033 u32 entity_type; 1034 u32 reserved_0; 1035 /** 1036 * The ID of the entity whose name was queried; possible values depends on 1037 * the entity type. 1038 */ 1039 u64 entity_id; 1040 /** Reserved for future extensions. */ 1041 u64 reserved_1; 1042 /** The name of the entity. */ 1043 char entity_name[VPU_TRACE_ENTITY_NAME_MAX_LEN]; 1044 }; 1045 1046 /** 1047 * Data sent from the VPU to the host in all metric streamer response messages 1048 * and in asynchronous notification. 1049 * @see VPU_JSM_MSG_METRIC_STREAMER_START_DONE 1050 * @see VPU_JSM_MSG_METRIC_STREAMER_STOP_DONE 1051 * @see VPU_JSM_MSG_METRIC_STREAMER_UPDATE_DONE 1052 * @see VPU_JSM_MSG_METRIC_STREAMER_INFO_DONE 1053 * @see VPU_JSM_MSG_METRIC_STREAMER_NOTIFICATION 1054 */ 1055 struct vpu_jsm_metric_streamer_done { 1056 /** Metric group mask that identifies metric streamer instance. */ 1057 u64 metric_group_mask; 1058 /** 1059 * Size in bytes of single sample - total size of all enabled counters. 1060 * Some VPU implementations may align sample_size to more than 8 bytes. 1061 */ 1062 u32 sample_size; 1063 u32 reserved_0; 1064 /** 1065 * Number of samples collected since the metric streamer was started. 1066 * This will be 0 if the metric streamer was not started. 1067 */ 1068 u32 samples_collected; 1069 /** 1070 * Number of samples dropped since the metric streamer was started. This 1071 * is incremented every time the metric streamer is not able to write 1072 * collected samples because the current buffer is full and there is no 1073 * next buffer to switch to. 1074 */ 1075 u32 samples_dropped; 1076 /** Address of the buffer that contains the latest metric data. */ 1077 u64 buffer_addr; 1078 /** 1079 * Number of bytes written into the metric data buffer. In response to the 1080 * VPU_JSM_MSG_METRIC_STREAMER_INFO request this field contains the size of 1081 * all group and counter descriptors. The size is updated even if the buffer 1082 * in the request was NULL or too small to hold descriptors of all counters 1083 */ 1084 u64 bytes_written; 1085 }; 1086 1087 /** 1088 * Metric group description placed in the metric buffer after successful completion 1089 * of the VPU_JSM_MSG_METRIC_STREAMER_INFO command. This is followed by one or more 1090 * @vpu_jsm_metric_counter_descriptor records. 1091 * @see VPU_JSM_MSG_METRIC_STREAMER_INFO 1092 */ 1093 struct vpu_jsm_metric_group_descriptor { 1094 /** 1095 * Offset to the next metric group (8-byte aligned). If this offset is 0 this 1096 * is the last descriptor. The value of metric_info_size must be greater than 1097 * or equal to sizeof(struct vpu_jsm_metric_group_descriptor) + name_string_size 1098 * + description_string_size and must be 8-byte aligned. 1099 */ 1100 u32 next_metric_group_info_offset; 1101 /** 1102 * Offset to the first metric counter description record (8-byte aligned). 1103 * @see vpu_jsm_metric_counter_descriptor 1104 */ 1105 u32 next_metric_counter_info_offset; 1106 /** Index of the group. This corresponds to bit index in metric_group_mask. */ 1107 u32 group_id; 1108 /** Number of counters in the metric group. */ 1109 u32 num_counters; 1110 /** Data size for all counters, must be a multiple of 8 bytes.*/ 1111 u32 metric_group_data_size; 1112 /** 1113 * Metric group domain number. Cannot use multiple, simultaneous metric groups 1114 * from the same domain. 1115 */ 1116 u32 domain; 1117 /** 1118 * Counter name string size. The string must include a null termination character. 1119 * The FW may use a fixed size name or send a different name for each counter. 1120 * If the VPU uses fixed size strings, all characters from the end of the name 1121 * to the of the fixed size character array must be zeroed. 1122 */ 1123 u32 name_string_size; 1124 /** Counter description string size, @see name_string_size */ 1125 u32 description_string_size; 1126 u64 reserved_0; 1127 /** 1128 * Right after this structure, the VPU writes name and description of 1129 * the metric group. 1130 */ 1131 }; 1132 1133 /** 1134 * Metric counter description, placed in the buffer after vpu_jsm_metric_group_descriptor. 1135 * @see VPU_JSM_MSG_METRIC_STREAMER_INFO 1136 */ 1137 struct vpu_jsm_metric_counter_descriptor { 1138 /** 1139 * Offset to the next counter in a group (8-byte aligned). If this offset is 1140 * 0 this is the last counter in the group. 1141 */ 1142 u32 next_metric_counter_info_offset; 1143 /** 1144 * Offset to the counter data from the start of samples in this metric group. 1145 * Note that metric_data_offset % metric_data_size must be 0. 1146 */ 1147 u32 metric_data_offset; 1148 /** Size of the metric counter data in bytes. */ 1149 u32 metric_data_size; 1150 /** Metric type, see Level Zero API for definitions. */ 1151 u32 tier; 1152 /** Metric type, see set_metric_type_t for definitions. */ 1153 u32 metric_type; 1154 /** Metric type, see set_value_type_t for definitions. */ 1155 u32 metric_value_type; 1156 /** 1157 * Counter name string size. The string must include a null termination character. 1158 * The FW may use a fixed size name or send a different name for each counter. 1159 * If the VPU uses fixed size strings, all characters from the end of the name 1160 * to the of the fixed size character array must be zeroed. 1161 */ 1162 u32 name_string_size; 1163 /** Counter description string size, @see name_string_size */ 1164 u32 description_string_size; 1165 /** Counter component name string size, @see name_string_size */ 1166 u32 component_string_size; 1167 /** Counter string size, @see name_string_size */ 1168 u32 units_string_size; 1169 u64 reserved_0; 1170 /** 1171 * Right after this structure, the VPU writes name, description 1172 * component and unit strings. 1173 */ 1174 }; 1175 1176 /** 1177 * Payload for VPU_JSM_MSG_DYNDBG_CONTROL requests. 1178 * 1179 * VPU_JSM_MSG_DYNDBG_CONTROL are used to control the VPU FW Dynamic Debug 1180 * feature, which allows developers to selectively enable / disable MVLOG_DEBUG 1181 * messages. This is equivalent to the Dynamic Debug functionality provided by 1182 * Linux 1183 * (https://www.kernel.org/doc/html/latest/admin-guide/dynamic-debug-howto.html) 1184 * The host can control Dynamic Debug behavior by sending dyndbg commands, which 1185 * have the same syntax as Linux 1186 * dyndbg commands. 1187 * 1188 * NOTE: in order for MVLOG_DEBUG messages to be actually printed, the host 1189 * still has to set the logging level to MVLOG_DEBUG, using the 1190 * VPU_JSM_MSG_TRACE_SET_CONFIG command. 1191 * 1192 * The host can see the current dynamic debug configuration by executing a 1193 * special 'show' command. The dyndbg configuration will be printed to the 1194 * configured logging destination using MVLOG_INFO logging level. 1195 */ 1196 struct vpu_ipc_msg_payload_dyndbg_control { 1197 /** 1198 * Dyndbg command (same format as Linux dyndbg); must be a NULL-terminated 1199 * string. 1200 */ 1201 char dyndbg_cmd[VPU_DYNDBG_CMD_MAX_LEN]; 1202 }; 1203 1204 /** 1205 * Payload for VPU_JSM_MSG_PWR_D0I3_ENTER 1206 * 1207 * This is a bi-directional payload. 1208 */ 1209 struct vpu_ipc_msg_payload_pwr_d0i3_enter { 1210 /** 1211 * 0: VPU_JSM_MSG_PWR_D0I3_ENTER_DONE is not sent to the host driver 1212 * The driver will poll for D0i2 Idle state transitions. 1213 * 1: VPU_JSM_MSG_PWR_D0I3_ENTER_DONE is sent after VPU state save is complete 1214 */ 1215 u32 send_response; 1216 u32 reserved_0; 1217 }; 1218 1219 /** 1220 * Payload for VPU_JSM_MSG_DCT_ENABLE message. 1221 * 1222 * Default values for DCT active/inactive times are 5.3ms and 30ms respectively, 1223 * corresponding to a 85% duty cycle. This payload allows the host to tune these 1224 * values according to application requirements. 1225 */ 1226 struct vpu_ipc_msg_payload_pwr_dct_control { 1227 /** Duty cycle active time in microseconds */ 1228 u32 dct_active_us; 1229 /** Duty cycle inactive time in microseconds */ 1230 u32 dct_inactive_us; 1231 }; 1232 1233 /* 1234 * Payloads union, used to define complete message format. 1235 */ 1236 union vpu_ipc_msg_payload { 1237 struct vpu_ipc_msg_payload_engine_reset engine_reset; 1238 struct vpu_ipc_msg_payload_engine_preempt engine_preempt; 1239 struct vpu_ipc_msg_payload_register_db register_db; 1240 struct vpu_ipc_msg_payload_unregister_db unregister_db; 1241 struct vpu_ipc_msg_payload_query_engine_hb query_engine_hb; 1242 struct vpu_ipc_msg_payload_power_level power_level; 1243 struct vpu_jsm_metric_streamer_start metric_streamer_start; 1244 struct vpu_jsm_metric_streamer_stop metric_streamer_stop; 1245 struct vpu_jsm_metric_streamer_update metric_streamer_update; 1246 struct vpu_ipc_msg_payload_blob_deinit blob_deinit; 1247 struct vpu_ipc_msg_payload_ssid_release ssid_release; 1248 struct vpu_jsm_hws_register_db hws_register_db; 1249 struct vpu_ipc_msg_payload_job_done job_done; 1250 struct vpu_ipc_msg_payload_engine_reset_done engine_reset_done; 1251 struct vpu_ipc_msg_payload_engine_preempt_done engine_preempt_done; 1252 struct vpu_ipc_msg_payload_register_db_done register_db_done; 1253 struct vpu_ipc_msg_payload_unregister_db_done unregister_db_done; 1254 struct vpu_ipc_msg_payload_query_engine_hb_done query_engine_hb_done; 1255 struct vpu_ipc_msg_payload_get_power_level_count_done get_power_level_count_done; 1256 struct vpu_jsm_metric_streamer_done metric_streamer_done; 1257 struct vpu_ipc_msg_payload_blob_deinit_done blob_deinit_done; 1258 struct vpu_ipc_msg_payload_trace_config trace_config; 1259 struct vpu_ipc_msg_payload_trace_capability_rsp trace_capability; 1260 struct vpu_ipc_msg_payload_trace_get_name trace_get_name; 1261 struct vpu_ipc_msg_payload_trace_get_name_rsp trace_get_name_rsp; 1262 struct vpu_ipc_msg_payload_dyndbg_control dyndbg_control; 1263 struct vpu_ipc_msg_payload_hws_priority_band_setup hws_priority_band_setup; 1264 struct vpu_ipc_msg_payload_hws_create_cmdq hws_create_cmdq; 1265 struct vpu_ipc_msg_payload_hws_create_cmdq_rsp hws_create_cmdq_rsp; 1266 struct vpu_ipc_msg_payload_hws_destroy_cmdq hws_destroy_cmdq; 1267 struct vpu_ipc_msg_payload_hws_set_context_sched_properties 1268 hws_set_context_sched_properties; 1269 struct vpu_ipc_msg_payload_hws_set_scheduling_log hws_set_scheduling_log; 1270 struct vpu_ipc_msg_payload_hws_scheduling_log_notification hws_scheduling_log_notification; 1271 struct vpu_ipc_msg_payload_hws_suspend_cmdq hws_suspend_cmdq; 1272 struct vpu_ipc_msg_payload_hws_resume_cmdq hws_resume_cmdq; 1273 struct vpu_ipc_msg_payload_hws_resume_engine hws_resume_engine; 1274 struct vpu_ipc_msg_payload_pwr_d0i3_enter pwr_d0i3_enter; 1275 struct vpu_ipc_msg_payload_pwr_dct_control pwr_dct_control; 1276 }; 1277 1278 /* 1279 * Host <-> LRT IPC message base structure. 1280 * 1281 * NOTE: All instances of this object must be aligned on a 64B boundary 1282 * to allow proper handling of VPU cache operations. 1283 */ 1284 struct vpu_jsm_msg { 1285 /* Reserved */ 1286 u64 reserved_0; 1287 /* Message type, see vpu_ipc_msg_type enum. */ 1288 u32 type; 1289 /* Buffer status, see vpu_ipc_msg_status enum. */ 1290 u32 status; 1291 /* 1292 * Request ID, provided by the host in a request message and passed 1293 * back by VPU in the response message. 1294 */ 1295 u32 request_id; 1296 /* Request return code set by the VPU, see VPU_JSM_STATUS_* defines. */ 1297 u32 result; 1298 u64 reserved_1; 1299 /* Message payload depending on message type, see vpu_ipc_msg_payload union. */ 1300 union vpu_ipc_msg_payload payload; 1301 }; 1302 1303 #pragma pack(pop) 1304 1305 #endif 1306 1307 ///@} 1308