1 /* SPDX-License-Identifier: MIT */
3 * Copyright © 2023 Intel Corporation
6 #ifndef _XE_GUC_SUBMIT_TYPES_H_
7 #define _XE_GUC_SUBMIT_TYPES_H_
9 #include "xe_hw_engine_types.h"
11 /* Work item for submitting workloads into work queue of GuC. */
12 #define WQ_STATUS_ACTIVE 1
13 #define WQ_STATUS_SUSPENDED 2
14 #define WQ_STATUS_CMD_ERROR 3
15 #define WQ_STATUS_ENGINE_ID_NOT_USED 4
16 #define WQ_STATUS_SUSPENDED_FROM_RESET 5
17 #define WQ_TYPE_NOOP 0x4
18 #define WQ_TYPE_MULTI_LRC 0x5
19 #define WQ_TYPE_MASK GENMASK(7, 0)
20 #define WQ_LEN_MASK GENMASK(26, 16)
22 #define WQ_GUC_ID_MASK GENMASK(15, 0)
23 #define WQ_RING_TAIL_MASK GENMASK(28, 18)
25 #define PARALLEL_SCRATCH_SIZE 2048
26 #define WQ_SIZE (PARALLEL_SCRATCH_SIZE / 2)
27 #define WQ_OFFSET (PARALLEL_SCRATCH_SIZE - WQ_SIZE)
28 #define CACHELINE_BYTES 64
30 struct guc_sched_wq_desc {
38 struct sync_semaphore {
40 u8 unused[CACHELINE_BYTES - sizeof(u32)];
44 * struct guc_submit_parallel_scratch - A scratch shared mapped buffer.
46 struct guc_submit_parallel_scratch {
47 /** @wq_desc: Guc scheduler workqueue descriptor */
48 struct guc_sched_wq_desc wq_desc;
50 /** @go: Go Semaphore */
51 struct sync_semaphore go;
52 /** @join: Joined semaphore for the relevant hw engine instances */
53 struct sync_semaphore join[XE_HW_ENGINE_MAX_INSTANCE];
55 /** @unused: Unused/Reserved memory space */
56 u8 unused[WQ_OFFSET - sizeof(struct guc_sched_wq_desc) -
57 sizeof(struct sync_semaphore) *
58 (XE_HW_ENGINE_MAX_INSTANCE + 1)];
60 /** @wq: Workqueue info */
61 u32 wq[WQ_SIZE / sizeof(u32)];
75 struct pending_list_snapshot {
82 * struct xe_guc_submit_exec_queue_snapshot - Snapshot for devcoredump
84 struct xe_guc_submit_exec_queue_snapshot {
85 /** @name: name of this exec queue */
86 char name[MAX_FENCE_NAME_LEN];
87 /** @class: class of this exec queue */
88 enum xe_engine_class class;
90 * @logical_mask: logical mask of where job submitted to exec queue can run
93 /** @width: width (number BB submitted per exec) of this exec queue */
95 /** @refcount: ref count of this exec queue */
98 * @sched_timeout: the time after which a job is removed from the
103 /** @sched_props: scheduling properties */
105 /** @sched_props.timeslice_us: timeslice period in micro-seconds */
107 /** @sched_props.preempt_timeout_us: preemption timeout in micro-seconds */
108 u32 preempt_timeout_us;
111 /** @lrc: LRC Snapshot */
112 struct lrc_snapshot *lrc;
114 /** @schedule_state: Schedule State at the moment of Crash */
116 /** @exec_queue_flags: Flags of the faulty exec_queue */
117 unsigned long exec_queue_flags;
119 /** @guc: GuC Engine Snapshot */
121 /** @guc.wqi_head: work queue item head */
123 /** @guc.wqi_tail: work queue item tail */
125 /** @guc.id: GuC id for this exec_queue */
130 * @parallel_execution: Indication if the failure was during parallel
133 bool parallel_execution;
134 /** @parallel: snapshot of the useful parallel scratch */
136 /** @parallel.wq_desc: Workqueue description */
138 /** @parallel.wq_desc.head: Workqueue Head */
140 /** @parallel.wq_desc.tail: Workqueue Tail */
142 /** @parallel.wq_desc.status: Workqueue Status */
145 /** @wq: Workqueue Items */
146 u32 wq[WQ_SIZE / sizeof(u32)];
149 /** @pending_list_size: Size of the pending list snapshot array */
150 int pending_list_size;
151 /** @pending_list: snapshot of the pending list info */
152 struct pending_list_snapshot *pending_list;