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)];
64 struct pending_list_snapshot {
71 * struct xe_guc_submit_exec_queue_snapshot - Snapshot for devcoredump
73 struct xe_guc_submit_exec_queue_snapshot {
74 /** @name: name of this exec queue */
75 char name[MAX_FENCE_NAME_LEN];
76 /** @class: class of this exec queue */
77 enum xe_engine_class class;
79 * @logical_mask: logical mask of where job submitted to exec queue can run
82 /** @width: width (number BB submitted per exec) of this exec queue */
84 /** @refcount: ref count of this exec queue */
87 * @sched_timeout: the time after which a job is removed from the
92 /** @sched_props: scheduling properties */
94 /** @sched_props.timeslice_us: timeslice period in micro-seconds */
96 /** @sched_props.preempt_timeout_us: preemption timeout in micro-seconds */
97 u32 preempt_timeout_us;
100 /** @lrc: LRC Snapshot */
101 struct xe_lrc_snapshot **lrc;
103 /** @schedule_state: Schedule State at the moment of Crash */
105 /** @exec_queue_flags: Flags of the faulty exec_queue */
106 unsigned long exec_queue_flags;
108 /** @guc: GuC Engine Snapshot */
110 /** @guc.wqi_head: work queue item head */
112 /** @guc.wqi_tail: work queue item tail */
114 /** @guc.id: GuC id for this exec_queue */
119 * @parallel_execution: Indication if the failure was during parallel
122 bool parallel_execution;
123 /** @parallel: snapshot of the useful parallel scratch */
125 /** @parallel.wq_desc: Workqueue description */
127 /** @parallel.wq_desc.head: Workqueue Head */
129 /** @parallel.wq_desc.tail: Workqueue Tail */
131 /** @parallel.wq_desc.status: Workqueue Status */
134 /** @wq: Workqueue Items */
135 u32 wq[WQ_SIZE / sizeof(u32)];
138 /** @pending_list_size: Size of the pending list snapshot array */
139 int pending_list_size;
140 /** @pending_list: snapshot of the pending list info */
141 struct pending_list_snapshot *pending_list;