1 /* SPDX-License-Identifier: MIT */
3 * Copyright (C) 2020-2023 Intel Corporation
8 * @brief JSM shared definitions
11 * @brief JSM shared definitions
18 * Major version changes that break backward compatibility
20 #define VPU_JSM_API_VER_MAJOR 3
23 * Minor version changes when API backward compatibility is preserved.
25 #define VPU_JSM_API_VER_MINOR 0
28 * API header changed (field names, documentation, formatting) but API itself has not been changed
30 #define VPU_JSM_API_VER_PATCH 1
33 * Index in the API version table
35 #define VPU_JSM_API_VER_INDEX 4
38 * Number of Priority Bands for Hardware Scheduling
39 * Bands: RealTime, Focus, Normal, Idle
41 #define VPU_HWS_NUM_PRIORITY_BANDS 4
43 /* Max number of impacted contexts that can be dealt with the engine reset command */
44 #define VPU_MAX_ENGINE_RESET_IMPACTED_CONTEXTS 3
46 /** Pack the API structures for now, once alignment issues are fixed this can be removed */
52 #define VPU_ENGINE_COMPUTE 0
53 #define VPU_ENGINE_COPY 1
54 #define VPU_ENGINE_NB 2
59 #define VPU_JSM_STATUS_SUCCESS 0x0U
60 #define VPU_JSM_STATUS_PARSING_ERR 0x1U
61 #define VPU_JSM_STATUS_PROCESSING_ERR 0x2U
62 #define VPU_JSM_STATUS_PREEMPTED 0x3U
63 #define VPU_JSM_STATUS_ABORTED 0x4U
64 #define VPU_JSM_STATUS_USER_CTX_VIOL_ERR 0x5U
65 #define VPU_JSM_STATUS_GLOBAL_CTX_VIOL_ERR 0x6U
66 #define VPU_JSM_STATUS_MVNCI_WRONG_INPUT_FORMAT 0x7U
67 #define VPU_JSM_STATUS_MVNCI_UNSUPPORTED_NETWORK_ELEMENT 0x8U
68 #define VPU_JSM_STATUS_MVNCI_INVALID_HANDLE 0x9U
69 #define VPU_JSM_STATUS_MVNCI_OUT_OF_RESOURCES 0xAU
70 #define VPU_JSM_STATUS_MVNCI_NOT_IMPLEMENTED 0xBU
71 #define VPU_JSM_STATUS_MVNCI_INTERNAL_ERROR 0xCU
72 /* Job status returned when the job was preempted mid-inference */
73 #define VPU_JSM_STATUS_PREEMPTED_MID_INFERENCE 0xDU
76 * Host <-> VPU IPC channels.
77 * ASYNC commands use a high priority channel, other messages use low-priority ones.
79 #define VPU_IPC_CHAN_ASYNC_CMD 0
80 #define VPU_IPC_CHAN_GEN_CMD 10
81 #define VPU_IPC_CHAN_JOB_RET 11
84 * Job flags bit masks.
86 #define VPU_JOB_FLAGS_NULL_SUBMISSION_MASK 0x00000001
89 * Sizes of the reserved areas in jobs, in bytes.
91 #define VPU_JOB_RESERVED_BYTES 16
93 * Sizes of the reserved areas in job queues, in bytes.
95 #define VPU_JOB_QUEUE_RESERVED_BYTES 52
98 * Max length (including trailing NULL char) of trace entity name (e.g., the
99 * name of a logging destination or a loggable HW component).
101 #define VPU_TRACE_ENTITY_NAME_MAX_LEN 32
104 * Max length (including trailing NULL char) of a dyndbg command.
106 * NOTE: 96 is used so that the size of 'struct vpu_ipc_msg' in the JSM API is
107 * 128 bytes (multiple of 64 bytes, the cache line size).
109 #define VPU_DYNDBG_CMD_MAX_LEN 96
114 struct vpu_job_queue_entry {
115 u64 batch_buf_addr; /**< Address of VPU commands batch buffer */
116 u32 job_id; /**< Job ID */
117 u32 flags; /**< Flags bit field, see VPU_JOB_FLAGS_* above */
118 u64 root_page_table_addr; /**< Address of root page table to use for this job */
119 u64 root_page_table_update_counter; /**< Page tables update events counter */
120 u64 preemption_buffer_address; /**< Address of the preemption buffer to use for this job */
121 u64 preemption_buffer_size; /**< Size of the preemption buffer to use for this job */
122 u8 reserved_0[VPU_JOB_RESERVED_BYTES];
126 * Job queue control registers.
128 struct vpu_job_queue_header {
132 u8 reserved_0[VPU_JOB_QUEUE_RESERVED_BYTES];
138 struct vpu_job_queue {
139 struct vpu_job_queue_header header;
140 struct vpu_job_queue_entry job[];
144 * Logging entity types.
146 * This enum defines the different types of entities involved in logging.
148 enum vpu_trace_entity_type {
149 /** Logging destination (entity where logs can be stored / printed). */
150 VPU_TRACE_ENTITY_TYPE_DESTINATION = 1,
151 /** Loggable HW component (HW entity that can be logged). */
152 VPU_TRACE_ENTITY_TYPE_HW_COMPONENT = 2,
156 * Host <-> VPU IPC messages types.
158 enum vpu_ipc_msg_type {
159 VPU_JSM_MSG_UNKNOWN = 0xFFFFFFFF,
160 /* IPC Host -> Device, Async commands */
161 VPU_JSM_MSG_ASYNC_CMD = 0x1100,
162 VPU_JSM_MSG_ENGINE_RESET = VPU_JSM_MSG_ASYNC_CMD,
163 VPU_JSM_MSG_ENGINE_PREEMPT = 0x1101,
164 VPU_JSM_MSG_REGISTER_DB = 0x1102,
165 VPU_JSM_MSG_UNREGISTER_DB = 0x1103,
166 VPU_JSM_MSG_QUERY_ENGINE_HB = 0x1104,
167 VPU_JSM_MSG_GET_POWER_LEVEL_COUNT = 0x1105,
168 VPU_JSM_MSG_GET_POWER_LEVEL = 0x1106,
169 VPU_JSM_MSG_SET_POWER_LEVEL = 0x1107,
171 VPU_JSM_MSG_METRIC_STREAMER_OPEN = 0x1108,
173 VPU_JSM_MSG_METRIC_STREAMER_CLOSE = 0x1109,
174 /** Configure logging (used to modify configuration passed in boot params). */
175 VPU_JSM_MSG_TRACE_SET_CONFIG = 0x110a,
176 /** Return current logging configuration. */
177 VPU_JSM_MSG_TRACE_GET_CONFIG = 0x110b,
179 * Get masks of destinations and HW components supported by the firmware
180 * (may vary between HW generations and FW compile
181 * time configurations)
183 VPU_JSM_MSG_TRACE_GET_CAPABILITY = 0x110c,
184 /** Get the name of a destination or HW component. */
185 VPU_JSM_MSG_TRACE_GET_NAME = 0x110d,
187 * Release resource associated with host ssid . All jobs that belong to the host_ssid
188 * aborted and removed from internal scheduling queues. All doorbells assigned
189 * to the host_ssid are unregistered and any internal FW resources belonging to
190 * the host_ssid are released.
192 VPU_JSM_MSG_SSID_RELEASE = 0x110e,
194 * Start collecting metric data.
195 * @see vpu_jsm_metric_streamer_start
197 VPU_JSM_MSG_METRIC_STREAMER_START = 0x110f,
199 * Stop collecting metric data. This command will return success if it is called
200 * for a metric stream that has already been stopped or was never started.
201 * @see vpu_jsm_metric_streamer_stop
203 VPU_JSM_MSG_METRIC_STREAMER_STOP = 0x1110,
205 * Update current and next buffer for metric data collection. This command can
206 * also be used to request information about the number of collected samples
207 * and the amount of data written to the buffer.
208 * @see vpu_jsm_metric_streamer_update
210 VPU_JSM_MSG_METRIC_STREAMER_UPDATE = 0x1111,
212 * Request description of selected metric groups and metric counters within
213 * each group. The VPU will write the description of groups and counters to
214 * the buffer specified in the command structure.
215 * @see vpu_jsm_metric_streamer_start
217 VPU_JSM_MSG_METRIC_STREAMER_INFO = 0x1112,
218 /** Control command: Priority band setup */
219 VPU_JSM_MSG_SET_PRIORITY_BAND_SETUP = 0x1113,
220 /** Control command: Create command queue */
221 VPU_JSM_MSG_CREATE_CMD_QUEUE = 0x1114,
222 /** Control command: Destroy command queue */
223 VPU_JSM_MSG_DESTROY_CMD_QUEUE = 0x1115,
224 /** Control command: Set context scheduling properties */
225 VPU_JSM_MSG_SET_CONTEXT_SCHED_PROPERTIES = 0x1116,
227 * Register a doorbell to notify VPU of new work. The doorbell may later be
228 * deallocated or reassigned to another context.
230 VPU_JSM_MSG_HWS_REGISTER_DB = 0x1117,
231 /* IPC Host -> Device, General commands */
232 VPU_JSM_MSG_GENERAL_CMD = 0x1200,
233 VPU_JSM_MSG_BLOB_DEINIT = VPU_JSM_MSG_GENERAL_CMD,
235 * Control dyndbg behavior by executing a dyndbg command; equivalent to
236 * Linux command: `echo '<dyndbg_cmd>' > <debugfs>/dynamic_debug/control`.
238 VPU_JSM_MSG_DYNDBG_CONTROL = 0x1201,
239 /* IPC Device -> Host, Job completion */
240 VPU_JSM_MSG_JOB_DONE = 0x2100,
241 /* IPC Device -> Host, Async command completion */
242 VPU_JSM_MSG_ASYNC_CMD_DONE = 0x2200,
243 VPU_JSM_MSG_ENGINE_RESET_DONE = VPU_JSM_MSG_ASYNC_CMD_DONE,
244 VPU_JSM_MSG_ENGINE_PREEMPT_DONE = 0x2201,
245 VPU_JSM_MSG_REGISTER_DB_DONE = 0x2202,
246 VPU_JSM_MSG_UNREGISTER_DB_DONE = 0x2203,
247 VPU_JSM_MSG_QUERY_ENGINE_HB_DONE = 0x2204,
248 VPU_JSM_MSG_GET_POWER_LEVEL_COUNT_DONE = 0x2205,
249 VPU_JSM_MSG_GET_POWER_LEVEL_DONE = 0x2206,
250 VPU_JSM_MSG_SET_POWER_LEVEL_DONE = 0x2207,
252 VPU_JSM_MSG_METRIC_STREAMER_OPEN_DONE = 0x2208,
254 VPU_JSM_MSG_METRIC_STREAMER_CLOSE_DONE = 0x2209,
255 /** Response to VPU_JSM_MSG_TRACE_SET_CONFIG. */
256 VPU_JSM_MSG_TRACE_SET_CONFIG_RSP = 0x220a,
257 /** Response to VPU_JSM_MSG_TRACE_GET_CONFIG. */
258 VPU_JSM_MSG_TRACE_GET_CONFIG_RSP = 0x220b,
259 /** Response to VPU_JSM_MSG_TRACE_GET_CAPABILITY. */
260 VPU_JSM_MSG_TRACE_GET_CAPABILITY_RSP = 0x220c,
261 /** Response to VPU_JSM_MSG_TRACE_GET_NAME. */
262 VPU_JSM_MSG_TRACE_GET_NAME_RSP = 0x220d,
263 /** Response to VPU_JSM_MSG_SSID_RELEASE. */
264 VPU_JSM_MSG_SSID_RELEASE_DONE = 0x220e,
266 * Response to VPU_JSM_MSG_METRIC_STREAMER_START.
267 * VPU will return an error result if metric collection cannot be started,
268 * e.g. when the specified metric mask is invalid.
269 * @see vpu_jsm_metric_streamer_done
271 VPU_JSM_MSG_METRIC_STREAMER_START_DONE = 0x220f,
273 * Response to VPU_JSM_MSG_METRIC_STREAMER_STOP.
274 * Returns information about collected metric data.
275 * @see vpu_jsm_metric_streamer_done
277 VPU_JSM_MSG_METRIC_STREAMER_STOP_DONE = 0x2210,
279 * Response to VPU_JSM_MSG_METRIC_STREAMER_UPDATE.
280 * Returns information about collected metric data.
281 * @see vpu_jsm_metric_streamer_done
283 VPU_JSM_MSG_METRIC_STREAMER_UPDATE_DONE = 0x2211,
285 * Response to VPU_JSM_MSG_METRIC_STREAMER_INFO.
286 * Returns a description of the metric groups and metric counters.
287 * @see vpu_jsm_metric_streamer_done
289 VPU_JSM_MSG_METRIC_STREAMER_INFO_DONE = 0x2212,
291 * Asynchronous event sent from the VPU to the host either when the current
292 * metric buffer is full or when the VPU has collected a multiple of
293 * @notify_sample_count samples as indicated through the start command
294 * (VPU_JSM_MSG_METRIC_STREAMER_START). Returns information about collected
296 * @see vpu_jsm_metric_streamer_done
298 VPU_JSM_MSG_METRIC_STREAMER_NOTIFICATION = 0x2213,
299 /** Response to control command: Priority band setup */
300 VPU_JSM_MSG_SET_PRIORITY_BAND_SETUP_RSP = 0x2214,
301 /** Response to control command: Create command queue */
302 VPU_JSM_MSG_CREATE_CMD_QUEUE_RSP = 0x2215,
303 /** Response to control command: Destroy command queue */
304 VPU_JSM_MSG_DESTROY_CMD_QUEUE_RSP = 0x2216,
305 /** Response to control command: Set context scheduling properties */
306 VPU_JSM_MSG_SET_CONTEXT_SCHED_PROPERTIES_RSP = 0x2217,
307 /* IPC Device -> Host, General command completion */
308 VPU_JSM_MSG_GENERAL_CMD_DONE = 0x2300,
309 VPU_JSM_MSG_BLOB_DEINIT_DONE = VPU_JSM_MSG_GENERAL_CMD_DONE,
310 /** Response to VPU_JSM_MSG_DYNDBG_CONTROL. */
311 VPU_JSM_MSG_DYNDBG_CONTROL_RSP = 0x2301,
314 enum vpu_ipc_msg_status { VPU_JSM_MSG_FREE, VPU_JSM_MSG_ALLOCATED };
317 * Host <-> LRT IPC message payload definitions
319 struct vpu_ipc_msg_payload_engine_reset {
320 /* Engine to be reset. */
326 struct vpu_ipc_msg_payload_engine_preempt {
327 /* Engine to be preempted. */
329 /* ID of the preemption request. */
334 * @brief Register doorbell command structure.
335 * This structure supports doorbell registration for only OS scheduling.
336 * @see VPU_JSM_MSG_REGISTER_DB
338 struct vpu_ipc_msg_payload_register_db {
339 /* Index of the doorbell to register. */
343 /* Virtual address in Global GTT pointing to the start of job queue. */
345 /* Size of the job queue in bytes. */
347 /* Host sub-stream ID for the context assigned to the doorbell. */
352 * @brief Unregister doorbell command structure.
353 * Request structure to unregister a doorbell for both HW and OS scheduling.
354 * @see VPU_JSM_MSG_UNREGISTER_DB
356 struct vpu_ipc_msg_payload_unregister_db {
357 /* Index of the doorbell to unregister. */
363 struct vpu_ipc_msg_payload_query_engine_hb {
364 /* Engine to return heartbeat value. */
370 struct vpu_ipc_msg_payload_power_level {
372 * Requested power level. The power level value is in the
373 * range [0, power_level_count-1] where power_level_count
374 * is the number of available power levels as returned by
375 * the get power level count command. A power level of 0
376 * corresponds to the maximum possible power level, while
377 * power_level_count-1 corresponds to the minimum possible
378 * power level. Values outside of this range are not
379 * considered to be valid.
386 struct vpu_ipc_msg_payload_ssid_release {
387 /* Host sub-stream ID for the context to be released. */
394 * @brief Metric streamer start command structure.
395 * This structure is also used with VPU_JSM_MSG_METRIC_STREAMER_INFO to request metric
396 * groups and metric counters description from the firmware.
397 * @see VPU_JSM_MSG_METRIC_STREAMER_START
398 * @see VPU_JSM_MSG_METRIC_STREAMER_INFO
400 struct vpu_jsm_metric_streamer_start {
402 * Bitmask to select the desired metric groups.
403 * A metric group can belong only to one metric streamer instance at a time.
404 * Since each metric streamer instance has a unique set of metric groups, it
405 * can also identify a metric streamer instance if more than one instance was
406 * started. If the VPU device does not support multiple metric streamer instances,
407 * then VPU_JSM_MSG_METRIC_STREAMER_START will return an error even if the second
408 * instance has different groups to the first.
410 u64 metric_group_mask;
411 /** Sampling rate in nanoseconds. */
414 * If > 0 the VPU will send a VPU_JSM_MSG_METRIC_STREAMER_NOTIFICATION message
415 * after every @notify_sample_count samples is collected or dropped by the VPU.
416 * If set to UINT_MAX the VPU will only generate a notification when the metric
417 * buffer is full. If set to 0 the VPU will never generate a notification.
419 u32 notify_sample_count;
422 * Address and size of the buffer where the VPU will write metric data. The
423 * VPU writes all counters from enabled metric groups one after another. If
424 * there is no space left to write data at the next sample period the VPU
425 * will switch to the next buffer (@see next_buffer_addr) and will optionally
426 * send a notification to the host driver if @notify_sample_count is non-zero.
427 * If @next_buffer_addr is NULL the VPU will stop collecting metric data.
432 * Address and size of the next buffer to write metric data to after the initial
433 * buffer is full. If the address is NULL the VPU will stop collecting metric
436 u64 next_buffer_addr;
437 u64 next_buffer_size;
441 * @brief Metric streamer stop command structure.
442 * @see VPU_JSM_MSG_METRIC_STREAMER_STOP
444 struct vpu_jsm_metric_streamer_stop {
445 /** Bitmask to select the desired metric groups. */
446 u64 metric_group_mask;
450 * Provide VPU FW with buffers to write metric data.
451 * @see VPU_JSM_MSG_METRIC_STREAMER_UPDATE
453 struct vpu_jsm_metric_streamer_update {
454 /** Metric group mask that identifies metric streamer instance. */
455 u64 metric_group_mask;
457 * Address and size of the buffer where the VPU will write metric data. If
458 * the buffer address is 0 or same as the currently used buffer the VPU will
459 * continue writing metric data to the current buffer. In this case the
460 * buffer size is ignored and the size of the current buffer is unchanged.
461 * If the address is non-zero and differs from the current buffer address the
462 * VPU will immediately switch data collection to the new buffer.
467 * Address and size of the next buffer to write metric data after the initial
468 * buffer is full. If the address is NULL the VPU will stop collecting metric
469 * data but will continue to record dropped samples.
471 * Note that there is a hazard possible if both buffer_addr and the next_buffer_addr
472 * are non-zero in same update request. It is the host's responsibility to ensure
473 * that both addresses make sense even if the VPU just switched to writing samples
474 * from the current to the next buffer.
476 u64 next_buffer_addr;
477 u64 next_buffer_size;
480 struct vpu_ipc_msg_payload_blob_deinit {
481 /* 64-bit unique ID for the blob to be de-initialized. */
485 struct vpu_ipc_msg_payload_job_done {
486 /* Engine to which the job was submitted. */
488 /* Index of the doorbell to which the job was submitted */
490 /* ID of the completed job */
492 /* Status of the completed job */
498 /* Command queue id */
502 struct vpu_jsm_engine_reset_context {
507 /* Command queue id */
509 /* Flags: 0: cause of hang; 1: collateral damage of reset */
513 struct vpu_ipc_msg_payload_engine_reset_done {
516 /* Number of impacted contexts */
517 u32 num_impacted_contexts;
518 /* Array of impacted command queue ids and their flags */
519 struct vpu_jsm_engine_reset_context
520 impacted_contexts[VPU_MAX_ENGINE_RESET_IMPACTED_CONTEXTS];
523 struct vpu_ipc_msg_payload_engine_preempt_done {
524 /* Engine preempted. */
526 /* ID of the preemption request. */
531 * Response structure for register doorbell command for both OS
533 * @see VPU_JSM_MSG_REGISTER_DB
534 * @see VPU_JSM_MSG_HWS_REGISTER_DB
536 struct vpu_ipc_msg_payload_register_db_done {
537 /* Index of the registered doorbell. */
544 * Response structure for unregister doorbell command for both OS
546 * @see VPU_JSM_MSG_UNREGISTER_DB
548 struct vpu_ipc_msg_payload_unregister_db_done {
549 /* Index of the unregistered doorbell. */
555 struct vpu_ipc_msg_payload_query_engine_hb_done {
556 /* Engine returning heartbeat value. */
560 /* Heartbeat value. */
564 struct vpu_ipc_msg_payload_get_power_level_count_done {
566 * Number of supported power levels. The maximum possible
567 * value of power_level_count is 16 but this may vary across
570 u32 power_level_count;
574 * Power consumption limit for each supported power level in
575 * [0-100%] range relative to power level 0.
580 struct vpu_ipc_msg_payload_blob_deinit_done {
581 /* 64-bit unique ID for the blob de-initialized. */
585 /* HWS priority band setup request / response */
586 struct vpu_ipc_msg_payload_hws_priority_band_setup {
588 * Grace period in 100ns units when preempting another priority band for
591 u32 grace_period[VPU_HWS_NUM_PRIORITY_BANDS];
593 * Default quantum in 100ns units for scheduling across processes
594 * within a priority band
596 u64 process_quantum[VPU_HWS_NUM_PRIORITY_BANDS];
598 * Default grace period in 100ns units for processes that preempt each
599 * other within a priority band
601 u64 process_grace_period[VPU_HWS_NUM_PRIORITY_BANDS];
603 * For normal priority band, specifies the target VPU percentage
604 * in situations when it's starved by the focus band.
606 u32 normal_band_percentage;
611 /* HWS create command queue request */
612 struct vpu_ipc_msg_payload_hws_create_cmdq {
619 /* Command queue id */
621 /* Command queue base */
623 /* Command queue size */
629 /* HWS create command queue response */
630 struct vpu_ipc_msg_payload_hws_create_cmdq_rsp {
637 /* Command queue id */
641 /* HWS destroy command queue request / response */
642 struct vpu_ipc_msg_payload_hws_destroy_cmdq {
647 /* Command queue id */
651 /* HWS set context scheduling properties request / response */
652 struct vpu_ipc_msg_payload_hws_set_context_sched_properties {
657 /* Command queue id */
659 /* Priority band to assign to work of this context */
661 /* Inside realtime band assigns a further priority */
662 u32 realtime_priority_level;
663 /* Priority relative to other contexts in the same process */
664 u32 in_process_priority;
665 /* Zero padding / Reserved */
667 /* Context quantum relative to other contexts of same priority in the same process */
669 /* Grace period when preempting context of the same priority within the same process */
670 u64 grace_period_same_priority;
671 /* Grace period when preempting context of a lower priority within the same process */
672 u64 grace_period_lower_priority;
676 * @brief Register doorbell command structure.
677 * This structure supports doorbell registration for both HW and OS scheduling.
678 * Note: Queue base and size are added here so that the same structure can be used for
679 * OS scheduling and HW scheduling. For OS scheduling, cmdq_id will be ignored
680 * and cmdq_base and cmdq_size will be used. For HW scheduling, cmdq_base and cmdq_size will be
681 * ignored and cmdq_id is used.
682 * @see VPU_JSM_MSG_HWS_REGISTER_DB
684 struct vpu_jsm_hws_register_db {
685 /* Index of the doorbell to register. */
687 /* Host sub-stream ID for the context assigned to the doorbell. */
689 /* ID of the command queue associated with the doorbell. */
691 /* Virtual address pointing to the start of command queue. */
693 /* Size of the command queue in bytes. */
698 * Payload for VPU_JSM_MSG_TRACE_SET_CONFIG[_RSP] and
699 * VPU_JSM_MSG_TRACE_GET_CONFIG_RSP messages.
701 * The payload is interpreted differently depending on the type of message:
703 * - For VPU_JSM_MSG_TRACE_SET_CONFIG, the payload specifies the desired
704 * logging configuration to be set.
706 * - For VPU_JSM_MSG_TRACE_SET_CONFIG_RSP, the payload reports the logging
707 * configuration that was set after a VPU_JSM_MSG_TRACE_SET_CONFIG request.
708 * The host can compare this payload with the one it sent in the
709 * VPU_JSM_MSG_TRACE_SET_CONFIG request to check whether or not the
710 * configuration was set as desired.
712 * - VPU_JSM_MSG_TRACE_GET_CONFIG_RSP, the payload reports the current logging
715 struct vpu_ipc_msg_payload_trace_config {
717 * Logging level (currently set or to be set); see 'mvLog_t' enum for
718 * acceptable values. The specified logging level applies to all
719 * destinations and HW components
723 * Bitmask of logging destinations (currently enabled or to be enabled);
724 * bitwise OR of values defined in logging_destination enum.
726 u32 trace_destination_mask;
728 * Bitmask of loggable HW components (currently enabled or to be enabled);
729 * bitwise OR of values defined in loggable_hw_component enum.
731 u64 trace_hw_component_mask;
732 u64 reserved_0; /**< Reserved for future extensions. */
736 * Payload for VPU_JSM_MSG_TRACE_GET_CAPABILITY_RSP messages.
738 struct vpu_ipc_msg_payload_trace_capability_rsp {
739 u32 trace_destination_mask; /**< Bitmask of supported logging destinations. */
741 u64 trace_hw_component_mask; /**< Bitmask of supported loggable HW components. */
742 u64 reserved_1; /**< Reserved for future extensions. */
746 * Payload for VPU_JSM_MSG_TRACE_GET_NAME requests.
748 struct vpu_ipc_msg_payload_trace_get_name {
750 * The type of the entity to query name for; see logging_entity_type for
756 * The ID of the entity to query name for; possible values depends on the
763 * Payload for VPU_JSM_MSG_TRACE_GET_NAME_RSP responses.
765 struct vpu_ipc_msg_payload_trace_get_name_rsp {
767 * The type of the entity whose name was queried; see logging_entity_type
768 * for possible values.
773 * The ID of the entity whose name was queried; possible values depends on
777 /** Reserved for future extensions. */
779 /** The name of the entity. */
780 char entity_name[VPU_TRACE_ENTITY_NAME_MAX_LEN];
784 * Data sent from the VPU to the host in all metric streamer response messages
785 * and in asynchronous notification.
786 * @see VPU_JSM_MSG_METRIC_STREAMER_START_DONE
787 * @see VPU_JSM_MSG_METRIC_STREAMER_STOP_DONE
788 * @see VPU_JSM_MSG_METRIC_STREAMER_UPDATE_DONE
789 * @see VPU_JSM_MSG_METRIC_STREAMER_INFO_DONE
790 * @see VPU_JSM_MSG_METRIC_STREAMER_NOTIFICATION
792 struct vpu_jsm_metric_streamer_done {
793 /** Metric group mask that identifies metric streamer instance. */
794 u64 metric_group_mask;
796 * Size in bytes of single sample - total size of all enabled counters.
797 * Some VPU implementations may align sample_size to more than 8 bytes.
802 * Number of samples collected since the metric streamer was started.
803 * This will be 0 if the metric streamer was not started.
805 u32 samples_collected;
807 * Number of samples dropped since the metric streamer was started. This
808 * is incremented every time the metric streamer is not able to write
809 * collected samples because the current buffer is full and there is no
810 * next buffer to switch to.
813 /** Address of the buffer that contains the latest metric data. */
816 * Number of bytes written into the metric data buffer. In response to the
817 * VPU_JSM_MSG_METRIC_STREAMER_INFO request this field contains the size of
818 * all group and counter descriptors. The size is updated even if the buffer
819 * in the request was NULL or too small to hold descriptors of all counters
825 * Metric group description placed in the metric buffer after successful completion
826 * of the VPU_JSM_MSG_METRIC_STREAMER_INFO command. This is followed by one or more
827 * @vpu_jsm_metric_counter_descriptor records.
828 * @see VPU_JSM_MSG_METRIC_STREAMER_INFO
830 struct vpu_jsm_metric_group_descriptor {
832 * Offset to the next metric group (8-byte aligned). If this offset is 0 this
833 * is the last descriptor. The value of metric_info_size must be greater than
834 * or equal to sizeof(struct vpu_jsm_metric_group_descriptor) + name_string_size
835 * + description_string_size and must be 8-byte aligned.
837 u32 next_metric_group_info_offset;
839 * Offset to the first metric counter description record (8-byte aligned).
840 * @see vpu_jsm_metric_counter_descriptor
842 u32 next_metric_counter_info_offset;
843 /** Index of the group. This corresponds to bit index in metric_group_mask. */
845 /** Number of counters in the metric group. */
847 /** Data size for all counters, must be a multiple of 8 bytes.*/
848 u32 metric_group_data_size;
850 * Metric group domain number. Cannot use multiple, simultaneous metric groups
851 * from the same domain.
855 * Counter name string size. The string must include a null termination character.
856 * The FW may use a fixed size name or send a different name for each counter.
857 * If the VPU uses fixed size strings, all characters from the end of the name
858 * to the of the fixed size character array must be zeroed.
860 u32 name_string_size;
861 /** Counter description string size, @see name_string_size */
862 u32 description_string_size;
865 * Right after this structure, the VPU writes name and description of
871 * Metric counter description, placed in the buffer after vpu_jsm_metric_group_descriptor.
872 * @see VPU_JSM_MSG_METRIC_STREAMER_INFO
874 struct vpu_jsm_metric_counter_descriptor {
876 * Offset to the next counter in a group (8-byte aligned). If this offset is
877 * 0 this is the last counter in the group.
879 u32 next_metric_counter_info_offset;
881 * Offset to the counter data from the start of samples in this metric group.
882 * Note that metric_data_offset % metric_data_size must be 0.
884 u32 metric_data_offset;
885 /** Size of the metric counter data in bytes. */
886 u32 metric_data_size;
887 /** Metric type, see Level Zero API for definitions. */
889 /** Metric type, see set_metric_type_t for definitions. */
891 /** Metric type, see set_value_type_t for definitions. */
892 u32 metric_value_type;
894 * Counter name string size. The string must include a null termination character.
895 * The FW may use a fixed size name or send a different name for each counter.
896 * If the VPU uses fixed size strings, all characters from the end of the name
897 * to the of the fixed size character array must be zeroed.
899 u32 name_string_size;
900 /** Counter description string size, @see name_string_size */
901 u32 description_string_size;
902 /** Counter component name string size, @see name_string_size */
903 u32 component_string_size;
904 /** Counter string size, @see name_string_size */
905 u32 units_string_size;
908 * Right after this structure, the VPU writes name, description
909 * component and unit strings.
914 * Payload for VPU_JSM_MSG_DYNDBG_CONTROL requests.
916 * VPU_JSM_MSG_DYNDBG_CONTROL are used to control the VPU FW Dynamic Debug
917 * feature, which allows developers to selectively enable / disable MVLOG_DEBUG
918 * messages. This is equivalent to the Dynamic Debug functionality provided by
920 * (https://www.kernel.org/doc/html/latest/admin-guide/dynamic-debug-howto.html)
921 * The host can control Dynamic Debug behavior by sending dyndbg commands, which
922 * have the same syntax as Linux
925 * NOTE: in order for MVLOG_DEBUG messages to be actually printed, the host
926 * still has to set the logging level to MVLOG_DEBUG, using the
927 * VPU_JSM_MSG_TRACE_SET_CONFIG command.
929 * The host can see the current dynamic debug configuration by executing a
930 * special 'show' command. The dyndbg configuration will be printed to the
931 * configured logging destination using MVLOG_INFO logging level.
933 struct vpu_ipc_msg_payload_dyndbg_control {
935 * Dyndbg command (same format as Linux dyndbg); must be a NULL-terminated
938 char dyndbg_cmd[VPU_DYNDBG_CMD_MAX_LEN];
942 * Payloads union, used to define complete message format.
944 union vpu_ipc_msg_payload {
945 struct vpu_ipc_msg_payload_engine_reset engine_reset;
946 struct vpu_ipc_msg_payload_engine_preempt engine_preempt;
947 struct vpu_ipc_msg_payload_register_db register_db;
948 struct vpu_ipc_msg_payload_unregister_db unregister_db;
949 struct vpu_ipc_msg_payload_query_engine_hb query_engine_hb;
950 struct vpu_ipc_msg_payload_power_level power_level;
951 struct vpu_jsm_metric_streamer_start metric_streamer_start;
952 struct vpu_jsm_metric_streamer_stop metric_streamer_stop;
953 struct vpu_jsm_metric_streamer_update metric_streamer_update;
954 struct vpu_ipc_msg_payload_blob_deinit blob_deinit;
955 struct vpu_ipc_msg_payload_ssid_release ssid_release;
956 struct vpu_jsm_hws_register_db hws_register_db;
957 struct vpu_ipc_msg_payload_job_done job_done;
958 struct vpu_ipc_msg_payload_engine_reset_done engine_reset_done;
959 struct vpu_ipc_msg_payload_engine_preempt_done engine_preempt_done;
960 struct vpu_ipc_msg_payload_register_db_done register_db_done;
961 struct vpu_ipc_msg_payload_unregister_db_done unregister_db_done;
962 struct vpu_ipc_msg_payload_query_engine_hb_done query_engine_hb_done;
963 struct vpu_ipc_msg_payload_get_power_level_count_done get_power_level_count_done;
964 struct vpu_jsm_metric_streamer_done metric_streamer_done;
965 struct vpu_ipc_msg_payload_blob_deinit_done blob_deinit_done;
966 struct vpu_ipc_msg_payload_trace_config trace_config;
967 struct vpu_ipc_msg_payload_trace_capability_rsp trace_capability;
968 struct vpu_ipc_msg_payload_trace_get_name trace_get_name;
969 struct vpu_ipc_msg_payload_trace_get_name_rsp trace_get_name_rsp;
970 struct vpu_ipc_msg_payload_dyndbg_control dyndbg_control;
971 struct vpu_ipc_msg_payload_hws_priority_band_setup hws_priority_band_setup;
972 struct vpu_ipc_msg_payload_hws_create_cmdq hws_create_cmdq;
973 struct vpu_ipc_msg_payload_hws_create_cmdq_rsp hws_create_cmdq_rsp;
974 struct vpu_ipc_msg_payload_hws_destroy_cmdq hws_destroy_cmdq;
975 struct vpu_ipc_msg_payload_hws_set_context_sched_properties
976 hws_set_context_sched_properties;
980 * Host <-> LRT IPC message base structure.
982 * NOTE: All instances of this object must be aligned on a 64B boundary
983 * to allow proper handling of VPU cache operations.
988 /* Message type, see vpu_ipc_msg_type enum. */
990 /* Buffer status, see vpu_ipc_msg_status enum. */
993 * Request ID, provided by the host in a request message and passed
994 * back by VPU in the response message.
997 /* Request return code set by the VPU, see VPU_JSM_STATUS_* defines. */
1000 /* Message payload depending on message type, see vpu_ipc_msg_payload union. */
1001 union vpu_ipc_msg_payload payload;