blob: 950c7e70058bc0695ed6d9a18f456cdc3c165da7 [file] [log] [blame]
Dave Gordon26172682015-07-09 19:29:04 +01001/*
2 * Copyright © 2014 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23#ifndef _INTEL_GUC_FWIF_H
24#define _INTEL_GUC_FWIF_H
25
26/*
27 * This file is partially autogenerated, although currently with some manual
28 * fixups afterwards. In future, it should be entirely autogenerated, in order
29 * to ensure that the definitions herein remain in sync with those used by the
30 * GuC's own firmware.
31 *
32 * EDITING THIS FILE IS THEREFORE NOT RECOMMENDED - YOUR CHANGES MAY BE LOST.
33 */
34
Dave Gordon26172682015-07-09 19:29:04 +010035#define GFXCORE_FAMILY_GEN9 12
Alex Dai33a732f2015-08-12 15:43:36 +010036#define GFXCORE_FAMILY_UNKNOWN 0x7fffffff
Dave Gordon26172682015-07-09 19:29:04 +010037
Dave Gordon44a28b12015-08-12 15:43:41 +010038#define GUC_CTX_PRIORITY_KMD_HIGH 0
Dave Gordon26172682015-07-09 19:29:04 +010039#define GUC_CTX_PRIORITY_HIGH 1
Dave Gordon44a28b12015-08-12 15:43:41 +010040#define GUC_CTX_PRIORITY_KMD_NORMAL 2
41#define GUC_CTX_PRIORITY_NORMAL 3
Dave Gordon26172682015-07-09 19:29:04 +010042
43#define GUC_MAX_GPU_CONTEXTS 1024
44#define GUC_INVALID_CTX_ID (GUC_MAX_GPU_CONTEXTS + 1)
45
46/* Work queue item header definitions */
47#define WQ_STATUS_ACTIVE 1
48#define WQ_STATUS_SUSPENDED 2
49#define WQ_STATUS_CMD_ERROR 3
50#define WQ_STATUS_ENGINE_ID_NOT_USED 4
51#define WQ_STATUS_SUSPENDED_FROM_RESET 5
52#define WQ_TYPE_SHIFT 0
53#define WQ_TYPE_BATCH_BUF (0x1 << WQ_TYPE_SHIFT)
54#define WQ_TYPE_PSEUDO (0x2 << WQ_TYPE_SHIFT)
55#define WQ_TYPE_INORDER (0x3 << WQ_TYPE_SHIFT)
56#define WQ_TARGET_SHIFT 10
57#define WQ_LEN_SHIFT 16
58#define WQ_NO_WCFLUSH_WAIT (1 << 27)
59#define WQ_PRESENT_WORKLOAD (1 << 28)
60#define WQ_WORKLOAD_SHIFT 29
61#define WQ_WORKLOAD_GENERAL (0 << WQ_WORKLOAD_SHIFT)
62#define WQ_WORKLOAD_GPGPU (1 << WQ_WORKLOAD_SHIFT)
63#define WQ_WORKLOAD_TOUCH (2 << WQ_WORKLOAD_SHIFT)
64
65#define WQ_RING_TAIL_SHIFT 20
66#define WQ_RING_TAIL_MASK (0x7FF << WQ_RING_TAIL_SHIFT)
67
68#define GUC_DOORBELL_ENABLED 1
69#define GUC_DOORBELL_DISABLED 0
70
71#define GUC_CTX_DESC_ATTR_ACTIVE (1 << 0)
72#define GUC_CTX_DESC_ATTR_PENDING_DB (1 << 1)
73#define GUC_CTX_DESC_ATTR_KERNEL (1 << 2)
74#define GUC_CTX_DESC_ATTR_PREEMPT (1 << 3)
75#define GUC_CTX_DESC_ATTR_RESET (1 << 4)
76#define GUC_CTX_DESC_ATTR_WQLOCKED (1 << 5)
77#define GUC_CTX_DESC_ATTR_PCH (1 << 6)
78
79/* The guc control data is 10 DWORDs */
80#define GUC_CTL_CTXINFO 0
81#define GUC_CTL_CTXNUM_IN16_SHIFT 0
82#define GUC_CTL_BASE_ADDR_SHIFT 12
83#define GUC_CTL_ARAT_HIGH 1
84#define GUC_CTL_ARAT_LOW 2
85#define GUC_CTL_DEVICE_INFO 3
86#define GUC_CTL_GTTYPE_SHIFT 0
87#define GUC_CTL_COREFAMILY_SHIFT 7
88#define GUC_CTL_LOG_PARAMS 4
89#define GUC_LOG_VALID (1 << 0)
90#define GUC_LOG_NOTIFY_ON_HALF_FULL (1 << 1)
91#define GUC_LOG_ALLOC_IN_MEGABYTE (1 << 3)
92#define GUC_LOG_CRASH_PAGES 1
93#define GUC_LOG_CRASH_SHIFT 4
94#define GUC_LOG_DPC_PAGES 3
95#define GUC_LOG_DPC_SHIFT 6
96#define GUC_LOG_ISR_PAGES 3
97#define GUC_LOG_ISR_SHIFT 9
98#define GUC_LOG_BUF_ADDR_SHIFT 12
99#define GUC_CTL_PAGE_FAULT_CONTROL 5
100#define GUC_CTL_WA 6
101#define GUC_CTL_WA_UK_BY_DRIVER (1 << 3)
102#define GUC_CTL_FEATURE 7
103#define GUC_CTL_VCS2_ENABLED (1 << 0)
104#define GUC_CTL_KERNEL_SUBMISSIONS (1 << 1)
105#define GUC_CTL_FEATURE2 (1 << 2)
106#define GUC_CTL_POWER_GATING (1 << 3)
107#define GUC_CTL_DISABLE_SCHEDULER (1 << 4)
108#define GUC_CTL_PREEMPTION_LOG (1 << 5)
109#define GUC_CTL_ENABLE_SLPC (1 << 7)
110#define GUC_CTL_DEBUG 8
111#define GUC_LOG_VERBOSITY_SHIFT 0
112#define GUC_LOG_VERBOSITY_LOW (0 << GUC_LOG_VERBOSITY_SHIFT)
113#define GUC_LOG_VERBOSITY_MED (1 << GUC_LOG_VERBOSITY_SHIFT)
114#define GUC_LOG_VERBOSITY_HIGH (2 << GUC_LOG_VERBOSITY_SHIFT)
115#define GUC_LOG_VERBOSITY_ULTRA (3 << GUC_LOG_VERBOSITY_SHIFT)
116/* Verbosity range-check limits, without the shift */
117#define GUC_LOG_VERBOSITY_MIN 0
118#define GUC_LOG_VERBOSITY_MAX 3
119
120#define GUC_CTL_MAX_DWORDS (GUC_CTL_DEBUG + 1)
121
122struct guc_doorbell_info {
123 u32 db_status;
124 u32 cookie;
125 u32 reserved[14];
126} __packed;
127
128union guc_doorbell_qw {
129 struct {
130 u32 db_status;
131 u32 cookie;
132 };
133 u64 value_qw;
134} __packed;
135
136#define GUC_MAX_DOORBELLS 256
137#define GUC_INVALID_DOORBELL_ID (GUC_MAX_DOORBELLS)
138
139#define GUC_DB_SIZE (PAGE_SIZE)
140#define GUC_WQ_SIZE (PAGE_SIZE * 2)
141
142/* Work item for submitting workloads into work queue of GuC. */
143struct guc_wq_item {
144 u32 header;
145 u32 context_desc;
146 u32 ring_tail;
147 u32 fence_id;
148} __packed;
149
150struct guc_process_desc {
151 u32 context_id;
152 u64 db_base_addr;
153 u32 head;
154 u32 tail;
155 u32 error_offset;
156 u64 wq_base_addr;
157 u32 wq_size_bytes;
158 u32 wq_status;
159 u32 engine_presence;
160 u32 priority;
161 u32 reserved[30];
162} __packed;
163
164/* engine id and context id is packed into guc_execlist_context.context_id*/
165#define GUC_ELC_CTXID_OFFSET 0
166#define GUC_ELC_ENGINE_OFFSET 29
167
168/* The execlist context including software and HW information */
169struct guc_execlist_context {
170 u32 context_desc;
171 u32 context_id;
172 u32 ring_status;
173 u32 ring_lcra;
174 u32 ring_begin;
175 u32 ring_end;
176 u32 ring_next_free_location;
177 u32 ring_current_tail_pointer_value;
178 u8 engine_state_submit_value;
179 u8 engine_state_wait_value;
180 u16 pagefault_count;
181 u16 engine_submit_queue_count;
182} __packed;
183
184/*Context descriptor for communicating between uKernel and Driver*/
185struct guc_context_desc {
186 u32 sched_common_area;
187 u32 context_id;
188 u32 pas_id;
189 u8 engines_used;
190 u64 db_trigger_cpu;
191 u32 db_trigger_uk;
192 u64 db_trigger_phy;
193 u16 db_id;
194
195 struct guc_execlist_context lrc[I915_NUM_RINGS];
196
197 u8 attribute;
198
199 u32 priority;
200
201 u32 wq_sampled_tail_offset;
202 u32 wq_total_submit_enqueues;
203
204 u32 process_desc;
205 u32 wq_addr;
206 u32 wq_size;
207
208 u32 engine_presence;
209
210 u32 reserved0[1];
211 u64 reserved1[1];
212
213 u64 desc_private;
214} __packed;
215
216/* This Action will be programmed in C180 - SOFT_SCRATCH_O_REG */
217enum host2guc_action {
218 HOST2GUC_ACTION_DEFAULT = 0x0,
219 HOST2GUC_ACTION_SAMPLE_FORCEWAKE = 0x6,
220 HOST2GUC_ACTION_ALLOCATE_DOORBELL = 0x10,
221 HOST2GUC_ACTION_DEALLOCATE_DOORBELL = 0x20,
222 HOST2GUC_ACTION_SLPC_REQUEST = 0x3003,
223 HOST2GUC_ACTION_LIMIT
224};
225
226/*
227 * The GuC sends its response to a command by overwriting the
228 * command in SS0. The response is distinguishable from a command
229 * by the fact that all the MASK bits are set. The remaining bits
230 * give more detail.
231 */
232#define GUC2HOST_RESPONSE_MASK ((u32)0xF0000000)
233#define GUC2HOST_IS_RESPONSE(x) ((u32)(x) >= GUC2HOST_RESPONSE_MASK)
234#define GUC2HOST_STATUS(x) (GUC2HOST_RESPONSE_MASK | (x))
235
236/* GUC will return status back to SOFT_SCRATCH_O_REG */
237enum guc2host_status {
238 GUC2HOST_STATUS_SUCCESS = GUC2HOST_STATUS(0x0),
239 GUC2HOST_STATUS_ALLOCATE_DOORBELL_FAIL = GUC2HOST_STATUS(0x10),
240 GUC2HOST_STATUS_DEALLOCATE_DOORBELL_FAIL = GUC2HOST_STATUS(0x20),
241 GUC2HOST_STATUS_GENERIC_FAIL = GUC2HOST_STATUS(0x0000F000)
242};
243
244#endif