vpu_jsm_api.h 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726
  1. /* SPDX-License-Identifier: MIT */
  2. /*
  3. * Copyright (c) 2020-2025, Intel Corporation.
  4. */
  5. /**
  6. * @addtogroup Jsm
  7. * @{
  8. */
  9. /**
  10. * @file
  11. * @brief JSM shared definitions
  12. */
  13. #ifndef VPU_JSM_API_H
  14. #define VPU_JSM_API_H
  15. /*
  16. * Major version changes that break backward compatibility
  17. */
  18. #define VPU_JSM_API_VER_MAJOR 3
  19. /*
  20. * Minor version changes when API backward compatibility is preserved.
  21. */
  22. #define VPU_JSM_API_VER_MINOR 33
  23. /*
  24. * API header changed (field names, documentation, formatting) but API itself has not been changed
  25. */
  26. #define VPU_JSM_API_VER_PATCH 0
  27. /*
  28. * Index in the API version table
  29. */
  30. #define VPU_JSM_API_VER_INDEX 4
  31. /*
  32. * Number of Priority Bands for Hardware Scheduling
  33. * Bands: Idle(0), Normal(1), Focus(2), RealTime(3)
  34. */
  35. #define VPU_HWS_NUM_PRIORITY_BANDS 4
  36. /* Max number of impacted contexts that can be dealt with the engine reset command */
  37. #define VPU_MAX_ENGINE_RESET_IMPACTED_CONTEXTS 3
  38. /*
  39. * Pack the API structures to enforce binary compatibility
  40. * Align to 8 bytes for optimal performance
  41. */
  42. #pragma pack(push, 8)
  43. /*
  44. * Engine indexes.
  45. */
  46. #define VPU_ENGINE_COMPUTE 0
  47. #define VPU_ENGINE_NB 1
  48. /*
  49. * VPU status values.
  50. */
  51. #define VPU_JSM_STATUS_SUCCESS 0x0U
  52. #define VPU_JSM_STATUS_PARSING_ERR 0x1U
  53. #define VPU_JSM_STATUS_PROCESSING_ERR 0x2U
  54. #define VPU_JSM_STATUS_PREEMPTED 0x3U
  55. #define VPU_JSM_STATUS_ABORTED 0x4U
  56. #define VPU_JSM_STATUS_USER_CTX_VIOL_ERR 0x5U
  57. #define VPU_JSM_STATUS_GLOBAL_CTX_VIOL_ERR 0x6U
  58. #define VPU_JSM_STATUS_MVNCI_WRONG_INPUT_FORMAT 0x7U
  59. #define VPU_JSM_STATUS_MVNCI_UNSUPPORTED_NETWORK_ELEMENT 0x8U
  60. #define VPU_JSM_STATUS_MVNCI_INVALID_HANDLE 0x9U
  61. #define VPU_JSM_STATUS_MVNCI_OUT_OF_RESOURCES 0xAU
  62. #define VPU_JSM_STATUS_MVNCI_NOT_IMPLEMENTED 0xBU
  63. #define VPU_JSM_STATUS_MVNCI_INTERNAL_ERROR 0xCU
  64. /* @deprecated (use VPU_JSM_STATUS_PREEMPTED_MID_COMMAND instead) */
  65. #define VPU_JSM_STATUS_PREEMPTED_MID_INFERENCE 0xDU
  66. /* Job status returned when the job was preempted mid-command */
  67. #define VPU_JSM_STATUS_PREEMPTED_MID_COMMAND 0xDU
  68. /* Range of status codes that require engine reset */
  69. #define VPU_JSM_STATUS_ENGINE_RESET_REQUIRED_MIN 0xEU
  70. #define VPU_JSM_STATUS_MVNCI_CONTEXT_VIOLATION_HW 0xEU
  71. #define VPU_JSM_STATUS_MVNCI_PREEMPTION_TIMED_OUT 0xFU
  72. #define VPU_JSM_STATUS_ENGINE_RESET_REQUIRED_MAX 0x1FU
  73. /*
  74. * Host <-> VPU IPC channels.
  75. * ASYNC commands use a high priority channel, other messages use low-priority ones.
  76. */
  77. #define VPU_IPC_CHAN_ASYNC_CMD 0
  78. #define VPU_IPC_CHAN_GEN_CMD 10
  79. #define VPU_IPC_CHAN_JOB_RET 11
  80. /*
  81. * Job flags bit masks.
  82. */
  83. enum {
  84. /*
  85. * Null submission mask.
  86. * When set, batch buffer's commands are not processed but returned as
  87. * successful immediately, except fences and timestamps.
  88. * When cleared, batch buffer's commands are processed normally.
  89. * Used for testing and profiling purposes.
  90. */
  91. VPU_JOB_FLAGS_NULL_SUBMISSION_MASK = (1 << 0U),
  92. /*
  93. * Inline command mask.
  94. * When set, the object in job queue is an inline command (see struct vpu_inline_cmd below).
  95. * When cleared, the object in job queue is a job (see struct vpu_job_queue_entry below).
  96. */
  97. VPU_JOB_FLAGS_INLINE_CMD_MASK = (1 << 1U),
  98. /*
  99. * VPU private data mask.
  100. * Reserved for the VPU to store private data about the job (or inline command)
  101. * while being processed.
  102. */
  103. VPU_JOB_FLAGS_PRIVATE_DATA_MASK = 0xFFFF0000U
  104. };
  105. /*
  106. * Job queue flags bit masks.
  107. */
  108. enum {
  109. /*
  110. * No job done notification mask.
  111. * When set, indicates that no job done notification should be sent for any
  112. * job from this queue. When cleared, indicates that job done notification
  113. * should be sent for every job completed from this queue.
  114. */
  115. VPU_JOB_QUEUE_FLAGS_NO_JOB_DONE_MASK = (1 << 0U),
  116. /*
  117. * Native fence usage mask.
  118. * When set, indicates that job queue uses native fences (as inline commands
  119. * in job queue). Such queues may also use legacy fences (as commands in batch buffers).
  120. * When cleared, indicates the job queue only uses legacy fences.
  121. * NOTES:
  122. * 1. For queues using native fences, VPU expects that all jobs in the queue
  123. * are immediately followed by an inline command object. This object is expected
  124. * to be a fence signal command in most cases, but can also be a NOP in case the host
  125. * does not need per-job fence signalling. Other inline commands objects can be
  126. * inserted between "job and inline command" pairs.
  127. * 2. Native fence queues are only supported on VPU 40xx onwards.
  128. */
  129. VPU_JOB_QUEUE_FLAGS_USE_NATIVE_FENCE_MASK = (1 << 1U),
  130. /*
  131. * Enable turbo mode for testing NPU performance; not recommended for regular usage.
  132. */
  133. VPU_JOB_QUEUE_FLAGS_TURBO_MODE = (1 << 2U),
  134. /*
  135. * Queue error detection mode flag
  136. * For 'interactive' queues (this bit not set), the FW will identify queues that have not
  137. * completed a job inside the TDR timeout as in error as part of engine reset sequence.
  138. * For 'non-interactive' queues (this bit set), the FW will identify queues that have not
  139. * progressed the heartbeat inside the non-interactive no-progress timeout as in error as
  140. * part of engine reset sequence. Additionally, there is an upper limit applied to these
  141. * queues: even if they progress the heartbeat, if they run longer than non-interactive
  142. * timeout, then the FW will also identify them as in error.
  143. */
  144. VPU_JOB_QUEUE_FLAGS_NON_INTERACTIVE = (1 << 3U)
  145. };
  146. /*
  147. * Max length (including trailing NULL char) of trace entity name (e.g., the
  148. * name of a logging destination or a loggable HW component).
  149. */
  150. #define VPU_TRACE_ENTITY_NAME_MAX_LEN 32
  151. /*
  152. * Max length (including trailing NULL char) of a dyndbg command.
  153. *
  154. * NOTE: 96 is used so that the size of 'struct vpu_ipc_msg' in the JSM API is
  155. * 128 bytes (multiple of 64 bytes, the cache line size).
  156. */
  157. #define VPU_DYNDBG_CMD_MAX_LEN 96
  158. /*
  159. * For HWS command queue scheduling, we can prioritise command queues inside the
  160. * same process with a relative in-process priority. Valid values for relative
  161. * priority are given below - max and min.
  162. */
  163. #define VPU_HWS_COMMAND_QUEUE_MAX_IN_PROCESS_PRIORITY 7
  164. #define VPU_HWS_COMMAND_QUEUE_MIN_IN_PROCESS_PRIORITY -7
  165. /*
  166. * For HWS priority scheduling, we can have multiple realtime priority bands.
  167. * They are numbered 0 to a MAX.
  168. */
  169. #define VPU_HWS_MAX_REALTIME_PRIORITY_LEVEL 31U
  170. /*
  171. * vpu_jsm_engine_reset_context flag definitions
  172. */
  173. #define VPU_ENGINE_RESET_CONTEXT_FLAG_COLLATERAL_DAMAGE_MASK BIT(0)
  174. #define VPU_ENGINE_RESET_CONTEXT_HANG_PRIMARY_CAUSE 0
  175. #define VPU_ENGINE_RESET_CONTEXT_COLLATERAL_DAMAGE 1
  176. /*
  177. * Invalid command queue handle identifier. Applies to cmdq_id and cmdq_group
  178. * in this API.
  179. */
  180. #define VPU_HWS_INVALID_CMDQ_HANDLE 0ULL
  181. /*
  182. * Inline commands types.
  183. */
  184. /*
  185. * NOP.
  186. * VPU does nothing other than consuming the inline command object.
  187. */
  188. #define VPU_INLINE_CMD_TYPE_NOP 0x0
  189. /*
  190. * Fence wait.
  191. * VPU waits for the fence current value to reach monitored value.
  192. * Fence wait operations are executed upon job dispatching. While waiting for
  193. * the fence to be satisfied, VPU blocks fetching of the next objects in the queue.
  194. * Jobs present in the queue prior to the fence wait object may be processed
  195. * concurrently.
  196. */
  197. #define VPU_INLINE_CMD_TYPE_FENCE_WAIT 0x1
  198. /*
  199. * Fence signal.
  200. * VPU sets the fence current value to the provided value. If new current value
  201. * is equal to or higher than monitored value, VPU sends fence signalled notification
  202. * to the host. Fence signal operations are executed upon completion of all the jobs
  203. * present in the queue prior to them, and in-order relative to each other in the queue.
  204. * But jobs in-between them may be processed concurrently and may complete out-of-order.
  205. */
  206. #define VPU_INLINE_CMD_TYPE_FENCE_SIGNAL 0x2
  207. /**
  208. * Job scheduling priority bands for both hardware scheduling and OS scheduling.
  209. */
  210. enum vpu_job_scheduling_priority_band {
  211. VPU_JOB_SCHEDULING_PRIORITY_BAND_IDLE = 0,
  212. VPU_JOB_SCHEDULING_PRIORITY_BAND_NORMAL = 1,
  213. VPU_JOB_SCHEDULING_PRIORITY_BAND_FOCUS = 2,
  214. VPU_JOB_SCHEDULING_PRIORITY_BAND_REALTIME = 3,
  215. VPU_JOB_SCHEDULING_PRIORITY_BAND_COUNT = 4,
  216. };
  217. /**
  218. * Job format.
  219. * Jobs defines the actual workloads to be executed by a given engine.
  220. */
  221. struct vpu_job_queue_entry {
  222. /** Address of VPU commands batch buffer */
  223. u64 batch_buf_addr;
  224. /** Job ID */
  225. u32 job_id;
  226. /** Flags bit field, see VPU_JOB_FLAGS_* above */
  227. u32 flags;
  228. /**
  229. * Doorbell ring timestamp taken by KMD from SoC's global system clock, in
  230. * microseconds. NPU can convert this value to its own fixed clock's timebase,
  231. * to match other profiling timestamps.
  232. */
  233. u64 doorbell_timestamp;
  234. /** Extra id for job tracking, used only in the firmware perf traces */
  235. u64 host_tracking_id;
  236. /** Address of the primary preemption buffer to use for this job */
  237. u64 primary_preempt_buf_addr;
  238. /** Size of the primary preemption buffer to use for this job */
  239. u32 primary_preempt_buf_size;
  240. /** Size of secondary preemption buffer to use for this job */
  241. u32 secondary_preempt_buf_size;
  242. /** Address of secondary preemption buffer to use for this job */
  243. u64 secondary_preempt_buf_addr;
  244. u64 reserved_0;
  245. };
  246. /**
  247. * Inline command format.
  248. * Inline commands are the commands executed at scheduler level (typically,
  249. * synchronization directives). Inline command and job objects must be of
  250. * the same size and have flags field at same offset.
  251. */
  252. struct vpu_inline_cmd {
  253. u64 reserved_0;
  254. /** Inline command type, see VPU_INLINE_CMD_TYPE_* defines. */
  255. u32 type;
  256. /** Flags bit field, see VPU_JOB_FLAGS_* above. */
  257. u32 flags;
  258. /** Inline command payload. Depends on inline command type. */
  259. union payload {
  260. /** Fence (wait and signal) commands' payload. */
  261. struct fence {
  262. /** Fence object handle. */
  263. u64 fence_handle;
  264. /** User VA of the current fence value. */
  265. u64 current_value_va;
  266. /** User VA of the monitored fence value (read-only). */
  267. u64 monitored_value_va;
  268. /** Value to wait for or write in fence location. */
  269. u64 value;
  270. /** User VA of the log buffer in which to add log entry on completion. */
  271. u64 log_buffer_va;
  272. /** NPU private data. */
  273. u64 npu_private_data;
  274. } fence;
  275. /**
  276. * Other commands do not have a payload:
  277. * Payload definition for future inline commands can be inserted here.
  278. */
  279. u64 reserved_1[6];
  280. } payload;
  281. };
  282. /**
  283. * Job queue slots can be populated either with job objects or inline command objects.
  284. */
  285. union vpu_jobq_slot {
  286. struct vpu_job_queue_entry job;
  287. struct vpu_inline_cmd inline_cmd;
  288. };
  289. /**
  290. * Job queue control registers.
  291. */
  292. struct vpu_job_queue_header {
  293. u32 engine_idx;
  294. u32 head;
  295. u32 tail;
  296. u32 flags;
  297. /** Set to 1 to indicate priority_band field is valid */
  298. u32 priority_band_valid;
  299. /**
  300. * Priority for the work of this job queue, valid only if the HWS is NOT used
  301. * and the @ref priority_band_valid is set to 1. It is applied only during
  302. * the @ref VPU_JSM_MSG_REGISTER_DB message processing.
  303. * The device firmware might use the priority_band to optimize the power
  304. * management logic, but it will not affect the order of jobs.
  305. * Available priority bands: @see enum vpu_job_scheduling_priority_band
  306. */
  307. u32 priority_band;
  308. /** Inside realtime band assigns a further priority, limited to 0..31 range */
  309. u32 realtime_priority_level;
  310. u32 reserved_0[9];
  311. };
  312. /*
  313. * Job queue format.
  314. */
  315. struct vpu_job_queue {
  316. struct vpu_job_queue_header header;
  317. union vpu_jobq_slot slot[];
  318. };
  319. /**
  320. * Logging entity types.
  321. *
  322. * This enum defines the different types of entities involved in logging.
  323. */
  324. enum vpu_trace_entity_type {
  325. /** Logging destination (entity where logs can be stored / printed). */
  326. VPU_TRACE_ENTITY_TYPE_DESTINATION = 1,
  327. /** Loggable HW component (HW entity that can be logged). */
  328. VPU_TRACE_ENTITY_TYPE_HW_COMPONENT = 2,
  329. };
  330. /**
  331. * HWS specific log buffer header details.
  332. * Total size is 32 bytes.
  333. */
  334. struct vpu_hws_log_buffer_header {
  335. /** Written by VPU after adding a log entry. Initialised by host to 0. */
  336. u32 first_free_entry_index;
  337. /** Incremented by VPU every time the VPU writes the 0th entry; initialised by host to 0. */
  338. u32 wraparound_count;
  339. /**
  340. * This is the number of buffers that can be stored in the log buffer provided by the host.
  341. * It is written by host before passing buffer to VPU. VPU should consider it read-only.
  342. */
  343. u64 num_of_entries;
  344. u64 reserved[2];
  345. };
  346. /**
  347. * HWS specific log buffer entry details.
  348. * Total size is 32 bytes.
  349. */
  350. struct vpu_hws_log_buffer_entry {
  351. /** VPU timestamp must be an invariant timer tick (not impacted by DVFS) */
  352. u64 vpu_timestamp;
  353. /**
  354. * Operation type:
  355. * 0 - context state change
  356. * 1 - queue new work
  357. * 2 - queue unwait sync object
  358. * 3 - queue no more work
  359. * 4 - queue wait sync object
  360. */
  361. u32 operation_type;
  362. u32 reserved;
  363. /** Operation data depends on operation type */
  364. u64 operation_data[2];
  365. };
  366. /* Native fence log buffer types. */
  367. enum vpu_hws_native_fence_log_type {
  368. VPU_HWS_NATIVE_FENCE_LOG_TYPE_WAITS = 1,
  369. VPU_HWS_NATIVE_FENCE_LOG_TYPE_SIGNALS = 2
  370. };
  371. /** HWS native fence log buffer header. */
  372. struct vpu_hws_native_fence_log_header {
  373. union {
  374. struct {
  375. /** Index of the first free entry in buffer. */
  376. u32 first_free_entry_idx;
  377. /**
  378. * Incremented whenever the NPU wraps around the buffer and writes
  379. * to the first entry again.
  380. */
  381. u32 wraparound_count;
  382. };
  383. /** Field allowing atomic update of both fields above. */
  384. u64 atomic_wraparound_and_entry_idx;
  385. };
  386. /** Log buffer type, see enum vpu_hws_native_fence_log_type. */
  387. u64 type;
  388. /** Allocated number of entries in the log buffer. */
  389. u64 entry_nb;
  390. u64 reserved[2];
  391. };
  392. /** Native fence log operation types. */
  393. enum vpu_hws_native_fence_log_op {
  394. VPU_HWS_NATIVE_FENCE_LOG_OP_SIGNAL_EXECUTED = 0,
  395. VPU_HWS_NATIVE_FENCE_LOG_OP_WAIT_UNBLOCKED = 1
  396. };
  397. /** HWS native fence log entry. */
  398. struct vpu_hws_native_fence_log_entry {
  399. /** Newly signaled/unblocked fence value. */
  400. u64 fence_value;
  401. /** Native fence object handle to which this operation belongs. */
  402. u64 fence_handle;
  403. /** Operation type, see enum vpu_hws_native_fence_log_op. */
  404. u64 op_type;
  405. u64 reserved_0;
  406. /**
  407. * VPU_HWS_NATIVE_FENCE_LOG_OP_WAIT_UNBLOCKED only: Timestamp at which fence
  408. * wait was started (in NPU SysTime).
  409. */
  410. u64 fence_wait_start_ts;
  411. u64 reserved_1;
  412. /** Timestamp at which fence operation was completed (in NPU SysTime). */
  413. u64 fence_end_ts;
  414. };
  415. /** Native fence log buffer. */
  416. struct vpu_hws_native_fence_log_buffer {
  417. struct vpu_hws_native_fence_log_header header;
  418. struct vpu_hws_native_fence_log_entry entry[];
  419. };
  420. /*
  421. * Host <-> VPU IPC messages types.
  422. */
  423. enum vpu_ipc_msg_type {
  424. /** Unsupported command */
  425. VPU_JSM_MSG_UNKNOWN = 0xFFFFFFFF,
  426. /** IPC Host -> Device, base id for async commands */
  427. VPU_JSM_MSG_ASYNC_CMD = 0x1100,
  428. /**
  429. * Reset engine. The NPU cancels all the jobs currently executing on the target
  430. * engine making the engine become idle and then does a HW reset, before returning
  431. * to the host.
  432. * @see struct vpu_ipc_msg_payload_engine_reset
  433. */
  434. VPU_JSM_MSG_ENGINE_RESET = VPU_JSM_MSG_ASYNC_CMD,
  435. /**
  436. * Preempt engine. The NPU stops (preempts) all the jobs currently
  437. * executing on the target engine making the engine become idle and ready to
  438. * execute new jobs.
  439. * NOTE: The NPU does not remove unstarted jobs (if any) from job queues of
  440. * the target engine, but it stops processing them (until the queue doorbell
  441. * is rung again); the host is responsible to reset the job queue, either
  442. * after preemption or when resubmitting jobs to the queue.
  443. * @see vpu_ipc_msg_payload_engine_preempt
  444. */
  445. VPU_JSM_MSG_ENGINE_PREEMPT = 0x1101,
  446. /**
  447. * OS scheduling doorbell register command
  448. * @see vpu_ipc_msg_payload_register_db
  449. */
  450. VPU_JSM_MSG_REGISTER_DB = 0x1102,
  451. /**
  452. * OS scheduling doorbell unregister command
  453. * @see vpu_ipc_msg_payload_unregister_db
  454. */
  455. VPU_JSM_MSG_UNREGISTER_DB = 0x1103,
  456. /**
  457. * Query engine heartbeat. Heartbeat is expected to increase monotonically
  458. * and increase while work is being progressed by NPU.
  459. * @see vpu_ipc_msg_payload_query_engine_hb
  460. */
  461. VPU_JSM_MSG_QUERY_ENGINE_HB = 0x1104,
  462. VPU_JSM_MSG_GET_POWER_LEVEL_COUNT = 0x1105,
  463. VPU_JSM_MSG_GET_POWER_LEVEL = 0x1106,
  464. VPU_JSM_MSG_SET_POWER_LEVEL = 0x1107,
  465. /* @deprecated */
  466. VPU_JSM_MSG_METRIC_STREAMER_OPEN = 0x1108,
  467. /* @deprecated */
  468. VPU_JSM_MSG_METRIC_STREAMER_CLOSE = 0x1109,
  469. /** Configure logging (used to modify configuration passed in boot params). */
  470. VPU_JSM_MSG_TRACE_SET_CONFIG = 0x110a,
  471. /** Return current logging configuration. */
  472. VPU_JSM_MSG_TRACE_GET_CONFIG = 0x110b,
  473. /**
  474. * Get masks of destinations and HW components supported by the firmware
  475. * (may vary between HW generations and FW compile
  476. * time configurations)
  477. */
  478. VPU_JSM_MSG_TRACE_GET_CAPABILITY = 0x110c,
  479. /** Get the name of a destination or HW component. */
  480. VPU_JSM_MSG_TRACE_GET_NAME = 0x110d,
  481. /**
  482. * Release resource associated with host ssid . All jobs that belong to the host_ssid
  483. * aborted and removed from internal scheduling queues. All doorbells assigned
  484. * to the host_ssid are unregistered and any internal FW resources belonging to
  485. * the host_ssid are released.
  486. * @see vpu_ipc_msg_payload_ssid_release
  487. */
  488. VPU_JSM_MSG_SSID_RELEASE = 0x110e,
  489. /**
  490. * Start collecting metric data.
  491. * @see vpu_jsm_metric_streamer_start
  492. */
  493. VPU_JSM_MSG_METRIC_STREAMER_START = 0x110f,
  494. /**
  495. * Stop collecting metric data. This command will return success if it is called
  496. * for a metric stream that has already been stopped or was never started.
  497. * @see vpu_jsm_metric_streamer_stop
  498. */
  499. VPU_JSM_MSG_METRIC_STREAMER_STOP = 0x1110,
  500. /**
  501. * Update current and next buffer for metric data collection. This command can
  502. * also be used to request information about the number of collected samples
  503. * and the amount of data written to the buffer.
  504. * @see vpu_jsm_metric_streamer_update
  505. */
  506. VPU_JSM_MSG_METRIC_STREAMER_UPDATE = 0x1111,
  507. /**
  508. * Request description of selected metric groups and metric counters within
  509. * each group. The VPU will write the description of groups and counters to
  510. * the buffer specified in the command structure.
  511. * @see vpu_jsm_metric_streamer_start
  512. */
  513. VPU_JSM_MSG_METRIC_STREAMER_INFO = 0x1112,
  514. /**
  515. * Control command: Priority band setup
  516. * @see vpu_ipc_msg_payload_hws_priority_band_setup
  517. */
  518. VPU_JSM_MSG_SET_PRIORITY_BAND_SETUP = 0x1113,
  519. /**
  520. * Control command: Create command queue
  521. * @see vpu_ipc_msg_payload_hws_create_cmdq
  522. */
  523. VPU_JSM_MSG_CREATE_CMD_QUEUE = 0x1114,
  524. /**
  525. * Control command: Destroy command queue
  526. * @see vpu_ipc_msg_payload_hws_destroy_cmdq
  527. */
  528. VPU_JSM_MSG_DESTROY_CMD_QUEUE = 0x1115,
  529. /**
  530. * Control command: Set context scheduling properties
  531. * @see vpu_ipc_msg_payload_hws_set_context_sched_properties
  532. */
  533. VPU_JSM_MSG_SET_CONTEXT_SCHED_PROPERTIES = 0x1116,
  534. /**
  535. * Register a doorbell to notify VPU of new work. The doorbell may later be
  536. * deallocated or reassigned to another context.
  537. * @see vpu_jsm_hws_register_db
  538. */
  539. VPU_JSM_MSG_HWS_REGISTER_DB = 0x1117,
  540. /**
  541. * Control command: Log buffer setting
  542. * @see vpu_ipc_msg_payload_hws_set_scheduling_log
  543. */
  544. VPU_JSM_MSG_HWS_SET_SCHEDULING_LOG = 0x1118,
  545. /**
  546. * Control command: Suspend command queue.
  547. * @see vpu_ipc_msg_payload_hws_suspend_cmdq
  548. */
  549. VPU_JSM_MSG_HWS_SUSPEND_CMDQ = 0x1119,
  550. /**
  551. * Control command: Resume command queue
  552. * @see vpu_ipc_msg_payload_hws_resume_cmdq
  553. */
  554. VPU_JSM_MSG_HWS_RESUME_CMDQ = 0x111a,
  555. /**
  556. * Control command: Resume engine after reset
  557. * @see vpu_ipc_msg_payload_hws_resume_engine
  558. */
  559. VPU_JSM_MSG_HWS_ENGINE_RESUME = 0x111b,
  560. /**
  561. * Control command: Enable survivability/DCT mode
  562. * @see vpu_ipc_msg_payload_pwr_dct_control
  563. */
  564. VPU_JSM_MSG_DCT_ENABLE = 0x111c,
  565. /**
  566. * Control command: Disable survivability/DCT mode
  567. * This command has no payload
  568. */
  569. VPU_JSM_MSG_DCT_DISABLE = 0x111d,
  570. /**
  571. * Dump VPU state. To be used for debug purposes only.
  572. * This command has no payload.
  573. * NOTE: Please introduce new ASYNC commands before this one.
  574. */
  575. VPU_JSM_MSG_STATE_DUMP = 0x11FF,
  576. /** IPC Host -> Device, base id for general commands */
  577. VPU_JSM_MSG_GENERAL_CMD = 0x1200,
  578. /** Unsupported command */
  579. VPU_JSM_MSG_BLOB_DEINIT_DEPRECATED = VPU_JSM_MSG_GENERAL_CMD,
  580. /**
  581. * Control dyndbg behavior by executing a dyndbg command; equivalent to
  582. * Linux command:
  583. * @verbatim echo '<dyndbg_cmd>' > <debugfs>/dynamic_debug/control @endverbatim
  584. * @see vpu_ipc_msg_payload_dyndbg_control
  585. */
  586. VPU_JSM_MSG_DYNDBG_CONTROL = 0x1201,
  587. /**
  588. * Perform the save procedure for the D0i3 entry
  589. */
  590. VPU_JSM_MSG_PWR_D0I3_ENTER = 0x1202,
  591. /**
  592. * IPC Device -> Host, Job completion
  593. * @see struct vpu_ipc_msg_payload_job_done
  594. */
  595. VPU_JSM_MSG_JOB_DONE = 0x2100,
  596. /**
  597. * IPC Device -> Host, Fence signalled
  598. * @see vpu_ipc_msg_payload_native_fence_signalled
  599. */
  600. VPU_JSM_MSG_NATIVE_FENCE_SIGNALLED = 0x2101,
  601. /* IPC Device -> Host, Async command completion */
  602. VPU_JSM_MSG_ASYNC_CMD_DONE = 0x2200,
  603. /**
  604. * IPC Device -> Host, engine reset complete
  605. * @see vpu_ipc_msg_payload_engine_reset_done
  606. */
  607. VPU_JSM_MSG_ENGINE_RESET_DONE = VPU_JSM_MSG_ASYNC_CMD_DONE,
  608. /**
  609. * Preempt complete message
  610. * @see vpu_ipc_msg_payload_engine_preempt_done
  611. */
  612. VPU_JSM_MSG_ENGINE_PREEMPT_DONE = 0x2201,
  613. VPU_JSM_MSG_REGISTER_DB_DONE = 0x2202,
  614. VPU_JSM_MSG_UNREGISTER_DB_DONE = 0x2203,
  615. /**
  616. * Response to query engine heartbeat.
  617. * @see vpu_ipc_msg_payload_query_engine_hb_done
  618. */
  619. VPU_JSM_MSG_QUERY_ENGINE_HB_DONE = 0x2204,
  620. VPU_JSM_MSG_GET_POWER_LEVEL_COUNT_DONE = 0x2205,
  621. VPU_JSM_MSG_GET_POWER_LEVEL_DONE = 0x2206,
  622. VPU_JSM_MSG_SET_POWER_LEVEL_DONE = 0x2207,
  623. /* @deprecated */
  624. VPU_JSM_MSG_METRIC_STREAMER_OPEN_DONE = 0x2208,
  625. /* @deprecated */
  626. VPU_JSM_MSG_METRIC_STREAMER_CLOSE_DONE = 0x2209,
  627. /** Response to VPU_JSM_MSG_TRACE_SET_CONFIG. */
  628. VPU_JSM_MSG_TRACE_SET_CONFIG_RSP = 0x220a,
  629. /** Response to VPU_JSM_MSG_TRACE_GET_CONFIG. */
  630. VPU_JSM_MSG_TRACE_GET_CONFIG_RSP = 0x220b,
  631. /** Response to VPU_JSM_MSG_TRACE_GET_CAPABILITY. */
  632. VPU_JSM_MSG_TRACE_GET_CAPABILITY_RSP = 0x220c,
  633. /** Response to VPU_JSM_MSG_TRACE_GET_NAME. */
  634. VPU_JSM_MSG_TRACE_GET_NAME_RSP = 0x220d,
  635. /**
  636. * Response to VPU_JSM_MSG_SSID_RELEASE.
  637. * @see vpu_ipc_msg_payload_ssid_release
  638. */
  639. VPU_JSM_MSG_SSID_RELEASE_DONE = 0x220e,
  640. /**
  641. * Response to VPU_JSM_MSG_METRIC_STREAMER_START.
  642. * VPU will return an error result if metric collection cannot be started,
  643. * e.g. when the specified metric mask is invalid.
  644. * @see vpu_jsm_metric_streamer_done
  645. */
  646. VPU_JSM_MSG_METRIC_STREAMER_START_DONE = 0x220f,
  647. /**
  648. * Response to VPU_JSM_MSG_METRIC_STREAMER_STOP.
  649. * Returns information about collected metric data.
  650. * @see vpu_jsm_metric_streamer_done
  651. */
  652. VPU_JSM_MSG_METRIC_STREAMER_STOP_DONE = 0x2210,
  653. /**
  654. * Response to VPU_JSM_MSG_METRIC_STREAMER_UPDATE.
  655. * Returns information about collected metric data.
  656. * @see vpu_jsm_metric_streamer_done
  657. */
  658. VPU_JSM_MSG_METRIC_STREAMER_UPDATE_DONE = 0x2211,
  659. /**
  660. * Response to VPU_JSM_MSG_METRIC_STREAMER_INFO.
  661. * Returns a description of the metric groups and metric counters.
  662. * @see vpu_jsm_metric_streamer_done
  663. */
  664. VPU_JSM_MSG_METRIC_STREAMER_INFO_DONE = 0x2212,
  665. /**
  666. * Asynchronous event sent from the VPU to the host either when the current
  667. * metric buffer is full or when the VPU has collected a multiple of
  668. * @ref vpu_jsm_metric_streamer_start::notify_sample_count samples as indicated
  669. * through the start command (VPU_JSM_MSG_METRIC_STREAMER_START). Returns
  670. * information about collected metric data.
  671. * @see vpu_jsm_metric_streamer_done
  672. */
  673. VPU_JSM_MSG_METRIC_STREAMER_NOTIFICATION = 0x2213,
  674. /**
  675. * Response to control command: Priority band setup
  676. * @see vpu_ipc_msg_payload_hws_priority_band_setup
  677. */
  678. VPU_JSM_MSG_SET_PRIORITY_BAND_SETUP_RSP = 0x2214,
  679. /**
  680. * Response to control command: Create command queue
  681. * @see vpu_ipc_msg_payload_hws_create_cmdq_rsp
  682. */
  683. VPU_JSM_MSG_CREATE_CMD_QUEUE_RSP = 0x2215,
  684. /**
  685. * Response to control command: Destroy command queue
  686. * @see vpu_ipc_msg_payload_hws_destroy_cmdq
  687. */
  688. VPU_JSM_MSG_DESTROY_CMD_QUEUE_RSP = 0x2216,
  689. /**
  690. * Response to control command: Set context scheduling properties
  691. * @see vpu_ipc_msg_payload_hws_set_context_sched_properties
  692. */
  693. VPU_JSM_MSG_SET_CONTEXT_SCHED_PROPERTIES_RSP = 0x2217,
  694. /**
  695. * Response to control command: Log buffer setting
  696. * @see vpu_ipc_msg_payload_hws_set_scheduling_log
  697. */
  698. VPU_JSM_MSG_HWS_SET_SCHEDULING_LOG_RSP = 0x2218,
  699. /**
  700. * IPC Device -> Host, HWS notify index entry of log buffer written
  701. * @see vpu_ipc_msg_payload_hws_scheduling_log_notification
  702. */
  703. VPU_JSM_MSG_HWS_SCHEDULING_LOG_NOTIFICATION = 0x2219,
  704. /**
  705. * IPC Device -> Host, HWS completion of a context suspend request
  706. * @see vpu_ipc_msg_payload_hws_suspend_cmdq
  707. */
  708. VPU_JSM_MSG_HWS_SUSPEND_CMDQ_DONE = 0x221a,
  709. /**
  710. * Response to control command: Resume command queue
  711. * @see vpu_ipc_msg_payload_hws_resume_cmdq
  712. */
  713. VPU_JSM_MSG_HWS_RESUME_CMDQ_RSP = 0x221b,
  714. /**
  715. * Response to control command: Resume engine command response
  716. * @see vpu_ipc_msg_payload_hws_resume_engine
  717. */
  718. VPU_JSM_MSG_HWS_RESUME_ENGINE_DONE = 0x221c,
  719. /**
  720. * Response to control command: Enable survivability/DCT mode
  721. * This command has no payload
  722. */
  723. VPU_JSM_MSG_DCT_ENABLE_DONE = 0x221d,
  724. /**
  725. * Response to control command: Disable survivability/DCT mode
  726. * This command has no payload
  727. */
  728. VPU_JSM_MSG_DCT_DISABLE_DONE = 0x221e,
  729. /**
  730. * Response to state dump control command.
  731. * This command has no payload.
  732. * NOTE: Please introduce new ASYNC responses before this one.
  733. */
  734. VPU_JSM_MSG_STATE_DUMP_RSP = 0x22FF,
  735. /* IPC Device -> Host, General command completion */
  736. VPU_JSM_MSG_GENERAL_CMD_DONE = 0x2300,
  737. VPU_JSM_MSG_BLOB_DEINIT_DONE = VPU_JSM_MSG_GENERAL_CMD_DONE,
  738. /** Response to VPU_JSM_MSG_DYNDBG_CONTROL. */
  739. VPU_JSM_MSG_DYNDBG_CONTROL_RSP = 0x2301,
  740. /**
  741. * Acknowledgment of completion of the save procedure initiated by
  742. * VPU_JSM_MSG_PWR_D0I3_ENTER
  743. */
  744. VPU_JSM_MSG_PWR_D0I3_ENTER_DONE = 0x2302,
  745. };
  746. enum vpu_ipc_msg_status { VPU_JSM_MSG_FREE, VPU_JSM_MSG_ALLOCATED };
  747. /**
  748. * Engine reset request payload
  749. * @see VPU_JSM_MSG_ENGINE_RESET
  750. */
  751. struct vpu_ipc_msg_payload_engine_reset {
  752. /** Engine to be reset. */
  753. u32 engine_idx;
  754. /** Reserved */
  755. u32 reserved_0;
  756. };
  757. /**
  758. * Engine preemption request struct
  759. * @see VPU_JSM_MSG_ENGINE_PREEMPT
  760. */
  761. struct vpu_ipc_msg_payload_engine_preempt {
  762. /** Engine to be preempted. */
  763. u32 engine_idx;
  764. /** ID of the preemption request. */
  765. u32 preempt_id;
  766. };
  767. /**
  768. * Register doorbell command structure.
  769. * This structure supports doorbell registration for only OS scheduling.
  770. * @see VPU_JSM_MSG_REGISTER_DB
  771. */
  772. struct vpu_ipc_msg_payload_register_db {
  773. /** Index of the doorbell to register. */
  774. u32 db_idx;
  775. /** Reserved */
  776. u32 reserved_0;
  777. /** Virtual address in Global GTT pointing to the start of job queue. */
  778. u64 jobq_base;
  779. /** Size of the job queue in bytes. */
  780. u32 jobq_size;
  781. /** Host sub-stream ID for the context assigned to the doorbell. */
  782. u32 host_ssid;
  783. };
  784. /**
  785. * Unregister doorbell command structure.
  786. * Request structure to unregister a doorbell for both HW and OS scheduling.
  787. * @see VPU_JSM_MSG_UNREGISTER_DB
  788. */
  789. struct vpu_ipc_msg_payload_unregister_db {
  790. /** Index of the doorbell to unregister. */
  791. u32 db_idx;
  792. /** Reserved */
  793. u32 reserved_0;
  794. };
  795. /**
  796. * Heartbeat request structure
  797. * @see VPU_JSM_MSG_QUERY_ENGINE_HB
  798. */
  799. struct vpu_ipc_msg_payload_query_engine_hb {
  800. /** Engine to return heartbeat value. */
  801. u32 engine_idx;
  802. /** Reserved */
  803. u32 reserved_0;
  804. };
  805. struct vpu_ipc_msg_payload_power_level {
  806. /**
  807. * Requested power level. The power level value is in the
  808. * range [0, power_level_count-1] where power_level_count
  809. * is the number of available power levels as returned by
  810. * the get power level count command. A power level of 0
  811. * corresponds to the maximum possible power level, while
  812. * power_level_count-1 corresponds to the minimum possible
  813. * power level. Values outside of this range are not
  814. * considered to be valid.
  815. */
  816. u32 power_level;
  817. /* Reserved */
  818. u32 reserved_0;
  819. };
  820. /**
  821. * Structure for requesting ssid release
  822. * @see VPU_JSM_MSG_SSID_RELEASE
  823. */
  824. struct vpu_ipc_msg_payload_ssid_release {
  825. /** Host sub-stream ID for the context to be released. */
  826. u32 host_ssid;
  827. /** Reserved */
  828. u32 reserved_0;
  829. };
  830. /**
  831. * @brief Metric streamer start command structure.
  832. * This structure is also used with VPU_JSM_MSG_METRIC_STREAMER_INFO to request metric
  833. * groups and metric counters description from the firmware.
  834. * @see VPU_JSM_MSG_METRIC_STREAMER_START
  835. * @see VPU_JSM_MSG_METRIC_STREAMER_INFO
  836. */
  837. struct vpu_jsm_metric_streamer_start {
  838. /**
  839. * Bitmask to select the desired metric groups.
  840. * A metric group can belong only to one metric streamer instance at a time.
  841. * Since each metric streamer instance has a unique set of metric groups, it
  842. * can also identify a metric streamer instance if more than one instance was
  843. * started. If the VPU device does not support multiple metric streamer instances,
  844. * then VPU_JSM_MSG_METRIC_STREAMER_START will return an error even if the second
  845. * instance has different groups to the first.
  846. */
  847. u64 metric_group_mask;
  848. /** Sampling rate in nanoseconds. */
  849. u64 sampling_rate;
  850. /**
  851. * If > 0 the VPU will send a VPU_JSM_MSG_METRIC_STREAMER_NOTIFICATION message
  852. * after every @ref notify_sample_count samples is collected or dropped by the VPU.
  853. * If set to UINT_MAX the VPU will only generate a notification when the metric
  854. * buffer is full. If set to 0 the VPU will never generate a notification.
  855. */
  856. u32 notify_sample_count;
  857. u32 reserved_0;
  858. /**
  859. * Address and size of the buffer where the VPU will write metric data. The
  860. * VPU writes all counters from enabled metric groups one after another. If
  861. * there is no space left to write data at the next sample period the VPU
  862. * will switch to the next buffer (@ref next_buffer_addr) and will optionally
  863. * send a notification to the host driver if @ref notify_sample_count is non-zero.
  864. * If @ref next_buffer_addr is NULL the VPU will stop collecting metric data.
  865. */
  866. u64 buffer_addr;
  867. u64 buffer_size;
  868. /**
  869. * Address and size of the next buffer to write metric data to after the initial
  870. * buffer is full. If the address is NULL the VPU will stop collecting metric
  871. * data.
  872. */
  873. u64 next_buffer_addr;
  874. u64 next_buffer_size;
  875. };
  876. /**
  877. * @brief Metric streamer stop command structure.
  878. * @see VPU_JSM_MSG_METRIC_STREAMER_STOP
  879. */
  880. struct vpu_jsm_metric_streamer_stop {
  881. /** Bitmask to select the desired metric groups. */
  882. u64 metric_group_mask;
  883. };
  884. /**
  885. * Provide VPU FW with buffers to write metric data.
  886. * @see VPU_JSM_MSG_METRIC_STREAMER_UPDATE
  887. */
  888. struct vpu_jsm_metric_streamer_update {
  889. /** Metric group mask that identifies metric streamer instance. */
  890. u64 metric_group_mask;
  891. /**
  892. * Address and size of the buffer where the VPU will write metric data.
  893. * This member dictates how the update operation should perform:
  894. * 1. client needs information about the number of collected samples and the
  895. * amount of data written to the current buffer
  896. * 2. client wants to switch to a new buffer
  897. *
  898. * Case 1. is identified by the buffer address being 0 or the same as the
  899. * currently used buffer address. In this case the buffer size is ignored and
  900. * the size of the current buffer is unchanged. The VPU will return an update
  901. * in the vpu_jsm_metric_streamer_done structure. The internal writing position
  902. * into the buffer is not changed.
  903. *
  904. * Case 2. is identified by the address being non-zero and differs from the
  905. * current buffer address. The VPU will immediately switch data collection to
  906. * the new buffer. Then the VPU will return an update in the
  907. * vpu_jsm_metric_streamer_done structure.
  908. */
  909. u64 buffer_addr;
  910. u64 buffer_size;
  911. /**
  912. * Address and size of the next buffer to write metric data after the initial
  913. * buffer is full. If the address is NULL the VPU will stop collecting metric
  914. * data but will continue to record dropped samples.
  915. *
  916. * Note that there is a hazard possible if both buffer_addr and the next_buffer_addr
  917. * are non-zero in same update request. It is the host's responsibility to ensure
  918. * that both addresses make sense even if the VPU just switched to writing samples
  919. * from the current to the next buffer.
  920. */
  921. u64 next_buffer_addr;
  922. u64 next_buffer_size;
  923. };
  924. /**
  925. * Device -> host job completion message.
  926. * @see VPU_JSM_MSG_JOB_DONE
  927. */
  928. struct vpu_ipc_msg_payload_job_done {
  929. /** Engine to which the job was submitted. */
  930. u32 engine_idx;
  931. /** Index of the doorbell to which the job was submitted */
  932. u32 db_idx;
  933. /** ID of the completed job */
  934. u32 job_id;
  935. /** Status of the completed job */
  936. u32 job_status;
  937. /** Host SSID */
  938. u32 host_ssid;
  939. /** Zero Padding */
  940. u32 reserved_0;
  941. /** Command queue id */
  942. u64 cmdq_id;
  943. };
  944. /**
  945. * Notification message upon native fence signalling.
  946. * @see VPU_JSM_MSG_NATIVE_FENCE_SIGNALLED
  947. */
  948. struct vpu_ipc_msg_payload_native_fence_signalled {
  949. /** Engine ID. */
  950. u32 engine_idx;
  951. /** Host SSID. */
  952. u32 host_ssid;
  953. /** CMDQ ID */
  954. u64 cmdq_id;
  955. /** Fence object handle. */
  956. u64 fence_handle;
  957. };
  958. /**
  959. * vpu_ipc_msg_payload_engine_reset_done will contain an array of this structure
  960. * which contains which queues caused reset if FW was able to detect any error.
  961. * @see vpu_ipc_msg_payload_engine_reset_done
  962. */
  963. struct vpu_jsm_engine_reset_context {
  964. /** Host SSID */
  965. u32 host_ssid;
  966. /** Zero Padding */
  967. u32 reserved_0;
  968. /** Command queue id */
  969. u64 cmdq_id;
  970. /** See VPU_ENGINE_RESET_CONTEXT_* defines */
  971. u64 flags;
  972. };
  973. /**
  974. * Engine reset response.
  975. * @see VPU_JSM_MSG_ENGINE_RESET_DONE
  976. */
  977. struct vpu_ipc_msg_payload_engine_reset_done {
  978. /** Engine ordinal */
  979. u32 engine_idx;
  980. /** Number of impacted contexts */
  981. u32 num_impacted_contexts;
  982. /** Array of impacted command queue ids and their flags */
  983. struct vpu_jsm_engine_reset_context
  984. impacted_contexts[VPU_MAX_ENGINE_RESET_IMPACTED_CONTEXTS];
  985. };
  986. /**
  987. * Preemption response struct
  988. * @see VPU_JSM_MSG_ENGINE_PREEMPT_DONE
  989. */
  990. struct vpu_ipc_msg_payload_engine_preempt_done {
  991. /** Engine preempted. */
  992. u32 engine_idx;
  993. /** ID of the preemption request. */
  994. u32 preempt_id;
  995. };
  996. /**
  997. * Response structure for register doorbell command for both OS
  998. * and HW scheduling.
  999. * @see VPU_JSM_MSG_REGISTER_DB
  1000. * @see VPU_JSM_MSG_HWS_REGISTER_DB
  1001. */
  1002. struct vpu_ipc_msg_payload_register_db_done {
  1003. /* Index of the registered doorbell. */
  1004. u32 db_idx;
  1005. /* Reserved */
  1006. u32 reserved_0;
  1007. };
  1008. /**
  1009. * Response structure for unregister doorbell command for both OS
  1010. * and HW scheduling.
  1011. * @see VPU_JSM_MSG_UNREGISTER_DB
  1012. */
  1013. struct vpu_ipc_msg_payload_unregister_db_done {
  1014. /* Index of the unregistered doorbell. */
  1015. u32 db_idx;
  1016. /* Reserved */
  1017. u32 reserved_0;
  1018. };
  1019. /**
  1020. * Structure for heartbeat response
  1021. * @see VPU_JSM_MSG_QUERY_ENGINE_HB_DONE
  1022. */
  1023. struct vpu_ipc_msg_payload_query_engine_hb_done {
  1024. /** Engine returning heartbeat value. */
  1025. u32 engine_idx;
  1026. /** Reserved */
  1027. u32 reserved_0;
  1028. /** Heartbeat value. */
  1029. u64 heartbeat;
  1030. };
  1031. struct vpu_ipc_msg_payload_get_power_level_count_done {
  1032. /**
  1033. * Number of supported power levels. The maximum possible
  1034. * value of power_level_count is 16 but this may vary across
  1035. * implementations.
  1036. */
  1037. u32 power_level_count;
  1038. /* Reserved */
  1039. u32 reserved_0;
  1040. /**
  1041. * Power consumption limit for each supported power level in
  1042. * [0-100%] range relative to power level 0.
  1043. */
  1044. u8 power_limit[16];
  1045. };
  1046. /**
  1047. * HWS priority band setup request / response
  1048. * @see VPU_JSM_MSG_SET_PRIORITY_BAND_SETUP
  1049. */
  1050. struct vpu_ipc_msg_payload_hws_priority_band_setup {
  1051. /*
  1052. * Grace period in 100ns units when preempting another priority band for
  1053. * this priority band
  1054. */
  1055. u32 grace_period[VPU_HWS_NUM_PRIORITY_BANDS];
  1056. /*
  1057. * Default quantum in 100ns units for scheduling across processes
  1058. * within a priority band
  1059. * Minimum value supported by NPU is 1ms (10000 in 100ns units).
  1060. */
  1061. u32 process_quantum[VPU_HWS_NUM_PRIORITY_BANDS];
  1062. /*
  1063. * Default grace period in 100ns units for processes that preempt each
  1064. * other within a priority band
  1065. */
  1066. u32 process_grace_period[VPU_HWS_NUM_PRIORITY_BANDS];
  1067. /*
  1068. * For normal priority band, specifies the target VPU percentage
  1069. * in situations when it's starved by the focus band.
  1070. */
  1071. u32 normal_band_percentage;
  1072. /*
  1073. * TDR timeout value in milliseconds. Default value of 0 meaning no timeout.
  1074. */
  1075. u32 tdr_timeout;
  1076. /* Non-interactive queue timeout for no progress of heartbeat in milliseconds.
  1077. * Default value of 0 meaning no timeout.
  1078. */
  1079. u32 non_interactive_no_progress_timeout;
  1080. /*
  1081. * Non-interactive queue upper limit timeout value in milliseconds. Default
  1082. * value of 0 meaning no timeout.
  1083. */
  1084. u32 non_interactive_timeout;
  1085. };
  1086. /**
  1087. * @brief HWS create command queue request.
  1088. * Host will create a command queue via this command.
  1089. * Note: Cmdq group is a handle of an object which
  1090. * may contain one or more command queues.
  1091. * @see VPU_JSM_MSG_CREATE_CMD_QUEUE
  1092. */
  1093. struct vpu_ipc_msg_payload_hws_create_cmdq {
  1094. /* Process id */
  1095. u64 process_id;
  1096. /* Host SSID */
  1097. u32 host_ssid;
  1098. /* Engine for which queue is being created */
  1099. u32 engine_idx;
  1100. /* Cmdq group: only used for HWS logging of state changes */
  1101. u64 cmdq_group;
  1102. /* Command queue id */
  1103. u64 cmdq_id;
  1104. /* Command queue base */
  1105. u64 cmdq_base;
  1106. /* Command queue size */
  1107. u32 cmdq_size;
  1108. /* Zero padding */
  1109. u32 reserved_0;
  1110. };
  1111. /**
  1112. * HWS create command queue response.
  1113. * @see VPU_JSM_MSG_CREATE_CMD_QUEUE_RSP
  1114. */
  1115. struct vpu_ipc_msg_payload_hws_create_cmdq_rsp {
  1116. /** Process id */
  1117. u64 process_id;
  1118. /** Host SSID */
  1119. u32 host_ssid;
  1120. /** Engine for which queue is being created */
  1121. u32 engine_idx;
  1122. /** Command queue group */
  1123. u64 cmdq_group;
  1124. /** Command queue id */
  1125. u64 cmdq_id;
  1126. };
  1127. /**
  1128. * HWS destroy command queue request / response
  1129. * @see VPU_JSM_MSG_DESTROY_CMD_QUEUE
  1130. * @see VPU_JSM_MSG_DESTROY_CMD_QUEUE_RSP
  1131. */
  1132. struct vpu_ipc_msg_payload_hws_destroy_cmdq {
  1133. /** Host SSID */
  1134. u32 host_ssid;
  1135. /** Zero Padding */
  1136. u32 reserved;
  1137. /** Command queue id */
  1138. u64 cmdq_id;
  1139. };
  1140. /**
  1141. * HWS set context scheduling properties request / response
  1142. * @see VPU_JSM_MSG_SET_CONTEXT_SCHED_PROPERTIES
  1143. * @see VPU_JSM_MSG_SET_CONTEXT_SCHED_PROPERTIES_RSP
  1144. */
  1145. struct vpu_ipc_msg_payload_hws_set_context_sched_properties {
  1146. /** Host SSID */
  1147. u32 host_ssid;
  1148. /** Zero Padding */
  1149. u32 reserved_0;
  1150. /** Command queue id */
  1151. u64 cmdq_id;
  1152. /**
  1153. * Priority band to assign to work of this context.
  1154. * Available priority bands: @see enum vpu_job_scheduling_priority_band
  1155. */
  1156. u32 priority_band;
  1157. /** Inside realtime band assigns a further priority */
  1158. u32 realtime_priority_level;
  1159. /** Priority relative to other contexts in the same process */
  1160. s32 in_process_priority;
  1161. /** Zero padding / Reserved */
  1162. u32 reserved_1;
  1163. /**
  1164. * Context quantum relative to other contexts of same priority in the same process
  1165. * Minimum value supported by NPU is 1ms (10000 in 100ns units).
  1166. */
  1167. u64 context_quantum;
  1168. /** Grace period when preempting context of the same priority within the same process */
  1169. u64 grace_period_same_priority;
  1170. /** Grace period when preempting context of a lower priority within the same process */
  1171. u64 grace_period_lower_priority;
  1172. };
  1173. /**
  1174. * Register doorbell command structure.
  1175. * This structure supports doorbell registration for both HW and OS scheduling.
  1176. * Note: Queue base and size are added here so that the same structure can be used for
  1177. * OS scheduling and HW scheduling. For OS scheduling, cmdq_id will be ignored
  1178. * and cmdq_base and cmdq_size will be used. For HW scheduling, cmdq_base and cmdq_size will be
  1179. * ignored and cmdq_id is used.
  1180. * @see VPU_JSM_MSG_HWS_REGISTER_DB
  1181. */
  1182. struct vpu_jsm_hws_register_db {
  1183. /** Index of the doorbell to register. */
  1184. u32 db_id;
  1185. /** Host sub-stream ID for the context assigned to the doorbell. */
  1186. u32 host_ssid;
  1187. /** ID of the command queue associated with the doorbell. */
  1188. u64 cmdq_id;
  1189. /** Virtual address pointing to the start of command queue. */
  1190. u64 cmdq_base;
  1191. /** Size of the command queue in bytes. */
  1192. u64 cmdq_size;
  1193. };
  1194. /**
  1195. * Structure to set another buffer to be used for scheduling-related logging.
  1196. * The size of the logging buffer and the number of entries is defined as part of the
  1197. * buffer itself as described next.
  1198. * The log buffer received from the host is made up of;
  1199. * - header: 32 bytes in size, as shown in @ref vpu_hws_log_buffer_header.
  1200. * The header contains the number of log entries in the buffer.
  1201. * - log entry: 0 to n-1, each log entry is 32 bytes in size, as shown in
  1202. * @ref vpu_hws_log_buffer_entry.
  1203. * The entry contains the VPU timestamp, operation type and data.
  1204. * The host should provide the notify index value of log buffer to VPU. This is a
  1205. * value defined within the log buffer and when written to will generate the
  1206. * scheduling log notification.
  1207. * The host should set engine_idx and vpu_log_buffer_va to 0 to disable logging
  1208. * for a particular engine.
  1209. * VPU will handle one log buffer for each of supported engines.
  1210. * VPU should allow the logging to consume one host_ssid.
  1211. * @see VPU_JSM_MSG_HWS_SET_SCHEDULING_LOG
  1212. * @see VPU_JSM_MSG_HWS_SET_SCHEDULING_LOG_RSP
  1213. * @see VPU_JSM_MSG_HWS_SCHEDULING_LOG_NOTIFICATION
  1214. */
  1215. struct vpu_ipc_msg_payload_hws_set_scheduling_log {
  1216. /** Engine ordinal */
  1217. u32 engine_idx;
  1218. /** Host SSID */
  1219. u32 host_ssid;
  1220. /**
  1221. * VPU log buffer virtual address.
  1222. * Set to 0 to disable logging for this engine.
  1223. */
  1224. u64 vpu_log_buffer_va;
  1225. /**
  1226. * Notify index of log buffer. VPU_JSM_MSG_HWS_SCHEDULING_LOG_NOTIFICATION
  1227. * is generated when an event log is written to this index.
  1228. */
  1229. u64 notify_index;
  1230. /**
  1231. * Field is now deprecated, will be removed when KMD is updated to support removal
  1232. */
  1233. u32 enable_extra_events;
  1234. /** Zero Padding */
  1235. u32 reserved_0;
  1236. };
  1237. /**
  1238. * The scheduling log notification is generated by VPU when it writes
  1239. * an event into the log buffer at the notify_index. VPU notifies host with
  1240. * VPU_JSM_MSG_HWS_SCHEDULING_LOG_NOTIFICATION. This is an asynchronous
  1241. * message from VPU to host.
  1242. * @see VPU_JSM_MSG_HWS_SCHEDULING_LOG_NOTIFICATION
  1243. * @see VPU_JSM_MSG_HWS_SET_SCHEDULING_LOG
  1244. */
  1245. struct vpu_ipc_msg_payload_hws_scheduling_log_notification {
  1246. /** Engine ordinal */
  1247. u32 engine_idx;
  1248. /** Zero Padding */
  1249. u32 reserved_0;
  1250. };
  1251. /**
  1252. * HWS suspend command queue request and done structure.
  1253. * Host will request the suspend of contexts and VPU will;
  1254. * - Suspend all work on this context
  1255. * - Preempt any running work
  1256. * - Asynchronously perform the above and return success immediately once
  1257. * all items above are started successfully
  1258. * - Notify the host of completion of these operations via
  1259. * VPU_JSM_MSG_HWS_SUSPEND_CMDQ_DONE
  1260. * - Reject any other context operations on a context with an in-flight
  1261. * suspend request running
  1262. * Same structure used when VPU notifies host of completion of a context suspend
  1263. * request. The ids and suspend fence value reported in this command will match
  1264. * the one in the request from the host to suspend the context. Once suspend is
  1265. * complete, VPU will not access any data relating to this command queue until
  1266. * it is resumed.
  1267. * @see VPU_JSM_MSG_HWS_SUSPEND_CMDQ
  1268. * @see VPU_JSM_MSG_HWS_SUSPEND_CMDQ_DONE
  1269. */
  1270. struct vpu_ipc_msg_payload_hws_suspend_cmdq {
  1271. /** Host SSID */
  1272. u32 host_ssid;
  1273. /** Zero Padding */
  1274. u32 reserved_0;
  1275. /** Command queue id */
  1276. u64 cmdq_id;
  1277. /**
  1278. * Suspend fence value - reported by the VPU suspend context
  1279. * completed once suspend is complete.
  1280. */
  1281. u64 suspend_fence_value;
  1282. };
  1283. /**
  1284. * HWS Resume command queue request / response structure.
  1285. * Host will request the resume of a context;
  1286. * - VPU will resume all work on this context
  1287. * - Scheduler will allow this context to be scheduled
  1288. * @see VPU_JSM_MSG_HWS_RESUME_CMDQ
  1289. * @see VPU_JSM_MSG_HWS_RESUME_CMDQ_RSP
  1290. */
  1291. struct vpu_ipc_msg_payload_hws_resume_cmdq {
  1292. /** Host SSID */
  1293. u32 host_ssid;
  1294. /** Zero Padding */
  1295. u32 reserved_0;
  1296. /** Command queue id */
  1297. u64 cmdq_id;
  1298. };
  1299. /**
  1300. * HWS Resume engine request / response structure.
  1301. * After a HWS engine reset, all scheduling is stopped on VPU until an engine resume.
  1302. * Host shall send this command to resume scheduling of any valid queue.
  1303. * @see VPU_JSM_MSG_HWS_ENGINE_RESUME
  1304. * @see VPU_JSM_MSG_HWS_RESUME_ENGINE_DONE
  1305. */
  1306. struct vpu_ipc_msg_payload_hws_resume_engine {
  1307. /** Engine to be resumed */
  1308. u32 engine_idx;
  1309. /** Reserved */
  1310. u32 reserved_0;
  1311. };
  1312. /**
  1313. * Payload for VPU_JSM_MSG_TRACE_SET_CONFIG[_RSP] and
  1314. * VPU_JSM_MSG_TRACE_GET_CONFIG_RSP messages.
  1315. *
  1316. * The payload is interpreted differently depending on the type of message:
  1317. *
  1318. * - For VPU_JSM_MSG_TRACE_SET_CONFIG, the payload specifies the desired
  1319. * logging configuration to be set.
  1320. *
  1321. * - For VPU_JSM_MSG_TRACE_SET_CONFIG_RSP, the payload reports the logging
  1322. * configuration that was set after a VPU_JSM_MSG_TRACE_SET_CONFIG request.
  1323. * The host can compare this payload with the one it sent in the
  1324. * VPU_JSM_MSG_TRACE_SET_CONFIG request to check whether or not the
  1325. * configuration was set as desired.
  1326. *
  1327. * - VPU_JSM_MSG_TRACE_GET_CONFIG_RSP, the payload reports the current logging
  1328. * configuration.
  1329. */
  1330. struct vpu_ipc_msg_payload_trace_config {
  1331. /**
  1332. * Logging level (currently set or to be set); see 'mvLog_t' enum for
  1333. * acceptable values. The specified logging level applies to all
  1334. * destinations and HW components
  1335. */
  1336. u32 trace_level;
  1337. /**
  1338. * Bitmask of logging destinations (currently enabled or to be enabled);
  1339. * bitwise OR of values defined in logging_destination enum.
  1340. */
  1341. u32 trace_destination_mask;
  1342. /**
  1343. * Bitmask of loggable HW components (currently enabled or to be enabled);
  1344. * bitwise OR of values defined in loggable_hw_component enum.
  1345. */
  1346. u64 trace_hw_component_mask;
  1347. u64 reserved_0; /**< Reserved for future extensions. */
  1348. };
  1349. /**
  1350. * Payload for VPU_JSM_MSG_TRACE_GET_CAPABILITY_RSP messages.
  1351. */
  1352. struct vpu_ipc_msg_payload_trace_capability_rsp {
  1353. u32 trace_destination_mask; /**< Bitmask of supported logging destinations. */
  1354. u32 reserved_0;
  1355. u64 trace_hw_component_mask; /**< Bitmask of supported loggable HW components. */
  1356. u64 reserved_1; /**< Reserved for future extensions. */
  1357. };
  1358. /**
  1359. * Payload for VPU_JSM_MSG_TRACE_GET_NAME requests.
  1360. */
  1361. struct vpu_ipc_msg_payload_trace_get_name {
  1362. /**
  1363. * The type of the entity to query name for; see logging_entity_type for
  1364. * possible values.
  1365. */
  1366. u32 entity_type;
  1367. u32 reserved_0;
  1368. /**
  1369. * The ID of the entity to query name for; possible values depends on the
  1370. * entity type.
  1371. */
  1372. u64 entity_id;
  1373. };
  1374. /**
  1375. * Payload for VPU_JSM_MSG_TRACE_GET_NAME_RSP responses.
  1376. */
  1377. struct vpu_ipc_msg_payload_trace_get_name_rsp {
  1378. /**
  1379. * The type of the entity whose name was queried; see logging_entity_type
  1380. * for possible values.
  1381. */
  1382. u32 entity_type;
  1383. u32 reserved_0;
  1384. /**
  1385. * The ID of the entity whose name was queried; possible values depends on
  1386. * the entity type.
  1387. */
  1388. u64 entity_id;
  1389. /** Reserved for future extensions. */
  1390. u64 reserved_1;
  1391. /** The name of the entity. */
  1392. char entity_name[VPU_TRACE_ENTITY_NAME_MAX_LEN];
  1393. };
  1394. /**
  1395. * Data sent from the VPU to the host in all metric streamer response messages
  1396. * and in asynchronous notification.
  1397. * @see VPU_JSM_MSG_METRIC_STREAMER_START_DONE
  1398. * @see VPU_JSM_MSG_METRIC_STREAMER_STOP_DONE
  1399. * @see VPU_JSM_MSG_METRIC_STREAMER_UPDATE_DONE
  1400. * @see VPU_JSM_MSG_METRIC_STREAMER_INFO_DONE
  1401. * @see VPU_JSM_MSG_METRIC_STREAMER_NOTIFICATION
  1402. */
  1403. struct vpu_jsm_metric_streamer_done {
  1404. /** Metric group mask that identifies metric streamer instance. */
  1405. u64 metric_group_mask;
  1406. /**
  1407. * Size in bytes of single sample - total size of all enabled counters.
  1408. * Some VPU implementations may align sample_size to more than 8 bytes.
  1409. */
  1410. u32 sample_size;
  1411. u32 reserved_0;
  1412. /**
  1413. * Number of samples collected since the metric streamer was started.
  1414. * This will be 0 if the metric streamer was not started.
  1415. */
  1416. u32 samples_collected;
  1417. /**
  1418. * Number of samples dropped since the metric streamer was started. This
  1419. * is incremented every time the metric streamer is not able to write
  1420. * collected samples because the current buffer is full and there is no
  1421. * next buffer to switch to.
  1422. */
  1423. u32 samples_dropped;
  1424. /** Address of the buffer that contains the latest metric data. */
  1425. u64 buffer_addr;
  1426. /**
  1427. * Number of bytes written into the metric data buffer. In response to the
  1428. * VPU_JSM_MSG_METRIC_STREAMER_INFO request this field contains the size of
  1429. * all group and counter descriptors. The size is updated even if the buffer
  1430. * in the request was NULL or too small to hold descriptors of all counters
  1431. */
  1432. u64 bytes_written;
  1433. };
  1434. /**
  1435. * Metric group description placed in the metric buffer after successful completion
  1436. * of the VPU_JSM_MSG_METRIC_STREAMER_INFO command. This is followed by one or more
  1437. * @ref vpu_jsm_metric_counter_descriptor records.
  1438. * @see VPU_JSM_MSG_METRIC_STREAMER_INFO
  1439. */
  1440. struct vpu_jsm_metric_group_descriptor {
  1441. /**
  1442. * Offset to the next metric group (8-byte aligned). If this offset is 0 this
  1443. * is the last descriptor. The value of metric_info_size must be greater than
  1444. * or equal to sizeof(struct vpu_jsm_metric_group_descriptor) + name_string_size
  1445. * + description_string_size and must be 8-byte aligned.
  1446. */
  1447. u32 next_metric_group_info_offset;
  1448. /**
  1449. * Offset to the first metric counter description record (8-byte aligned).
  1450. * @see vpu_jsm_metric_counter_descriptor
  1451. */
  1452. u32 next_metric_counter_info_offset;
  1453. /** Index of the group. This corresponds to bit index in metric_group_mask. */
  1454. u32 group_id;
  1455. /** Number of counters in the metric group. */
  1456. u32 num_counters;
  1457. /** Data size for all counters, must be a multiple of 8 bytes.*/
  1458. u32 metric_group_data_size;
  1459. /**
  1460. * Metric group domain number. Cannot use multiple, simultaneous metric groups
  1461. * from the same domain.
  1462. */
  1463. u32 domain;
  1464. /**
  1465. * Counter name string size. The string must include a null termination character.
  1466. * The FW may use a fixed size name or send a different name for each counter.
  1467. * If the VPU uses fixed size strings, all characters from the end of the name
  1468. * to the of the fixed size character array must be zeroed.
  1469. */
  1470. u32 name_string_size;
  1471. /** Counter description string size, @see name_string_size */
  1472. u32 description_string_size;
  1473. u64 reserved_0;
  1474. /**
  1475. * Right after this structure, the VPU writes name and description of
  1476. * the metric group.
  1477. */
  1478. };
  1479. /**
  1480. * Metric counter description, placed in the buffer after vpu_jsm_metric_group_descriptor.
  1481. * @see VPU_JSM_MSG_METRIC_STREAMER_INFO
  1482. */
  1483. struct vpu_jsm_metric_counter_descriptor {
  1484. /**
  1485. * Offset to the next counter in a group (8-byte aligned). If this offset is
  1486. * 0 this is the last counter in the group.
  1487. */
  1488. u32 next_metric_counter_info_offset;
  1489. /**
  1490. * Offset to the counter data from the start of samples in this metric group.
  1491. * Note that metric_data_offset % metric_data_size must be 0.
  1492. */
  1493. u32 metric_data_offset;
  1494. /** Size of the metric counter data in bytes. */
  1495. u32 metric_data_size;
  1496. /** Metric type, see Level Zero API for definitions. */
  1497. u32 tier;
  1498. /** Metric type, see set_metric_type_t for definitions. */
  1499. u32 metric_type;
  1500. /** Metric type, see set_value_type_t for definitions. */
  1501. u32 metric_value_type;
  1502. /**
  1503. * Counter name string size. The string must include a null termination character.
  1504. * The FW may use a fixed size name or send a different name for each counter.
  1505. * If the VPU uses fixed size strings, all characters from the end of the name
  1506. * to the of the fixed size character array must be zeroed.
  1507. */
  1508. u32 name_string_size;
  1509. /** Counter description string size, @see name_string_size */
  1510. u32 description_string_size;
  1511. /** Counter component name string size, @see name_string_size */
  1512. u32 component_string_size;
  1513. /** Counter string size, @see name_string_size */
  1514. u32 units_string_size;
  1515. u64 reserved_0;
  1516. /**
  1517. * Right after this structure, the VPU writes name, description
  1518. * component and unit strings.
  1519. */
  1520. };
  1521. /**
  1522. * Payload for @ref VPU_JSM_MSG_DYNDBG_CONTROL requests.
  1523. *
  1524. * VPU_JSM_MSG_DYNDBG_CONTROL requests are used to control the VPU FW dynamic debug
  1525. * feature, which allows developers to selectively enable/disable code to obtain
  1526. * additional FW information. This is equivalent to the dynamic debug functionality
  1527. * provided by Linux. The host can control dynamic debug behavior by sending dyndbg
  1528. * commands, using the same syntax as for Linux dynamic debug commands.
  1529. *
  1530. * @see https://www.kernel.org/doc/html/latest/admin-guide/dynamic-debug-howto.html.
  1531. *
  1532. * NOTE:
  1533. * As the dynamic debug feature uses MVLOG messages to provide information, the host
  1534. * must first set the logging level to MVLOG_DEBUG, using the @ref VPU_JSM_MSG_TRACE_SET_CONFIG
  1535. * command.
  1536. */
  1537. struct vpu_ipc_msg_payload_dyndbg_control {
  1538. /**
  1539. * Dyndbg command to be executed.
  1540. */
  1541. char dyndbg_cmd[VPU_DYNDBG_CMD_MAX_LEN];
  1542. };
  1543. /**
  1544. * Payload for VPU_JSM_MSG_PWR_D0I3_ENTER
  1545. *
  1546. * This is a bi-directional payload.
  1547. */
  1548. struct vpu_ipc_msg_payload_pwr_d0i3_enter {
  1549. /**
  1550. * 0: VPU_JSM_MSG_PWR_D0I3_ENTER_DONE is not sent to the host driver
  1551. * The driver will poll for D0i2 Idle state transitions.
  1552. * 1: VPU_JSM_MSG_PWR_D0I3_ENTER_DONE is sent after VPU state save is complete
  1553. */
  1554. u32 send_response;
  1555. u32 reserved_0;
  1556. };
  1557. /**
  1558. * Payload for @ref VPU_JSM_MSG_DCT_ENABLE message.
  1559. *
  1560. * Default values for DCT active/inactive times are 5.3ms and 30ms respectively,
  1561. * corresponding to a 85% duty cycle. This payload allows the host to tune these
  1562. * values according to application requirements.
  1563. */
  1564. struct vpu_ipc_msg_payload_pwr_dct_control {
  1565. /** Duty cycle active time in microseconds */
  1566. u32 dct_active_us;
  1567. /** Duty cycle inactive time in microseconds */
  1568. u32 dct_inactive_us;
  1569. };
  1570. /*
  1571. * Payloads union, used to define complete message format.
  1572. */
  1573. union vpu_ipc_msg_payload {
  1574. struct vpu_ipc_msg_payload_engine_reset engine_reset;
  1575. struct vpu_ipc_msg_payload_engine_preempt engine_preempt;
  1576. struct vpu_ipc_msg_payload_register_db register_db;
  1577. struct vpu_ipc_msg_payload_unregister_db unregister_db;
  1578. struct vpu_ipc_msg_payload_query_engine_hb query_engine_hb;
  1579. struct vpu_ipc_msg_payload_power_level power_level;
  1580. struct vpu_jsm_metric_streamer_start metric_streamer_start;
  1581. struct vpu_jsm_metric_streamer_stop metric_streamer_stop;
  1582. struct vpu_jsm_metric_streamer_update metric_streamer_update;
  1583. struct vpu_ipc_msg_payload_ssid_release ssid_release;
  1584. struct vpu_jsm_hws_register_db hws_register_db;
  1585. struct vpu_ipc_msg_payload_job_done job_done;
  1586. struct vpu_ipc_msg_payload_native_fence_signalled native_fence_signalled;
  1587. struct vpu_ipc_msg_payload_engine_reset_done engine_reset_done;
  1588. struct vpu_ipc_msg_payload_engine_preempt_done engine_preempt_done;
  1589. struct vpu_ipc_msg_payload_register_db_done register_db_done;
  1590. struct vpu_ipc_msg_payload_unregister_db_done unregister_db_done;
  1591. struct vpu_ipc_msg_payload_query_engine_hb_done query_engine_hb_done;
  1592. struct vpu_ipc_msg_payload_get_power_level_count_done get_power_level_count_done;
  1593. struct vpu_jsm_metric_streamer_done metric_streamer_done;
  1594. struct vpu_ipc_msg_payload_trace_config trace_config;
  1595. struct vpu_ipc_msg_payload_trace_capability_rsp trace_capability;
  1596. struct vpu_ipc_msg_payload_trace_get_name trace_get_name;
  1597. struct vpu_ipc_msg_payload_trace_get_name_rsp trace_get_name_rsp;
  1598. struct vpu_ipc_msg_payload_dyndbg_control dyndbg_control;
  1599. struct vpu_ipc_msg_payload_hws_priority_band_setup hws_priority_band_setup;
  1600. struct vpu_ipc_msg_payload_hws_create_cmdq hws_create_cmdq;
  1601. struct vpu_ipc_msg_payload_hws_create_cmdq_rsp hws_create_cmdq_rsp;
  1602. struct vpu_ipc_msg_payload_hws_destroy_cmdq hws_destroy_cmdq;
  1603. struct vpu_ipc_msg_payload_hws_set_context_sched_properties
  1604. hws_set_context_sched_properties;
  1605. struct vpu_ipc_msg_payload_hws_set_scheduling_log hws_set_scheduling_log;
  1606. struct vpu_ipc_msg_payload_hws_scheduling_log_notification hws_scheduling_log_notification;
  1607. struct vpu_ipc_msg_payload_hws_suspend_cmdq hws_suspend_cmdq;
  1608. struct vpu_ipc_msg_payload_hws_resume_cmdq hws_resume_cmdq;
  1609. struct vpu_ipc_msg_payload_hws_resume_engine hws_resume_engine;
  1610. struct vpu_ipc_msg_payload_pwr_d0i3_enter pwr_d0i3_enter;
  1611. struct vpu_ipc_msg_payload_pwr_dct_control pwr_dct_control;
  1612. };
  1613. /**
  1614. * Host <-> NPU IPC message base structure.
  1615. *
  1616. * NOTE: All instances of this object must be aligned on a 64B boundary
  1617. * to allow proper handling of VPU cache operations.
  1618. */
  1619. struct vpu_jsm_msg {
  1620. /** Reserved */
  1621. u64 reserved_0;
  1622. /** Message type, see @ref vpu_ipc_msg_type. */
  1623. u32 type;
  1624. /** Buffer status, see @ref vpu_ipc_msg_status. */
  1625. u32 status;
  1626. /**
  1627. * Request ID, provided by the host in a request message and passed
  1628. * back by VPU in the response message.
  1629. */
  1630. u32 request_id;
  1631. /** Request return code set by the VPU, see VPU_JSM_STATUS_* defines. */
  1632. u32 result;
  1633. u64 reserved_1;
  1634. /** Message payload depending on message type, see vpu_ipc_msg_payload union. */
  1635. union vpu_ipc_msg_payload payload;
  1636. };
  1637. #pragma pack(pop)
  1638. #endif
  1639. ///@}