/* SPDX-License-Identifier: MIT */1/*2* Copyright (c) 2020-2025, Intel Corporation.3*/45/**6* @addtogroup Jsm7* @{8*/910/**11* @file12* @brief JSM shared definitions13*/14#ifndef VPU_JSM_API_H15#define VPU_JSM_API_H1617/*18* Major version changes that break backward compatibility19*/20#define VPU_JSM_API_VER_MAJOR 32122/*23* Minor version changes when API backward compatibility is preserved.24*/25#define VPU_JSM_API_VER_MINOR 332627/*28* API header changed (field names, documentation, formatting) but API itself has not been changed29*/30#define VPU_JSM_API_VER_PATCH 03132/*33* Index in the API version table34*/35#define VPU_JSM_API_VER_INDEX 43637/*38* Number of Priority Bands for Hardware Scheduling39* Bands: Idle(0), Normal(1), Focus(2), RealTime(3)40*/41#define VPU_HWS_NUM_PRIORITY_BANDS 44243/* Max number of impacted contexts that can be dealt with the engine reset command */44#define VPU_MAX_ENGINE_RESET_IMPACTED_CONTEXTS 34546/*47* Pack the API structures to enforce binary compatibility48* Align to 8 bytes for optimal performance49*/50#pragma pack(push, 8)5152/*53* Engine indexes.54*/55#define VPU_ENGINE_COMPUTE 056#define VPU_ENGINE_NB 15758/*59* VPU status values.60*/61#define VPU_JSM_STATUS_SUCCESS 0x0U62#define VPU_JSM_STATUS_PARSING_ERR 0x1U63#define VPU_JSM_STATUS_PROCESSING_ERR 0x2U64#define VPU_JSM_STATUS_PREEMPTED 0x3U65#define VPU_JSM_STATUS_ABORTED 0x4U66#define VPU_JSM_STATUS_USER_CTX_VIOL_ERR 0x5U67#define VPU_JSM_STATUS_GLOBAL_CTX_VIOL_ERR 0x6U68#define VPU_JSM_STATUS_MVNCI_WRONG_INPUT_FORMAT 0x7U69#define VPU_JSM_STATUS_MVNCI_UNSUPPORTED_NETWORK_ELEMENT 0x8U70#define VPU_JSM_STATUS_MVNCI_INVALID_HANDLE 0x9U71#define VPU_JSM_STATUS_MVNCI_OUT_OF_RESOURCES 0xAU72#define VPU_JSM_STATUS_MVNCI_NOT_IMPLEMENTED 0xBU73#define VPU_JSM_STATUS_MVNCI_INTERNAL_ERROR 0xCU74/* @deprecated (use VPU_JSM_STATUS_PREEMPTED_MID_COMMAND instead) */75#define VPU_JSM_STATUS_PREEMPTED_MID_INFERENCE 0xDU76/* Job status returned when the job was preempted mid-command */77#define VPU_JSM_STATUS_PREEMPTED_MID_COMMAND 0xDU78/* Range of status codes that require engine reset */79#define VPU_JSM_STATUS_ENGINE_RESET_REQUIRED_MIN 0xEU80#define VPU_JSM_STATUS_MVNCI_CONTEXT_VIOLATION_HW 0xEU81#define VPU_JSM_STATUS_MVNCI_PREEMPTION_TIMED_OUT 0xFU82#define VPU_JSM_STATUS_ENGINE_RESET_REQUIRED_MAX 0x1FU8384/*85* Host <-> VPU IPC channels.86* ASYNC commands use a high priority channel, other messages use low-priority ones.87*/88#define VPU_IPC_CHAN_ASYNC_CMD 089#define VPU_IPC_CHAN_GEN_CMD 1090#define VPU_IPC_CHAN_JOB_RET 119192/*93* Job flags bit masks.94*/95enum {96/*97* Null submission mask.98* When set, batch buffer's commands are not processed but returned as99* successful immediately, except fences and timestamps.100* When cleared, batch buffer's commands are processed normally.101* Used for testing and profiling purposes.102*/103VPU_JOB_FLAGS_NULL_SUBMISSION_MASK = (1 << 0U),104/*105* Inline command mask.106* When set, the object in job queue is an inline command (see struct vpu_inline_cmd below).107* When cleared, the object in job queue is a job (see struct vpu_job_queue_entry below).108*/109VPU_JOB_FLAGS_INLINE_CMD_MASK = (1 << 1U),110/*111* VPU private data mask.112* Reserved for the VPU to store private data about the job (or inline command)113* while being processed.114*/115VPU_JOB_FLAGS_PRIVATE_DATA_MASK = 0xFFFF0000U116};117118/*119* Job queue flags bit masks.120*/121enum {122/*123* No job done notification mask.124* When set, indicates that no job done notification should be sent for any125* job from this queue. When cleared, indicates that job done notification126* should be sent for every job completed from this queue.127*/128VPU_JOB_QUEUE_FLAGS_NO_JOB_DONE_MASK = (1 << 0U),129/*130* Native fence usage mask.131* When set, indicates that job queue uses native fences (as inline commands132* in job queue). Such queues may also use legacy fences (as commands in batch buffers).133* When cleared, indicates the job queue only uses legacy fences.134* NOTES:135* 1. For queues using native fences, VPU expects that all jobs in the queue136* are immediately followed by an inline command object. This object is expected137* to be a fence signal command in most cases, but can also be a NOP in case the host138* does not need per-job fence signalling. Other inline commands objects can be139* inserted between "job and inline command" pairs.140* 2. Native fence queues are only supported on VPU 40xx onwards.141*/142VPU_JOB_QUEUE_FLAGS_USE_NATIVE_FENCE_MASK = (1 << 1U),143/*144* Enable turbo mode for testing NPU performance; not recommended for regular usage.145*/146VPU_JOB_QUEUE_FLAGS_TURBO_MODE = (1 << 2U),147/*148* Queue error detection mode flag149* For 'interactive' queues (this bit not set), the FW will identify queues that have not150* completed a job inside the TDR timeout as in error as part of engine reset sequence.151* For 'non-interactive' queues (this bit set), the FW will identify queues that have not152* progressed the heartbeat inside the non-interactive no-progress timeout as in error as153* part of engine reset sequence. Additionally, there is an upper limit applied to these154* queues: even if they progress the heartbeat, if they run longer than non-interactive155* timeout, then the FW will also identify them as in error.156*/157VPU_JOB_QUEUE_FLAGS_NON_INTERACTIVE = (1 << 3U)158};159160/*161* Max length (including trailing NULL char) of trace entity name (e.g., the162* name of a logging destination or a loggable HW component).163*/164#define VPU_TRACE_ENTITY_NAME_MAX_LEN 32165166/*167* Max length (including trailing NULL char) of a dyndbg command.168*169* NOTE: 96 is used so that the size of 'struct vpu_ipc_msg' in the JSM API is170* 128 bytes (multiple of 64 bytes, the cache line size).171*/172#define VPU_DYNDBG_CMD_MAX_LEN 96173174/*175* For HWS command queue scheduling, we can prioritise command queues inside the176* same process with a relative in-process priority. Valid values for relative177* priority are given below - max and min.178*/179#define VPU_HWS_COMMAND_QUEUE_MAX_IN_PROCESS_PRIORITY 7180#define VPU_HWS_COMMAND_QUEUE_MIN_IN_PROCESS_PRIORITY -7181182/*183* For HWS priority scheduling, we can have multiple realtime priority bands.184* They are numbered 0 to a MAX.185*/186#define VPU_HWS_MAX_REALTIME_PRIORITY_LEVEL 31U187188/*189* vpu_jsm_engine_reset_context flag definitions190*/191#define VPU_ENGINE_RESET_CONTEXT_FLAG_COLLATERAL_DAMAGE_MASK BIT(0)192#define VPU_ENGINE_RESET_CONTEXT_HANG_PRIMARY_CAUSE 0193#define VPU_ENGINE_RESET_CONTEXT_COLLATERAL_DAMAGE 1194195/*196* Invalid command queue handle identifier. Applies to cmdq_id and cmdq_group197* in this API.198*/199#define VPU_HWS_INVALID_CMDQ_HANDLE 0ULL200201/*202* Inline commands types.203*/204/*205* NOP.206* VPU does nothing other than consuming the inline command object.207*/208#define VPU_INLINE_CMD_TYPE_NOP 0x0209/*210* Fence wait.211* VPU waits for the fence current value to reach monitored value.212* Fence wait operations are executed upon job dispatching. While waiting for213* the fence to be satisfied, VPU blocks fetching of the next objects in the queue.214* Jobs present in the queue prior to the fence wait object may be processed215* concurrently.216*/217#define VPU_INLINE_CMD_TYPE_FENCE_WAIT 0x1218/*219* Fence signal.220* VPU sets the fence current value to the provided value. If new current value221* is equal to or higher than monitored value, VPU sends fence signalled notification222* to the host. Fence signal operations are executed upon completion of all the jobs223* present in the queue prior to them, and in-order relative to each other in the queue.224* But jobs in-between them may be processed concurrently and may complete out-of-order.225*/226#define VPU_INLINE_CMD_TYPE_FENCE_SIGNAL 0x2227228/**229* Job scheduling priority bands for both hardware scheduling and OS scheduling.230*/231enum vpu_job_scheduling_priority_band {232VPU_JOB_SCHEDULING_PRIORITY_BAND_IDLE = 0,233VPU_JOB_SCHEDULING_PRIORITY_BAND_NORMAL = 1,234VPU_JOB_SCHEDULING_PRIORITY_BAND_FOCUS = 2,235VPU_JOB_SCHEDULING_PRIORITY_BAND_REALTIME = 3,236VPU_JOB_SCHEDULING_PRIORITY_BAND_COUNT = 4,237};238239/**240* Job format.241* Jobs defines the actual workloads to be executed by a given engine.242*/243struct vpu_job_queue_entry {244/** Address of VPU commands batch buffer */245u64 batch_buf_addr;246/** Job ID */247u32 job_id;248/** Flags bit field, see VPU_JOB_FLAGS_* above */249u32 flags;250/**251* Doorbell ring timestamp taken by KMD from SoC's global system clock, in252* microseconds. NPU can convert this value to its own fixed clock's timebase,253* to match other profiling timestamps.254*/255u64 doorbell_timestamp;256/** Extra id for job tracking, used only in the firmware perf traces */257u64 host_tracking_id;258/** Address of the primary preemption buffer to use for this job */259u64 primary_preempt_buf_addr;260/** Size of the primary preemption buffer to use for this job */261u32 primary_preempt_buf_size;262/** Size of secondary preemption buffer to use for this job */263u32 secondary_preempt_buf_size;264/** Address of secondary preemption buffer to use for this job */265u64 secondary_preempt_buf_addr;266u64 reserved_0;267};268269/**270* Inline command format.271* Inline commands are the commands executed at scheduler level (typically,272* synchronization directives). Inline command and job objects must be of273* the same size and have flags field at same offset.274*/275struct vpu_inline_cmd {276u64 reserved_0;277/** Inline command type, see VPU_INLINE_CMD_TYPE_* defines. */278u32 type;279/** Flags bit field, see VPU_JOB_FLAGS_* above. */280u32 flags;281/** Inline command payload. Depends on inline command type. */282union payload {283/** Fence (wait and signal) commands' payload. */284struct fence {285/** Fence object handle. */286u64 fence_handle;287/** User VA of the current fence value. */288u64 current_value_va;289/** User VA of the monitored fence value (read-only). */290u64 monitored_value_va;291/** Value to wait for or write in fence location. */292u64 value;293/** User VA of the log buffer in which to add log entry on completion. */294u64 log_buffer_va;295/** NPU private data. */296u64 npu_private_data;297} fence;298/**299* Other commands do not have a payload:300* Payload definition for future inline commands can be inserted here.301*/302u64 reserved_1[6];303} payload;304};305306/**307* Job queue slots can be populated either with job objects or inline command objects.308*/309union vpu_jobq_slot {310struct vpu_job_queue_entry job;311struct vpu_inline_cmd inline_cmd;312};313314/**315* Job queue control registers.316*/317struct vpu_job_queue_header {318u32 engine_idx;319u32 head;320u32 tail;321u32 flags;322/** Set to 1 to indicate priority_band field is valid */323u32 priority_band_valid;324/**325* Priority for the work of this job queue, valid only if the HWS is NOT used326* and the @ref priority_band_valid is set to 1. It is applied only during327* the @ref VPU_JSM_MSG_REGISTER_DB message processing.328* The device firmware might use the priority_band to optimize the power329* management logic, but it will not affect the order of jobs.330* Available priority bands: @see enum vpu_job_scheduling_priority_band331*/332u32 priority_band;333/** Inside realtime band assigns a further priority, limited to 0..31 range */334u32 realtime_priority_level;335u32 reserved_0[9];336};337338/*339* Job queue format.340*/341struct vpu_job_queue {342struct vpu_job_queue_header header;343union vpu_jobq_slot slot[];344};345346/**347* Logging entity types.348*349* This enum defines the different types of entities involved in logging.350*/351enum vpu_trace_entity_type {352/** Logging destination (entity where logs can be stored / printed). */353VPU_TRACE_ENTITY_TYPE_DESTINATION = 1,354/** Loggable HW component (HW entity that can be logged). */355VPU_TRACE_ENTITY_TYPE_HW_COMPONENT = 2,356};357358/**359* HWS specific log buffer header details.360* Total size is 32 bytes.361*/362struct vpu_hws_log_buffer_header {363/** Written by VPU after adding a log entry. Initialised by host to 0. */364u32 first_free_entry_index;365/** Incremented by VPU every time the VPU writes the 0th entry; initialised by host to 0. */366u32 wraparound_count;367/**368* This is the number of buffers that can be stored in the log buffer provided by the host.369* It is written by host before passing buffer to VPU. VPU should consider it read-only.370*/371u64 num_of_entries;372u64 reserved[2];373};374375/**376* HWS specific log buffer entry details.377* Total size is 32 bytes.378*/379struct vpu_hws_log_buffer_entry {380/** VPU timestamp must be an invariant timer tick (not impacted by DVFS) */381u64 vpu_timestamp;382/**383* Operation type:384* 0 - context state change385* 1 - queue new work386* 2 - queue unwait sync object387* 3 - queue no more work388* 4 - queue wait sync object389*/390u32 operation_type;391u32 reserved;392/** Operation data depends on operation type */393u64 operation_data[2];394};395396/* Native fence log buffer types. */397enum vpu_hws_native_fence_log_type {398VPU_HWS_NATIVE_FENCE_LOG_TYPE_WAITS = 1,399VPU_HWS_NATIVE_FENCE_LOG_TYPE_SIGNALS = 2400};401402/** HWS native fence log buffer header. */403struct vpu_hws_native_fence_log_header {404union {405struct {406/** Index of the first free entry in buffer. */407u32 first_free_entry_idx;408/**409* Incremented whenever the NPU wraps around the buffer and writes410* to the first entry again.411*/412u32 wraparound_count;413};414/** Field allowing atomic update of both fields above. */415u64 atomic_wraparound_and_entry_idx;416};417/** Log buffer type, see enum vpu_hws_native_fence_log_type. */418u64 type;419/** Allocated number of entries in the log buffer. */420u64 entry_nb;421u64 reserved[2];422};423424/** Native fence log operation types. */425enum vpu_hws_native_fence_log_op {426VPU_HWS_NATIVE_FENCE_LOG_OP_SIGNAL_EXECUTED = 0,427VPU_HWS_NATIVE_FENCE_LOG_OP_WAIT_UNBLOCKED = 1428};429430/** HWS native fence log entry. */431struct vpu_hws_native_fence_log_entry {432/** Newly signaled/unblocked fence value. */433u64 fence_value;434/** Native fence object handle to which this operation belongs. */435u64 fence_handle;436/** Operation type, see enum vpu_hws_native_fence_log_op. */437u64 op_type;438u64 reserved_0;439/**440* VPU_HWS_NATIVE_FENCE_LOG_OP_WAIT_UNBLOCKED only: Timestamp at which fence441* wait was started (in NPU SysTime).442*/443u64 fence_wait_start_ts;444u64 reserved_1;445/** Timestamp at which fence operation was completed (in NPU SysTime). */446u64 fence_end_ts;447};448449/** Native fence log buffer. */450struct vpu_hws_native_fence_log_buffer {451struct vpu_hws_native_fence_log_header header;452struct vpu_hws_native_fence_log_entry entry[];453};454455/*456* Host <-> VPU IPC messages types.457*/458enum vpu_ipc_msg_type {459/** Unsupported command */460VPU_JSM_MSG_UNKNOWN = 0xFFFFFFFF,461462/** IPC Host -> Device, base id for async commands */463VPU_JSM_MSG_ASYNC_CMD = 0x1100,464/**465* Reset engine. The NPU cancels all the jobs currently executing on the target466* engine making the engine become idle and then does a HW reset, before returning467* to the host.468* @see struct vpu_ipc_msg_payload_engine_reset469*/470VPU_JSM_MSG_ENGINE_RESET = VPU_JSM_MSG_ASYNC_CMD,471/**472* Preempt engine. The NPU stops (preempts) all the jobs currently473* executing on the target engine making the engine become idle and ready to474* execute new jobs.475* NOTE: The NPU does not remove unstarted jobs (if any) from job queues of476* the target engine, but it stops processing them (until the queue doorbell477* is rung again); the host is responsible to reset the job queue, either478* after preemption or when resubmitting jobs to the queue.479* @see vpu_ipc_msg_payload_engine_preempt480*/481VPU_JSM_MSG_ENGINE_PREEMPT = 0x1101,482/**483* OS scheduling doorbell register command484* @see vpu_ipc_msg_payload_register_db485*/486VPU_JSM_MSG_REGISTER_DB = 0x1102,487/**488* OS scheduling doorbell unregister command489* @see vpu_ipc_msg_payload_unregister_db490*/491VPU_JSM_MSG_UNREGISTER_DB = 0x1103,492/**493* Query engine heartbeat. Heartbeat is expected to increase monotonically494* and increase while work is being progressed by NPU.495* @see vpu_ipc_msg_payload_query_engine_hb496*/497VPU_JSM_MSG_QUERY_ENGINE_HB = 0x1104,498VPU_JSM_MSG_GET_POWER_LEVEL_COUNT = 0x1105,499VPU_JSM_MSG_GET_POWER_LEVEL = 0x1106,500VPU_JSM_MSG_SET_POWER_LEVEL = 0x1107,501/* @deprecated */502VPU_JSM_MSG_METRIC_STREAMER_OPEN = 0x1108,503/* @deprecated */504VPU_JSM_MSG_METRIC_STREAMER_CLOSE = 0x1109,505/** Configure logging (used to modify configuration passed in boot params). */506VPU_JSM_MSG_TRACE_SET_CONFIG = 0x110a,507/** Return current logging configuration. */508VPU_JSM_MSG_TRACE_GET_CONFIG = 0x110b,509/**510* Get masks of destinations and HW components supported by the firmware511* (may vary between HW generations and FW compile512* time configurations)513*/514VPU_JSM_MSG_TRACE_GET_CAPABILITY = 0x110c,515/** Get the name of a destination or HW component. */516VPU_JSM_MSG_TRACE_GET_NAME = 0x110d,517/**518* Release resource associated with host ssid . All jobs that belong to the host_ssid519* aborted and removed from internal scheduling queues. All doorbells assigned520* to the host_ssid are unregistered and any internal FW resources belonging to521* the host_ssid are released.522* @see vpu_ipc_msg_payload_ssid_release523*/524VPU_JSM_MSG_SSID_RELEASE = 0x110e,525/**526* Start collecting metric data.527* @see vpu_jsm_metric_streamer_start528*/529VPU_JSM_MSG_METRIC_STREAMER_START = 0x110f,530/**531* Stop collecting metric data. This command will return success if it is called532* for a metric stream that has already been stopped or was never started.533* @see vpu_jsm_metric_streamer_stop534*/535VPU_JSM_MSG_METRIC_STREAMER_STOP = 0x1110,536/**537* Update current and next buffer for metric data collection. This command can538* also be used to request information about the number of collected samples539* and the amount of data written to the buffer.540* @see vpu_jsm_metric_streamer_update541*/542VPU_JSM_MSG_METRIC_STREAMER_UPDATE = 0x1111,543/**544* Request description of selected metric groups and metric counters within545* each group. The VPU will write the description of groups and counters to546* the buffer specified in the command structure.547* @see vpu_jsm_metric_streamer_start548*/549VPU_JSM_MSG_METRIC_STREAMER_INFO = 0x1112,550/**551* Control command: Priority band setup552* @see vpu_ipc_msg_payload_hws_priority_band_setup553*/554VPU_JSM_MSG_SET_PRIORITY_BAND_SETUP = 0x1113,555/**556* Control command: Create command queue557* @see vpu_ipc_msg_payload_hws_create_cmdq558*/559VPU_JSM_MSG_CREATE_CMD_QUEUE = 0x1114,560/**561* Control command: Destroy command queue562* @see vpu_ipc_msg_payload_hws_destroy_cmdq563*/564VPU_JSM_MSG_DESTROY_CMD_QUEUE = 0x1115,565/**566* Control command: Set context scheduling properties567* @see vpu_ipc_msg_payload_hws_set_context_sched_properties568*/569VPU_JSM_MSG_SET_CONTEXT_SCHED_PROPERTIES = 0x1116,570/**571* Register a doorbell to notify VPU of new work. The doorbell may later be572* deallocated or reassigned to another context.573* @see vpu_jsm_hws_register_db574*/575VPU_JSM_MSG_HWS_REGISTER_DB = 0x1117,576/**577* Control command: Log buffer setting578* @see vpu_ipc_msg_payload_hws_set_scheduling_log579*/580VPU_JSM_MSG_HWS_SET_SCHEDULING_LOG = 0x1118,581/**582* Control command: Suspend command queue.583* @see vpu_ipc_msg_payload_hws_suspend_cmdq584*/585VPU_JSM_MSG_HWS_SUSPEND_CMDQ = 0x1119,586/**587* Control command: Resume command queue588* @see vpu_ipc_msg_payload_hws_resume_cmdq589*/590VPU_JSM_MSG_HWS_RESUME_CMDQ = 0x111a,591/**592* Control command: Resume engine after reset593* @see vpu_ipc_msg_payload_hws_resume_engine594*/595VPU_JSM_MSG_HWS_ENGINE_RESUME = 0x111b,596/**597* Control command: Enable survivability/DCT mode598* @see vpu_ipc_msg_payload_pwr_dct_control599*/600VPU_JSM_MSG_DCT_ENABLE = 0x111c,601/**602* Control command: Disable survivability/DCT mode603* This command has no payload604*/605VPU_JSM_MSG_DCT_DISABLE = 0x111d,606/**607* Dump VPU state. To be used for debug purposes only.608* This command has no payload.609* NOTE: Please introduce new ASYNC commands before this one.610*/611VPU_JSM_MSG_STATE_DUMP = 0x11FF,612613/** IPC Host -> Device, base id for general commands */614VPU_JSM_MSG_GENERAL_CMD = 0x1200,615/** Unsupported command */616VPU_JSM_MSG_BLOB_DEINIT_DEPRECATED = VPU_JSM_MSG_GENERAL_CMD,617/**618* Control dyndbg behavior by executing a dyndbg command; equivalent to619* Linux command:620* @verbatim echo '<dyndbg_cmd>' > <debugfs>/dynamic_debug/control @endverbatim621* @see vpu_ipc_msg_payload_dyndbg_control622*/623VPU_JSM_MSG_DYNDBG_CONTROL = 0x1201,624/**625* Perform the save procedure for the D0i3 entry626*/627VPU_JSM_MSG_PWR_D0I3_ENTER = 0x1202,628629/**630* IPC Device -> Host, Job completion631* @see struct vpu_ipc_msg_payload_job_done632*/633VPU_JSM_MSG_JOB_DONE = 0x2100,634/**635* IPC Device -> Host, Fence signalled636* @see vpu_ipc_msg_payload_native_fence_signalled637*/638VPU_JSM_MSG_NATIVE_FENCE_SIGNALLED = 0x2101,639640/* IPC Device -> Host, Async command completion */641VPU_JSM_MSG_ASYNC_CMD_DONE = 0x2200,642/**643* IPC Device -> Host, engine reset complete644* @see vpu_ipc_msg_payload_engine_reset_done645*/646VPU_JSM_MSG_ENGINE_RESET_DONE = VPU_JSM_MSG_ASYNC_CMD_DONE,647/**648* Preempt complete message649* @see vpu_ipc_msg_payload_engine_preempt_done650*/651VPU_JSM_MSG_ENGINE_PREEMPT_DONE = 0x2201,652VPU_JSM_MSG_REGISTER_DB_DONE = 0x2202,653VPU_JSM_MSG_UNREGISTER_DB_DONE = 0x2203,654/**655* Response to query engine heartbeat.656* @see vpu_ipc_msg_payload_query_engine_hb_done657*/658VPU_JSM_MSG_QUERY_ENGINE_HB_DONE = 0x2204,659VPU_JSM_MSG_GET_POWER_LEVEL_COUNT_DONE = 0x2205,660VPU_JSM_MSG_GET_POWER_LEVEL_DONE = 0x2206,661VPU_JSM_MSG_SET_POWER_LEVEL_DONE = 0x2207,662/* @deprecated */663VPU_JSM_MSG_METRIC_STREAMER_OPEN_DONE = 0x2208,664/* @deprecated */665VPU_JSM_MSG_METRIC_STREAMER_CLOSE_DONE = 0x2209,666/** Response to VPU_JSM_MSG_TRACE_SET_CONFIG. */667VPU_JSM_MSG_TRACE_SET_CONFIG_RSP = 0x220a,668/** Response to VPU_JSM_MSG_TRACE_GET_CONFIG. */669VPU_JSM_MSG_TRACE_GET_CONFIG_RSP = 0x220b,670/** Response to VPU_JSM_MSG_TRACE_GET_CAPABILITY. */671VPU_JSM_MSG_TRACE_GET_CAPABILITY_RSP = 0x220c,672/** Response to VPU_JSM_MSG_TRACE_GET_NAME. */673VPU_JSM_MSG_TRACE_GET_NAME_RSP = 0x220d,674/**675* Response to VPU_JSM_MSG_SSID_RELEASE.676* @see vpu_ipc_msg_payload_ssid_release677*/678VPU_JSM_MSG_SSID_RELEASE_DONE = 0x220e,679/**680* Response to VPU_JSM_MSG_METRIC_STREAMER_START.681* VPU will return an error result if metric collection cannot be started,682* e.g. when the specified metric mask is invalid.683* @see vpu_jsm_metric_streamer_done684*/685VPU_JSM_MSG_METRIC_STREAMER_START_DONE = 0x220f,686/**687* Response to VPU_JSM_MSG_METRIC_STREAMER_STOP.688* Returns information about collected metric data.689* @see vpu_jsm_metric_streamer_done690*/691VPU_JSM_MSG_METRIC_STREAMER_STOP_DONE = 0x2210,692/**693* Response to VPU_JSM_MSG_METRIC_STREAMER_UPDATE.694* Returns information about collected metric data.695* @see vpu_jsm_metric_streamer_done696*/697VPU_JSM_MSG_METRIC_STREAMER_UPDATE_DONE = 0x2211,698/**699* Response to VPU_JSM_MSG_METRIC_STREAMER_INFO.700* Returns a description of the metric groups and metric counters.701* @see vpu_jsm_metric_streamer_done702*/703VPU_JSM_MSG_METRIC_STREAMER_INFO_DONE = 0x2212,704/**705* Asynchronous event sent from the VPU to the host either when the current706* metric buffer is full or when the VPU has collected a multiple of707* @ref vpu_jsm_metric_streamer_start::notify_sample_count samples as indicated708* through the start command (VPU_JSM_MSG_METRIC_STREAMER_START). Returns709* information about collected metric data.710* @see vpu_jsm_metric_streamer_done711*/712VPU_JSM_MSG_METRIC_STREAMER_NOTIFICATION = 0x2213,713/**714* Response to control command: Priority band setup715* @see vpu_ipc_msg_payload_hws_priority_band_setup716*/717VPU_JSM_MSG_SET_PRIORITY_BAND_SETUP_RSP = 0x2214,718/**719* Response to control command: Create command queue720* @see vpu_ipc_msg_payload_hws_create_cmdq_rsp721*/722VPU_JSM_MSG_CREATE_CMD_QUEUE_RSP = 0x2215,723/**724* Response to control command: Destroy command queue725* @see vpu_ipc_msg_payload_hws_destroy_cmdq726*/727VPU_JSM_MSG_DESTROY_CMD_QUEUE_RSP = 0x2216,728/**729* Response to control command: Set context scheduling properties730* @see vpu_ipc_msg_payload_hws_set_context_sched_properties731*/732VPU_JSM_MSG_SET_CONTEXT_SCHED_PROPERTIES_RSP = 0x2217,733/**734* Response to control command: Log buffer setting735* @see vpu_ipc_msg_payload_hws_set_scheduling_log736*/737VPU_JSM_MSG_HWS_SET_SCHEDULING_LOG_RSP = 0x2218,738/**739* IPC Device -> Host, HWS notify index entry of log buffer written740* @see vpu_ipc_msg_payload_hws_scheduling_log_notification741*/742VPU_JSM_MSG_HWS_SCHEDULING_LOG_NOTIFICATION = 0x2219,743/**744* IPC Device -> Host, HWS completion of a context suspend request745* @see vpu_ipc_msg_payload_hws_suspend_cmdq746*/747VPU_JSM_MSG_HWS_SUSPEND_CMDQ_DONE = 0x221a,748/**749* Response to control command: Resume command queue750* @see vpu_ipc_msg_payload_hws_resume_cmdq751*/752VPU_JSM_MSG_HWS_RESUME_CMDQ_RSP = 0x221b,753/**754* Response to control command: Resume engine command response755* @see vpu_ipc_msg_payload_hws_resume_engine756*/757VPU_JSM_MSG_HWS_RESUME_ENGINE_DONE = 0x221c,758/**759* Response to control command: Enable survivability/DCT mode760* This command has no payload761*/762VPU_JSM_MSG_DCT_ENABLE_DONE = 0x221d,763/**764* Response to control command: Disable survivability/DCT mode765* This command has no payload766*/767VPU_JSM_MSG_DCT_DISABLE_DONE = 0x221e,768/**769* Response to state dump control command.770* This command has no payload.771* NOTE: Please introduce new ASYNC responses before this one.772*/773VPU_JSM_MSG_STATE_DUMP_RSP = 0x22FF,774775/* IPC Device -> Host, General command completion */776VPU_JSM_MSG_GENERAL_CMD_DONE = 0x2300,777VPU_JSM_MSG_BLOB_DEINIT_DONE = VPU_JSM_MSG_GENERAL_CMD_DONE,778/** Response to VPU_JSM_MSG_DYNDBG_CONTROL. */779VPU_JSM_MSG_DYNDBG_CONTROL_RSP = 0x2301,780/**781* Acknowledgment of completion of the save procedure initiated by782* VPU_JSM_MSG_PWR_D0I3_ENTER783*/784VPU_JSM_MSG_PWR_D0I3_ENTER_DONE = 0x2302,785};786787enum vpu_ipc_msg_status { VPU_JSM_MSG_FREE, VPU_JSM_MSG_ALLOCATED };788789/**790* Engine reset request payload791* @see VPU_JSM_MSG_ENGINE_RESET792*/793struct vpu_ipc_msg_payload_engine_reset {794/** Engine to be reset. */795u32 engine_idx;796/** Reserved */797u32 reserved_0;798};799800/**801* Engine preemption request struct802* @see VPU_JSM_MSG_ENGINE_PREEMPT803*/804struct vpu_ipc_msg_payload_engine_preempt {805/** Engine to be preempted. */806u32 engine_idx;807/** ID of the preemption request. */808u32 preempt_id;809};810811/**812* Register doorbell command structure.813* This structure supports doorbell registration for only OS scheduling.814* @see VPU_JSM_MSG_REGISTER_DB815*/816struct vpu_ipc_msg_payload_register_db {817/** Index of the doorbell to register. */818u32 db_idx;819/** Reserved */820u32 reserved_0;821/** Virtual address in Global GTT pointing to the start of job queue. */822u64 jobq_base;823/** Size of the job queue in bytes. */824u32 jobq_size;825/** Host sub-stream ID for the context assigned to the doorbell. */826u32 host_ssid;827};828829/**830* Unregister doorbell command structure.831* Request structure to unregister a doorbell for both HW and OS scheduling.832* @see VPU_JSM_MSG_UNREGISTER_DB833*/834struct vpu_ipc_msg_payload_unregister_db {835/** Index of the doorbell to unregister. */836u32 db_idx;837/** Reserved */838u32 reserved_0;839};840841/**842* Heartbeat request structure843* @see VPU_JSM_MSG_QUERY_ENGINE_HB844*/845struct vpu_ipc_msg_payload_query_engine_hb {846/** Engine to return heartbeat value. */847u32 engine_idx;848/** Reserved */849u32 reserved_0;850};851852struct vpu_ipc_msg_payload_power_level {853/**854* Requested power level. The power level value is in the855* range [0, power_level_count-1] where power_level_count856* is the number of available power levels as returned by857* the get power level count command. A power level of 0858* corresponds to the maximum possible power level, while859* power_level_count-1 corresponds to the minimum possible860* power level. Values outside of this range are not861* considered to be valid.862*/863u32 power_level;864/* Reserved */865u32 reserved_0;866};867868/**869* Structure for requesting ssid release870* @see VPU_JSM_MSG_SSID_RELEASE871*/872struct vpu_ipc_msg_payload_ssid_release {873/** Host sub-stream ID for the context to be released. */874u32 host_ssid;875/** Reserved */876u32 reserved_0;877};878879/**880* @brief Metric streamer start command structure.881* This structure is also used with VPU_JSM_MSG_METRIC_STREAMER_INFO to request metric882* groups and metric counters description from the firmware.883* @see VPU_JSM_MSG_METRIC_STREAMER_START884* @see VPU_JSM_MSG_METRIC_STREAMER_INFO885*/886struct vpu_jsm_metric_streamer_start {887/**888* Bitmask to select the desired metric groups.889* A metric group can belong only to one metric streamer instance at a time.890* Since each metric streamer instance has a unique set of metric groups, it891* can also identify a metric streamer instance if more than one instance was892* started. If the VPU device does not support multiple metric streamer instances,893* then VPU_JSM_MSG_METRIC_STREAMER_START will return an error even if the second894* instance has different groups to the first.895*/896u64 metric_group_mask;897/** Sampling rate in nanoseconds. */898u64 sampling_rate;899/**900* If > 0 the VPU will send a VPU_JSM_MSG_METRIC_STREAMER_NOTIFICATION message901* after every @ref notify_sample_count samples is collected or dropped by the VPU.902* If set to UINT_MAX the VPU will only generate a notification when the metric903* buffer is full. If set to 0 the VPU will never generate a notification.904*/905u32 notify_sample_count;906u32 reserved_0;907/**908* Address and size of the buffer where the VPU will write metric data. The909* VPU writes all counters from enabled metric groups one after another. If910* there is no space left to write data at the next sample period the VPU911* will switch to the next buffer (@ref next_buffer_addr) and will optionally912* send a notification to the host driver if @ref notify_sample_count is non-zero.913* If @ref next_buffer_addr is NULL the VPU will stop collecting metric data.914*/915u64 buffer_addr;916u64 buffer_size;917/**918* Address and size of the next buffer to write metric data to after the initial919* buffer is full. If the address is NULL the VPU will stop collecting metric920* data.921*/922u64 next_buffer_addr;923u64 next_buffer_size;924};925926/**927* @brief Metric streamer stop command structure.928* @see VPU_JSM_MSG_METRIC_STREAMER_STOP929*/930struct vpu_jsm_metric_streamer_stop {931/** Bitmask to select the desired metric groups. */932u64 metric_group_mask;933};934935/**936* Provide VPU FW with buffers to write metric data.937* @see VPU_JSM_MSG_METRIC_STREAMER_UPDATE938*/939struct vpu_jsm_metric_streamer_update {940/** Metric group mask that identifies metric streamer instance. */941u64 metric_group_mask;942/**943* Address and size of the buffer where the VPU will write metric data.944* This member dictates how the update operation should perform:945* 1. client needs information about the number of collected samples and the946* amount of data written to the current buffer947* 2. client wants to switch to a new buffer948*949* Case 1. is identified by the buffer address being 0 or the same as the950* currently used buffer address. In this case the buffer size is ignored and951* the size of the current buffer is unchanged. The VPU will return an update952* in the vpu_jsm_metric_streamer_done structure. The internal writing position953* into the buffer is not changed.954*955* Case 2. is identified by the address being non-zero and differs from the956* current buffer address. The VPU will immediately switch data collection to957* the new buffer. Then the VPU will return an update in the958* vpu_jsm_metric_streamer_done structure.959*/960u64 buffer_addr;961u64 buffer_size;962/**963* Address and size of the next buffer to write metric data after the initial964* buffer is full. If the address is NULL the VPU will stop collecting metric965* data but will continue to record dropped samples.966*967* Note that there is a hazard possible if both buffer_addr and the next_buffer_addr968* are non-zero in same update request. It is the host's responsibility to ensure969* that both addresses make sense even if the VPU just switched to writing samples970* from the current to the next buffer.971*/972u64 next_buffer_addr;973u64 next_buffer_size;974};975976/**977* Device -> host job completion message.978* @see VPU_JSM_MSG_JOB_DONE979*/980struct vpu_ipc_msg_payload_job_done {981/** Engine to which the job was submitted. */982u32 engine_idx;983/** Index of the doorbell to which the job was submitted */984u32 db_idx;985/** ID of the completed job */986u32 job_id;987/** Status of the completed job */988u32 job_status;989/** Host SSID */990u32 host_ssid;991/** Zero Padding */992u32 reserved_0;993/** Command queue id */994u64 cmdq_id;995};996997/**998* Notification message upon native fence signalling.999* @see VPU_JSM_MSG_NATIVE_FENCE_SIGNALLED1000*/1001struct vpu_ipc_msg_payload_native_fence_signalled {1002/** Engine ID. */1003u32 engine_idx;1004/** Host SSID. */1005u32 host_ssid;1006/** CMDQ ID */1007u64 cmdq_id;1008/** Fence object handle. */1009u64 fence_handle;1010};10111012/**1013* vpu_ipc_msg_payload_engine_reset_done will contain an array of this structure1014* which contains which queues caused reset if FW was able to detect any error.1015* @see vpu_ipc_msg_payload_engine_reset_done1016*/1017struct vpu_jsm_engine_reset_context {1018/** Host SSID */1019u32 host_ssid;1020/** Zero Padding */1021u32 reserved_0;1022/** Command queue id */1023u64 cmdq_id;1024/** See VPU_ENGINE_RESET_CONTEXT_* defines */1025u64 flags;1026};10271028/**1029* Engine reset response.1030* @see VPU_JSM_MSG_ENGINE_RESET_DONE1031*/1032struct vpu_ipc_msg_payload_engine_reset_done {1033/** Engine ordinal */1034u32 engine_idx;1035/** Number of impacted contexts */1036u32 num_impacted_contexts;1037/** Array of impacted command queue ids and their flags */1038struct vpu_jsm_engine_reset_context1039impacted_contexts[VPU_MAX_ENGINE_RESET_IMPACTED_CONTEXTS];1040};10411042/**1043* Preemption response struct1044* @see VPU_JSM_MSG_ENGINE_PREEMPT_DONE1045*/1046struct vpu_ipc_msg_payload_engine_preempt_done {1047/** Engine preempted. */1048u32 engine_idx;1049/** ID of the preemption request. */1050u32 preempt_id;1051};10521053/**1054* Response structure for register doorbell command for both OS1055* and HW scheduling.1056* @see VPU_JSM_MSG_REGISTER_DB1057* @see VPU_JSM_MSG_HWS_REGISTER_DB1058*/1059struct vpu_ipc_msg_payload_register_db_done {1060/* Index of the registered doorbell. */1061u32 db_idx;1062/* Reserved */1063u32 reserved_0;1064};10651066/**1067* Response structure for unregister doorbell command for both OS1068* and HW scheduling.1069* @see VPU_JSM_MSG_UNREGISTER_DB1070*/1071struct vpu_ipc_msg_payload_unregister_db_done {1072/* Index of the unregistered doorbell. */1073u32 db_idx;1074/* Reserved */1075u32 reserved_0;1076};10771078/**1079* Structure for heartbeat response1080* @see VPU_JSM_MSG_QUERY_ENGINE_HB_DONE1081*/1082struct vpu_ipc_msg_payload_query_engine_hb_done {1083/** Engine returning heartbeat value. */1084u32 engine_idx;1085/** Reserved */1086u32 reserved_0;1087/** Heartbeat value. */1088u64 heartbeat;1089};10901091struct vpu_ipc_msg_payload_get_power_level_count_done {1092/**1093* Number of supported power levels. The maximum possible1094* value of power_level_count is 16 but this may vary across1095* implementations.1096*/1097u32 power_level_count;1098/* Reserved */1099u32 reserved_0;1100/**1101* Power consumption limit for each supported power level in1102* [0-100%] range relative to power level 0.1103*/1104u8 power_limit[16];1105};11061107/**1108* HWS priority band setup request / response1109* @see VPU_JSM_MSG_SET_PRIORITY_BAND_SETUP1110*/1111struct vpu_ipc_msg_payload_hws_priority_band_setup {1112/*1113* Grace period in 100ns units when preempting another priority band for1114* this priority band1115*/1116u32 grace_period[VPU_HWS_NUM_PRIORITY_BANDS];1117/*1118* Default quantum in 100ns units for scheduling across processes1119* within a priority band1120* Minimum value supported by NPU is 1ms (10000 in 100ns units).1121*/1122u32 process_quantum[VPU_HWS_NUM_PRIORITY_BANDS];1123/*1124* Default grace period in 100ns units for processes that preempt each1125* other within a priority band1126*/1127u32 process_grace_period[VPU_HWS_NUM_PRIORITY_BANDS];1128/*1129* For normal priority band, specifies the target VPU percentage1130* in situations when it's starved by the focus band.1131*/1132u32 normal_band_percentage;1133/*1134* TDR timeout value in milliseconds. Default value of 0 meaning no timeout.1135*/1136u32 tdr_timeout;1137/* Non-interactive queue timeout for no progress of heartbeat in milliseconds.1138* Default value of 0 meaning no timeout.1139*/1140u32 non_interactive_no_progress_timeout;1141/*1142* Non-interactive queue upper limit timeout value in milliseconds. Default1143* value of 0 meaning no timeout.1144*/1145u32 non_interactive_timeout;1146};11471148/**1149* @brief HWS create command queue request.1150* Host will create a command queue via this command.1151* Note: Cmdq group is a handle of an object which1152* may contain one or more command queues.1153* @see VPU_JSM_MSG_CREATE_CMD_QUEUE1154*/1155struct vpu_ipc_msg_payload_hws_create_cmdq {1156/* Process id */1157u64 process_id;1158/* Host SSID */1159u32 host_ssid;1160/* Engine for which queue is being created */1161u32 engine_idx;1162/* Cmdq group: only used for HWS logging of state changes */1163u64 cmdq_group;1164/* Command queue id */1165u64 cmdq_id;1166/* Command queue base */1167u64 cmdq_base;1168/* Command queue size */1169u32 cmdq_size;1170/* Zero padding */1171u32 reserved_0;1172};11731174/**1175* HWS create command queue response.1176* @see VPU_JSM_MSG_CREATE_CMD_QUEUE_RSP1177*/1178struct vpu_ipc_msg_payload_hws_create_cmdq_rsp {1179/** Process id */1180u64 process_id;1181/** Host SSID */1182u32 host_ssid;1183/** Engine for which queue is being created */1184u32 engine_idx;1185/** Command queue group */1186u64 cmdq_group;1187/** Command queue id */1188u64 cmdq_id;1189};11901191/**1192* HWS destroy command queue request / response1193* @see VPU_JSM_MSG_DESTROY_CMD_QUEUE1194* @see VPU_JSM_MSG_DESTROY_CMD_QUEUE_RSP1195*/1196struct vpu_ipc_msg_payload_hws_destroy_cmdq {1197/** Host SSID */1198u32 host_ssid;1199/** Zero Padding */1200u32 reserved;1201/** Command queue id */1202u64 cmdq_id;1203};12041205/**1206* HWS set context scheduling properties request / response1207* @see VPU_JSM_MSG_SET_CONTEXT_SCHED_PROPERTIES1208* @see VPU_JSM_MSG_SET_CONTEXT_SCHED_PROPERTIES_RSP1209*/1210struct vpu_ipc_msg_payload_hws_set_context_sched_properties {1211/** Host SSID */1212u32 host_ssid;1213/** Zero Padding */1214u32 reserved_0;1215/** Command queue id */1216u64 cmdq_id;1217/**1218* Priority band to assign to work of this context.1219* Available priority bands: @see enum vpu_job_scheduling_priority_band1220*/1221u32 priority_band;1222/** Inside realtime band assigns a further priority */1223u32 realtime_priority_level;1224/** Priority relative to other contexts in the same process */1225s32 in_process_priority;1226/** Zero padding / Reserved */1227u32 reserved_1;1228/**1229* Context quantum relative to other contexts of same priority in the same process1230* Minimum value supported by NPU is 1ms (10000 in 100ns units).1231*/1232u64 context_quantum;1233/** Grace period when preempting context of the same priority within the same process */1234u64 grace_period_same_priority;1235/** Grace period when preempting context of a lower priority within the same process */1236u64 grace_period_lower_priority;1237};12381239/**1240* Register doorbell command structure.1241* This structure supports doorbell registration for both HW and OS scheduling.1242* Note: Queue base and size are added here so that the same structure can be used for1243* OS scheduling and HW scheduling. For OS scheduling, cmdq_id will be ignored1244* and cmdq_base and cmdq_size will be used. For HW scheduling, cmdq_base and cmdq_size will be1245* ignored and cmdq_id is used.1246* @see VPU_JSM_MSG_HWS_REGISTER_DB1247*/1248struct vpu_jsm_hws_register_db {1249/** Index of the doorbell to register. */1250u32 db_id;1251/** Host sub-stream ID for the context assigned to the doorbell. */1252u32 host_ssid;1253/** ID of the command queue associated with the doorbell. */1254u64 cmdq_id;1255/** Virtual address pointing to the start of command queue. */1256u64 cmdq_base;1257/** Size of the command queue in bytes. */1258u64 cmdq_size;1259};12601261/**1262* Structure to set another buffer to be used for scheduling-related logging.1263* The size of the logging buffer and the number of entries is defined as part of the1264* buffer itself as described next.1265* The log buffer received from the host is made up of;1266* - header: 32 bytes in size, as shown in @ref vpu_hws_log_buffer_header.1267* The header contains the number of log entries in the buffer.1268* - log entry: 0 to n-1, each log entry is 32 bytes in size, as shown in1269* @ref vpu_hws_log_buffer_entry.1270* The entry contains the VPU timestamp, operation type and data.1271* The host should provide the notify index value of log buffer to VPU. This is a1272* value defined within the log buffer and when written to will generate the1273* scheduling log notification.1274* The host should set engine_idx and vpu_log_buffer_va to 0 to disable logging1275* for a particular engine.1276* VPU will handle one log buffer for each of supported engines.1277* VPU should allow the logging to consume one host_ssid.1278* @see VPU_JSM_MSG_HWS_SET_SCHEDULING_LOG1279* @see VPU_JSM_MSG_HWS_SET_SCHEDULING_LOG_RSP1280* @see VPU_JSM_MSG_HWS_SCHEDULING_LOG_NOTIFICATION1281*/1282struct vpu_ipc_msg_payload_hws_set_scheduling_log {1283/** Engine ordinal */1284u32 engine_idx;1285/** Host SSID */1286u32 host_ssid;1287/**1288* VPU log buffer virtual address.1289* Set to 0 to disable logging for this engine.1290*/1291u64 vpu_log_buffer_va;1292/**1293* Notify index of log buffer. VPU_JSM_MSG_HWS_SCHEDULING_LOG_NOTIFICATION1294* is generated when an event log is written to this index.1295*/1296u64 notify_index;1297/**1298* Field is now deprecated, will be removed when KMD is updated to support removal1299*/1300u32 enable_extra_events;1301/** Zero Padding */1302u32 reserved_0;1303};13041305/**1306* The scheduling log notification is generated by VPU when it writes1307* an event into the log buffer at the notify_index. VPU notifies host with1308* VPU_JSM_MSG_HWS_SCHEDULING_LOG_NOTIFICATION. This is an asynchronous1309* message from VPU to host.1310* @see VPU_JSM_MSG_HWS_SCHEDULING_LOG_NOTIFICATION1311* @see VPU_JSM_MSG_HWS_SET_SCHEDULING_LOG1312*/1313struct vpu_ipc_msg_payload_hws_scheduling_log_notification {1314/** Engine ordinal */1315u32 engine_idx;1316/** Zero Padding */1317u32 reserved_0;1318};13191320/**1321* HWS suspend command queue request and done structure.1322* Host will request the suspend of contexts and VPU will;1323* - Suspend all work on this context1324* - Preempt any running work1325* - Asynchronously perform the above and return success immediately once1326* all items above are started successfully1327* - Notify the host of completion of these operations via1328* VPU_JSM_MSG_HWS_SUSPEND_CMDQ_DONE1329* - Reject any other context operations on a context with an in-flight1330* suspend request running1331* Same structure used when VPU notifies host of completion of a context suspend1332* request. The ids and suspend fence value reported in this command will match1333* the one in the request from the host to suspend the context. Once suspend is1334* complete, VPU will not access any data relating to this command queue until1335* it is resumed.1336* @see VPU_JSM_MSG_HWS_SUSPEND_CMDQ1337* @see VPU_JSM_MSG_HWS_SUSPEND_CMDQ_DONE1338*/1339struct vpu_ipc_msg_payload_hws_suspend_cmdq {1340/** Host SSID */1341u32 host_ssid;1342/** Zero Padding */1343u32 reserved_0;1344/** Command queue id */1345u64 cmdq_id;1346/**1347* Suspend fence value - reported by the VPU suspend context1348* completed once suspend is complete.1349*/1350u64 suspend_fence_value;1351};13521353/**1354* HWS Resume command queue request / response structure.1355* Host will request the resume of a context;1356* - VPU will resume all work on this context1357* - Scheduler will allow this context to be scheduled1358* @see VPU_JSM_MSG_HWS_RESUME_CMDQ1359* @see VPU_JSM_MSG_HWS_RESUME_CMDQ_RSP1360*/1361struct vpu_ipc_msg_payload_hws_resume_cmdq {1362/** Host SSID */1363u32 host_ssid;1364/** Zero Padding */1365u32 reserved_0;1366/** Command queue id */1367u64 cmdq_id;1368};13691370/**1371* HWS Resume engine request / response structure.1372* After a HWS engine reset, all scheduling is stopped on VPU until an engine resume.1373* Host shall send this command to resume scheduling of any valid queue.1374* @see VPU_JSM_MSG_HWS_ENGINE_RESUME1375* @see VPU_JSM_MSG_HWS_RESUME_ENGINE_DONE1376*/1377struct vpu_ipc_msg_payload_hws_resume_engine {1378/** Engine to be resumed */1379u32 engine_idx;1380/** Reserved */1381u32 reserved_0;1382};13831384/**1385* Payload for VPU_JSM_MSG_TRACE_SET_CONFIG[_RSP] and1386* VPU_JSM_MSG_TRACE_GET_CONFIG_RSP messages.1387*1388* The payload is interpreted differently depending on the type of message:1389*1390* - For VPU_JSM_MSG_TRACE_SET_CONFIG, the payload specifies the desired1391* logging configuration to be set.1392*1393* - For VPU_JSM_MSG_TRACE_SET_CONFIG_RSP, the payload reports the logging1394* configuration that was set after a VPU_JSM_MSG_TRACE_SET_CONFIG request.1395* The host can compare this payload with the one it sent in the1396* VPU_JSM_MSG_TRACE_SET_CONFIG request to check whether or not the1397* configuration was set as desired.1398*1399* - VPU_JSM_MSG_TRACE_GET_CONFIG_RSP, the payload reports the current logging1400* configuration.1401*/1402struct vpu_ipc_msg_payload_trace_config {1403/**1404* Logging level (currently set or to be set); see 'mvLog_t' enum for1405* acceptable values. The specified logging level applies to all1406* destinations and HW components1407*/1408u32 trace_level;1409/**1410* Bitmask of logging destinations (currently enabled or to be enabled);1411* bitwise OR of values defined in logging_destination enum.1412*/1413u32 trace_destination_mask;1414/**1415* Bitmask of loggable HW components (currently enabled or to be enabled);1416* bitwise OR of values defined in loggable_hw_component enum.1417*/1418u64 trace_hw_component_mask;1419u64 reserved_0; /**< Reserved for future extensions. */1420};14211422/**1423* Payload for VPU_JSM_MSG_TRACE_GET_CAPABILITY_RSP messages.1424*/1425struct vpu_ipc_msg_payload_trace_capability_rsp {1426u32 trace_destination_mask; /**< Bitmask of supported logging destinations. */1427u32 reserved_0;1428u64 trace_hw_component_mask; /**< Bitmask of supported loggable HW components. */1429u64 reserved_1; /**< Reserved for future extensions. */1430};14311432/**1433* Payload for VPU_JSM_MSG_TRACE_GET_NAME requests.1434*/1435struct vpu_ipc_msg_payload_trace_get_name {1436/**1437* The type of the entity to query name for; see logging_entity_type for1438* possible values.1439*/1440u32 entity_type;1441u32 reserved_0;1442/**1443* The ID of the entity to query name for; possible values depends on the1444* entity type.1445*/1446u64 entity_id;1447};14481449/**1450* Payload for VPU_JSM_MSG_TRACE_GET_NAME_RSP responses.1451*/1452struct vpu_ipc_msg_payload_trace_get_name_rsp {1453/**1454* The type of the entity whose name was queried; see logging_entity_type1455* for possible values.1456*/1457u32 entity_type;1458u32 reserved_0;1459/**1460* The ID of the entity whose name was queried; possible values depends on1461* the entity type.1462*/1463u64 entity_id;1464/** Reserved for future extensions. */1465u64 reserved_1;1466/** The name of the entity. */1467char entity_name[VPU_TRACE_ENTITY_NAME_MAX_LEN];1468};14691470/**1471* Data sent from the VPU to the host in all metric streamer response messages1472* and in asynchronous notification.1473* @see VPU_JSM_MSG_METRIC_STREAMER_START_DONE1474* @see VPU_JSM_MSG_METRIC_STREAMER_STOP_DONE1475* @see VPU_JSM_MSG_METRIC_STREAMER_UPDATE_DONE1476* @see VPU_JSM_MSG_METRIC_STREAMER_INFO_DONE1477* @see VPU_JSM_MSG_METRIC_STREAMER_NOTIFICATION1478*/1479struct vpu_jsm_metric_streamer_done {1480/** Metric group mask that identifies metric streamer instance. */1481u64 metric_group_mask;1482/**1483* Size in bytes of single sample - total size of all enabled counters.1484* Some VPU implementations may align sample_size to more than 8 bytes.1485*/1486u32 sample_size;1487u32 reserved_0;1488/**1489* Number of samples collected since the metric streamer was started.1490* This will be 0 if the metric streamer was not started.1491*/1492u32 samples_collected;1493/**1494* Number of samples dropped since the metric streamer was started. This1495* is incremented every time the metric streamer is not able to write1496* collected samples because the current buffer is full and there is no1497* next buffer to switch to.1498*/1499u32 samples_dropped;1500/** Address of the buffer that contains the latest metric data. */1501u64 buffer_addr;1502/**1503* Number of bytes written into the metric data buffer. In response to the1504* VPU_JSM_MSG_METRIC_STREAMER_INFO request this field contains the size of1505* all group and counter descriptors. The size is updated even if the buffer1506* in the request was NULL or too small to hold descriptors of all counters1507*/1508u64 bytes_written;1509};15101511/**1512* Metric group description placed in the metric buffer after successful completion1513* of the VPU_JSM_MSG_METRIC_STREAMER_INFO command. This is followed by one or more1514* @ref vpu_jsm_metric_counter_descriptor records.1515* @see VPU_JSM_MSG_METRIC_STREAMER_INFO1516*/1517struct vpu_jsm_metric_group_descriptor {1518/**1519* Offset to the next metric group (8-byte aligned). If this offset is 0 this1520* is the last descriptor. The value of metric_info_size must be greater than1521* or equal to sizeof(struct vpu_jsm_metric_group_descriptor) + name_string_size1522* + description_string_size and must be 8-byte aligned.1523*/1524u32 next_metric_group_info_offset;1525/**1526* Offset to the first metric counter description record (8-byte aligned).1527* @see vpu_jsm_metric_counter_descriptor1528*/1529u32 next_metric_counter_info_offset;1530/** Index of the group. This corresponds to bit index in metric_group_mask. */1531u32 group_id;1532/** Number of counters in the metric group. */1533u32 num_counters;1534/** Data size for all counters, must be a multiple of 8 bytes.*/1535u32 metric_group_data_size;1536/**1537* Metric group domain number. Cannot use multiple, simultaneous metric groups1538* from the same domain.1539*/1540u32 domain;1541/**1542* Counter name string size. The string must include a null termination character.1543* The FW may use a fixed size name or send a different name for each counter.1544* If the VPU uses fixed size strings, all characters from the end of the name1545* to the of the fixed size character array must be zeroed.1546*/1547u32 name_string_size;1548/** Counter description string size, @see name_string_size */1549u32 description_string_size;1550u64 reserved_0;1551/**1552* Right after this structure, the VPU writes name and description of1553* the metric group.1554*/1555};15561557/**1558* Metric counter description, placed in the buffer after vpu_jsm_metric_group_descriptor.1559* @see VPU_JSM_MSG_METRIC_STREAMER_INFO1560*/1561struct vpu_jsm_metric_counter_descriptor {1562/**1563* Offset to the next counter in a group (8-byte aligned). If this offset is1564* 0 this is the last counter in the group.1565*/1566u32 next_metric_counter_info_offset;1567/**1568* Offset to the counter data from the start of samples in this metric group.1569* Note that metric_data_offset % metric_data_size must be 0.1570*/1571u32 metric_data_offset;1572/** Size of the metric counter data in bytes. */1573u32 metric_data_size;1574/** Metric type, see Level Zero API for definitions. */1575u32 tier;1576/** Metric type, see set_metric_type_t for definitions. */1577u32 metric_type;1578/** Metric type, see set_value_type_t for definitions. */1579u32 metric_value_type;1580/**1581* Counter name string size. The string must include a null termination character.1582* The FW may use a fixed size name or send a different name for each counter.1583* If the VPU uses fixed size strings, all characters from the end of the name1584* to the of the fixed size character array must be zeroed.1585*/1586u32 name_string_size;1587/** Counter description string size, @see name_string_size */1588u32 description_string_size;1589/** Counter component name string size, @see name_string_size */1590u32 component_string_size;1591/** Counter string size, @see name_string_size */1592u32 units_string_size;1593u64 reserved_0;1594/**1595* Right after this structure, the VPU writes name, description1596* component and unit strings.1597*/1598};15991600/**1601* Payload for @ref VPU_JSM_MSG_DYNDBG_CONTROL requests.1602*1603* VPU_JSM_MSG_DYNDBG_CONTROL requests are used to control the VPU FW dynamic debug1604* feature, which allows developers to selectively enable/disable code to obtain1605* additional FW information. This is equivalent to the dynamic debug functionality1606* provided by Linux. The host can control dynamic debug behavior by sending dyndbg1607* commands, using the same syntax as for Linux dynamic debug commands.1608*1609* @see https://www.kernel.org/doc/html/latest/admin-guide/dynamic-debug-howto.html.1610*1611* NOTE:1612* As the dynamic debug feature uses MVLOG messages to provide information, the host1613* must first set the logging level to MVLOG_DEBUG, using the @ref VPU_JSM_MSG_TRACE_SET_CONFIG1614* command.1615*/1616struct vpu_ipc_msg_payload_dyndbg_control {1617/**1618* Dyndbg command to be executed.1619*/1620char dyndbg_cmd[VPU_DYNDBG_CMD_MAX_LEN];1621};16221623/**1624* Payload for VPU_JSM_MSG_PWR_D0I3_ENTER1625*1626* This is a bi-directional payload.1627*/1628struct vpu_ipc_msg_payload_pwr_d0i3_enter {1629/**1630* 0: VPU_JSM_MSG_PWR_D0I3_ENTER_DONE is not sent to the host driver1631* The driver will poll for D0i2 Idle state transitions.1632* 1: VPU_JSM_MSG_PWR_D0I3_ENTER_DONE is sent after VPU state save is complete1633*/1634u32 send_response;1635u32 reserved_0;1636};16371638/**1639* Payload for @ref VPU_JSM_MSG_DCT_ENABLE message.1640*1641* Default values for DCT active/inactive times are 5.3ms and 30ms respectively,1642* corresponding to a 85% duty cycle. This payload allows the host to tune these1643* values according to application requirements.1644*/1645struct vpu_ipc_msg_payload_pwr_dct_control {1646/** Duty cycle active time in microseconds */1647u32 dct_active_us;1648/** Duty cycle inactive time in microseconds */1649u32 dct_inactive_us;1650};16511652/*1653* Payloads union, used to define complete message format.1654*/1655union vpu_ipc_msg_payload {1656struct vpu_ipc_msg_payload_engine_reset engine_reset;1657struct vpu_ipc_msg_payload_engine_preempt engine_preempt;1658struct vpu_ipc_msg_payload_register_db register_db;1659struct vpu_ipc_msg_payload_unregister_db unregister_db;1660struct vpu_ipc_msg_payload_query_engine_hb query_engine_hb;1661struct vpu_ipc_msg_payload_power_level power_level;1662struct vpu_jsm_metric_streamer_start metric_streamer_start;1663struct vpu_jsm_metric_streamer_stop metric_streamer_stop;1664struct vpu_jsm_metric_streamer_update metric_streamer_update;1665struct vpu_ipc_msg_payload_ssid_release ssid_release;1666struct vpu_jsm_hws_register_db hws_register_db;1667struct vpu_ipc_msg_payload_job_done job_done;1668struct vpu_ipc_msg_payload_native_fence_signalled native_fence_signalled;1669struct vpu_ipc_msg_payload_engine_reset_done engine_reset_done;1670struct vpu_ipc_msg_payload_engine_preempt_done engine_preempt_done;1671struct vpu_ipc_msg_payload_register_db_done register_db_done;1672struct vpu_ipc_msg_payload_unregister_db_done unregister_db_done;1673struct vpu_ipc_msg_payload_query_engine_hb_done query_engine_hb_done;1674struct vpu_ipc_msg_payload_get_power_level_count_done get_power_level_count_done;1675struct vpu_jsm_metric_streamer_done metric_streamer_done;1676struct vpu_ipc_msg_payload_trace_config trace_config;1677struct vpu_ipc_msg_payload_trace_capability_rsp trace_capability;1678struct vpu_ipc_msg_payload_trace_get_name trace_get_name;1679struct vpu_ipc_msg_payload_trace_get_name_rsp trace_get_name_rsp;1680struct vpu_ipc_msg_payload_dyndbg_control dyndbg_control;1681struct vpu_ipc_msg_payload_hws_priority_band_setup hws_priority_band_setup;1682struct vpu_ipc_msg_payload_hws_create_cmdq hws_create_cmdq;1683struct vpu_ipc_msg_payload_hws_create_cmdq_rsp hws_create_cmdq_rsp;1684struct vpu_ipc_msg_payload_hws_destroy_cmdq hws_destroy_cmdq;1685struct vpu_ipc_msg_payload_hws_set_context_sched_properties1686hws_set_context_sched_properties;1687struct vpu_ipc_msg_payload_hws_set_scheduling_log hws_set_scheduling_log;1688struct vpu_ipc_msg_payload_hws_scheduling_log_notification hws_scheduling_log_notification;1689struct vpu_ipc_msg_payload_hws_suspend_cmdq hws_suspend_cmdq;1690struct vpu_ipc_msg_payload_hws_resume_cmdq hws_resume_cmdq;1691struct vpu_ipc_msg_payload_hws_resume_engine hws_resume_engine;1692struct vpu_ipc_msg_payload_pwr_d0i3_enter pwr_d0i3_enter;1693struct vpu_ipc_msg_payload_pwr_dct_control pwr_dct_control;1694};16951696/**1697* Host <-> NPU IPC message base structure.1698*1699* NOTE: All instances of this object must be aligned on a 64B boundary1700* to allow proper handling of VPU cache operations.1701*/1702struct vpu_jsm_msg {1703/** Reserved */1704u64 reserved_0;1705/** Message type, see @ref vpu_ipc_msg_type. */1706u32 type;1707/** Buffer status, see @ref vpu_ipc_msg_status. */1708u32 status;1709/**1710* Request ID, provided by the host in a request message and passed1711* back by VPU in the response message.1712*/1713u32 request_id;1714/** Request return code set by the VPU, see VPU_JSM_STATUS_* defines. */1715u32 result;1716u64 reserved_1;1717/** Message payload depending on message type, see vpu_ipc_msg_payload union. */1718union vpu_ipc_msg_payload payload;1719};17201721#pragma pack(pop)17221723#endif17241725///@}172617271728