• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* (C) COPYRIGHT 2014-2018 ARM Limited. All rights reserved. */
3 /* Copyright 2019 Linaro, Ltd., Rob Herring <robh@kernel.org> */
4 #ifndef __PANFROST_FEATURES_H__
5 #define __PANFROST_FEATURES_H__
6 
7 #include <linux/bitops.h>
8 
9 #include "panfrost_device.h"
10 
11 enum panfrost_hw_feature {
12 	HW_FEATURE_JOBCHAIN_DISAMBIGUATION,
13 	HW_FEATURE_PWRON_DURING_PWROFF_TRANS,
14 	HW_FEATURE_XAFFINITY,
15 	HW_FEATURE_OUT_OF_ORDER_EXEC,
16 	HW_FEATURE_MRT,
17 	HW_FEATURE_BRNDOUT_CC,
18 	HW_FEATURE_INTERPIPE_REG_ALIASING,
19 	HW_FEATURE_LD_ST_TILEBUFFER,
20 	HW_FEATURE_MSAA_16X,
21 	HW_FEATURE_32_BIT_UNIFORM_ADDRESS,
22 	HW_FEATURE_ATTR_AUTO_TYPE_INFERRAL,
23 	HW_FEATURE_OPTIMIZED_COVERAGE_MASK,
24 	HW_FEATURE_T7XX_PAIRING_RULES,
25 	HW_FEATURE_LD_ST_LEA_TEX,
26 	HW_FEATURE_LINEAR_FILTER_FLOAT,
27 	HW_FEATURE_WORKGROUP_ROUND_MULTIPLE_OF_4,
28 	HW_FEATURE_IMAGES_IN_FRAGMENT_SHADERS,
29 	HW_FEATURE_TEST4_DATUM_MODE,
30 	HW_FEATURE_NEXT_INSTRUCTION_TYPE,
31 	HW_FEATURE_BRNDOUT_KILL,
32 	HW_FEATURE_WARPING,
33 	HW_FEATURE_V4,
34 	HW_FEATURE_FLUSH_REDUCTION,
35 	HW_FEATURE_PROTECTED_MODE,
36 	HW_FEATURE_COHERENCY_REG,
37 	HW_FEATURE_PROTECTED_DEBUG_MODE,
38 	HW_FEATURE_AARCH64_MMU,
39 	HW_FEATURE_TLS_HASHING,
40 	HW_FEATURE_THREAD_GROUP_SPLIT,
41 	HW_FEATURE_3BIT_EXT_RW_L2_MMU_CONFIG,
42 };
43 
44 #define hw_features_t600 (\
45 	BIT_ULL(HW_FEATURE_LD_ST_LEA_TEX) | \
46 	BIT_ULL(HW_FEATURE_LINEAR_FILTER_FLOAT) | \
47 	BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT) | \
48 	BIT_ULL(HW_FEATURE_V4))
49 
50 #define hw_features_t620 (\
51 	BIT_ULL(HW_FEATURE_LD_ST_LEA_TEX) | \
52 	BIT_ULL(HW_FEATURE_LINEAR_FILTER_FLOAT) | \
53 	BIT_ULL(HW_FEATURE_ATTR_AUTO_TYPE_INFERRAL) | \
54 	BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT) | \
55 	BIT_ULL(HW_FEATURE_V4))
56 
57 #define hw_features_t720 (\
58 	BIT_ULL(HW_FEATURE_32_BIT_UNIFORM_ADDRESS) | \
59 	BIT_ULL(HW_FEATURE_ATTR_AUTO_TYPE_INFERRAL) | \
60 	BIT_ULL(HW_FEATURE_INTERPIPE_REG_ALIASING) | \
61 	BIT_ULL(HW_FEATURE_OPTIMIZED_COVERAGE_MASK) | \
62 	BIT_ULL(HW_FEATURE_T7XX_PAIRING_RULES) | \
63 	BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT) | \
64 	BIT_ULL(HW_FEATURE_WORKGROUP_ROUND_MULTIPLE_OF_4) | \
65 	BIT_ULL(HW_FEATURE_WARPING) | \
66 	BIT_ULL(HW_FEATURE_V4))
67 
68 
69 #define hw_features_t760 (\
70 	BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \
71 	BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \
72 	BIT_ULL(HW_FEATURE_XAFFINITY) | \
73 	BIT_ULL(HW_FEATURE_32_BIT_UNIFORM_ADDRESS) | \
74 	BIT_ULL(HW_FEATURE_ATTR_AUTO_TYPE_INFERRAL) | \
75 	BIT_ULL(HW_FEATURE_BRNDOUT_CC) | \
76 	BIT_ULL(HW_FEATURE_LD_ST_LEA_TEX) | \
77 	BIT_ULL(HW_FEATURE_LD_ST_TILEBUFFER) | \
78 	BIT_ULL(HW_FEATURE_LINEAR_FILTER_FLOAT) | \
79 	BIT_ULL(HW_FEATURE_MRT) | \
80 	BIT_ULL(HW_FEATURE_MSAA_16X) | \
81 	BIT_ULL(HW_FEATURE_OUT_OF_ORDER_EXEC) | \
82 	BIT_ULL(HW_FEATURE_T7XX_PAIRING_RULES) | \
83 	BIT_ULL(HW_FEATURE_TEST4_DATUM_MODE) | \
84 	BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT))
85 
86 // T860
87 #define hw_features_t860 (\
88 	BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \
89 	BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \
90 	BIT_ULL(HW_FEATURE_XAFFINITY) | \
91 	BIT_ULL(HW_FEATURE_32_BIT_UNIFORM_ADDRESS) | \
92 	BIT_ULL(HW_FEATURE_ATTR_AUTO_TYPE_INFERRAL) | \
93 	BIT_ULL(HW_FEATURE_BRNDOUT_CC) | \
94 	BIT_ULL(HW_FEATURE_BRNDOUT_KILL) | \
95 	BIT_ULL(HW_FEATURE_LD_ST_LEA_TEX) | \
96 	BIT_ULL(HW_FEATURE_LD_ST_TILEBUFFER) | \
97 	BIT_ULL(HW_FEATURE_LINEAR_FILTER_FLOAT) | \
98 	BIT_ULL(HW_FEATURE_MRT) | \
99 	BIT_ULL(HW_FEATURE_MSAA_16X) | \
100 	BIT_ULL(HW_FEATURE_NEXT_INSTRUCTION_TYPE) | \
101 	BIT_ULL(HW_FEATURE_OUT_OF_ORDER_EXEC) | \
102 	BIT_ULL(HW_FEATURE_T7XX_PAIRING_RULES) | \
103 	BIT_ULL(HW_FEATURE_TEST4_DATUM_MODE) | \
104 	BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT))
105 
106 #define hw_features_t880 hw_features_t860
107 
108 #define hw_features_t830 (\
109 	BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \
110 	BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \
111 	BIT_ULL(HW_FEATURE_XAFFINITY) | \
112 	BIT_ULL(HW_FEATURE_WARPING) | \
113 	BIT_ULL(HW_FEATURE_INTERPIPE_REG_ALIASING) | \
114 	BIT_ULL(HW_FEATURE_32_BIT_UNIFORM_ADDRESS) | \
115 	BIT_ULL(HW_FEATURE_ATTR_AUTO_TYPE_INFERRAL) | \
116 	BIT_ULL(HW_FEATURE_BRNDOUT_CC) | \
117 	BIT_ULL(HW_FEATURE_BRNDOUT_KILL) | \
118 	BIT_ULL(HW_FEATURE_LD_ST_LEA_TEX) | \
119 	BIT_ULL(HW_FEATURE_LD_ST_TILEBUFFER) | \
120 	BIT_ULL(HW_FEATURE_LINEAR_FILTER_FLOAT) | \
121 	BIT_ULL(HW_FEATURE_MRT) | \
122 	BIT_ULL(HW_FEATURE_NEXT_INSTRUCTION_TYPE) | \
123 	BIT_ULL(HW_FEATURE_OUT_OF_ORDER_EXEC) | \
124 	BIT_ULL(HW_FEATURE_T7XX_PAIRING_RULES) | \
125 	BIT_ULL(HW_FEATURE_TEST4_DATUM_MODE) | \
126 	BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT))
127 
128 #define hw_features_t820 (\
129 	BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \
130 	BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \
131 	BIT_ULL(HW_FEATURE_XAFFINITY) | \
132 	BIT_ULL(HW_FEATURE_WARPING) | \
133 	BIT_ULL(HW_FEATURE_INTERPIPE_REG_ALIASING) | \
134 	BIT_ULL(HW_FEATURE_32_BIT_UNIFORM_ADDRESS) | \
135 	BIT_ULL(HW_FEATURE_ATTR_AUTO_TYPE_INFERRAL) | \
136 	BIT_ULL(HW_FEATURE_BRNDOUT_CC) | \
137 	BIT_ULL(HW_FEATURE_BRNDOUT_KILL) | \
138 	BIT_ULL(HW_FEATURE_LD_ST_LEA_TEX) | \
139 	BIT_ULL(HW_FEATURE_LD_ST_TILEBUFFER) | \
140 	BIT_ULL(HW_FEATURE_LINEAR_FILTER_FLOAT) | \
141 	BIT_ULL(HW_FEATURE_MRT) | \
142 	BIT_ULL(HW_FEATURE_NEXT_INSTRUCTION_TYPE) | \
143 	BIT_ULL(HW_FEATURE_OUT_OF_ORDER_EXEC) | \
144 	BIT_ULL(HW_FEATURE_T7XX_PAIRING_RULES) | \
145 	BIT_ULL(HW_FEATURE_TEST4_DATUM_MODE) | \
146 	BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT))
147 
148 #define hw_features_g71 (\
149 	BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \
150 	BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \
151 	BIT_ULL(HW_FEATURE_XAFFINITY) | \
152 	BIT_ULL(HW_FEATURE_WARPING) | \
153 	BIT_ULL(HW_FEATURE_INTERPIPE_REG_ALIASING) | \
154 	BIT_ULL(HW_FEATURE_32_BIT_UNIFORM_ADDRESS) | \
155 	BIT_ULL(HW_FEATURE_ATTR_AUTO_TYPE_INFERRAL) | \
156 	BIT_ULL(HW_FEATURE_BRNDOUT_CC) | \
157 	BIT_ULL(HW_FEATURE_BRNDOUT_KILL) | \
158 	BIT_ULL(HW_FEATURE_LD_ST_LEA_TEX) | \
159 	BIT_ULL(HW_FEATURE_LD_ST_TILEBUFFER) | \
160 	BIT_ULL(HW_FEATURE_LINEAR_FILTER_FLOAT) | \
161 	BIT_ULL(HW_FEATURE_MRT) | \
162 	BIT_ULL(HW_FEATURE_MSAA_16X) | \
163 	BIT_ULL(HW_FEATURE_NEXT_INSTRUCTION_TYPE) | \
164 	BIT_ULL(HW_FEATURE_OUT_OF_ORDER_EXEC) | \
165 	BIT_ULL(HW_FEATURE_T7XX_PAIRING_RULES) | \
166 	BIT_ULL(HW_FEATURE_TEST4_DATUM_MODE) | \
167 	BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT) | \
168 	BIT_ULL(HW_FEATURE_FLUSH_REDUCTION) | \
169 	BIT_ULL(HW_FEATURE_PROTECTED_MODE) | \
170 	BIT_ULL(HW_FEATURE_COHERENCY_REG))
171 
172 #define hw_features_g72 (\
173 	BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \
174 	BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \
175 	BIT_ULL(HW_FEATURE_XAFFINITY) | \
176 	BIT_ULL(HW_FEATURE_WARPING) | \
177 	BIT_ULL(HW_FEATURE_INTERPIPE_REG_ALIASING) | \
178 	BIT_ULL(HW_FEATURE_32_BIT_UNIFORM_ADDRESS) | \
179 	BIT_ULL(HW_FEATURE_ATTR_AUTO_TYPE_INFERRAL) | \
180 	BIT_ULL(HW_FEATURE_BRNDOUT_CC) | \
181 	BIT_ULL(HW_FEATURE_BRNDOUT_KILL) | \
182 	BIT_ULL(HW_FEATURE_LD_ST_LEA_TEX) | \
183 	BIT_ULL(HW_FEATURE_LD_ST_TILEBUFFER) | \
184 	BIT_ULL(HW_FEATURE_LINEAR_FILTER_FLOAT) | \
185 	BIT_ULL(HW_FEATURE_MRT) | \
186 	BIT_ULL(HW_FEATURE_MSAA_16X) | \
187 	BIT_ULL(HW_FEATURE_NEXT_INSTRUCTION_TYPE) | \
188 	BIT_ULL(HW_FEATURE_OUT_OF_ORDER_EXEC) | \
189 	BIT_ULL(HW_FEATURE_T7XX_PAIRING_RULES) | \
190 	BIT_ULL(HW_FEATURE_TEST4_DATUM_MODE) | \
191 	BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT) | \
192 	BIT_ULL(HW_FEATURE_FLUSH_REDUCTION) | \
193 	BIT_ULL(HW_FEATURE_PROTECTED_MODE) | \
194 	BIT_ULL(HW_FEATURE_PROTECTED_DEBUG_MODE) | \
195 	BIT_ULL(HW_FEATURE_COHERENCY_REG))
196 
197 #define hw_features_g51 (\
198 	BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \
199 	BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \
200 	BIT_ULL(HW_FEATURE_XAFFINITY) | \
201 	BIT_ULL(HW_FEATURE_WARPING) | \
202 	BIT_ULL(HW_FEATURE_INTERPIPE_REG_ALIASING) | \
203 	BIT_ULL(HW_FEATURE_32_BIT_UNIFORM_ADDRESS) | \
204 	BIT_ULL(HW_FEATURE_ATTR_AUTO_TYPE_INFERRAL) | \
205 	BIT_ULL(HW_FEATURE_BRNDOUT_CC) | \
206 	BIT_ULL(HW_FEATURE_BRNDOUT_KILL) | \
207 	BIT_ULL(HW_FEATURE_LD_ST_LEA_TEX) | \
208 	BIT_ULL(HW_FEATURE_LD_ST_TILEBUFFER) | \
209 	BIT_ULL(HW_FEATURE_LINEAR_FILTER_FLOAT) | \
210 	BIT_ULL(HW_FEATURE_MRT) | \
211 	BIT_ULL(HW_FEATURE_MSAA_16X) | \
212 	BIT_ULL(HW_FEATURE_NEXT_INSTRUCTION_TYPE) | \
213 	BIT_ULL(HW_FEATURE_OUT_OF_ORDER_EXEC) | \
214 	BIT_ULL(HW_FEATURE_T7XX_PAIRING_RULES) | \
215 	BIT_ULL(HW_FEATURE_TEST4_DATUM_MODE) | \
216 	BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT) | \
217 	BIT_ULL(HW_FEATURE_FLUSH_REDUCTION) | \
218 	BIT_ULL(HW_FEATURE_PROTECTED_MODE) | \
219 	BIT_ULL(HW_FEATURE_PROTECTED_DEBUG_MODE) | \
220 	BIT_ULL(HW_FEATURE_COHERENCY_REG))
221 
222 #define hw_features_g52 (\
223 	BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \
224 	BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \
225 	BIT_ULL(HW_FEATURE_XAFFINITY) | \
226 	BIT_ULL(HW_FEATURE_WARPING) | \
227 	BIT_ULL(HW_FEATURE_INTERPIPE_REG_ALIASING) | \
228 	BIT_ULL(HW_FEATURE_32_BIT_UNIFORM_ADDRESS) | \
229 	BIT_ULL(HW_FEATURE_ATTR_AUTO_TYPE_INFERRAL) | \
230 	BIT_ULL(HW_FEATURE_BRNDOUT_CC) | \
231 	BIT_ULL(HW_FEATURE_BRNDOUT_KILL) | \
232 	BIT_ULL(HW_FEATURE_LD_ST_LEA_TEX) | \
233 	BIT_ULL(HW_FEATURE_LD_ST_TILEBUFFER) | \
234 	BIT_ULL(HW_FEATURE_LINEAR_FILTER_FLOAT) | \
235 	BIT_ULL(HW_FEATURE_MRT) | \
236 	BIT_ULL(HW_FEATURE_MSAA_16X) | \
237 	BIT_ULL(HW_FEATURE_NEXT_INSTRUCTION_TYPE) | \
238 	BIT_ULL(HW_FEATURE_OUT_OF_ORDER_EXEC) | \
239 	BIT_ULL(HW_FEATURE_T7XX_PAIRING_RULES) | \
240 	BIT_ULL(HW_FEATURE_TEST4_DATUM_MODE) | \
241 	BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT) | \
242 	BIT_ULL(HW_FEATURE_FLUSH_REDUCTION) | \
243 	BIT_ULL(HW_FEATURE_PROTECTED_MODE) | \
244 	BIT_ULL(HW_FEATURE_PROTECTED_DEBUG_MODE) | \
245 	BIT_ULL(HW_FEATURE_COHERENCY_REG))
246 
247 #define hw_features_g76 (\
248 	BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \
249 	BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \
250 	BIT_ULL(HW_FEATURE_XAFFINITY) | \
251 	BIT_ULL(HW_FEATURE_WARPING) | \
252 	BIT_ULL(HW_FEATURE_INTERPIPE_REG_ALIASING) | \
253 	BIT_ULL(HW_FEATURE_32_BIT_UNIFORM_ADDRESS) | \
254 	BIT_ULL(HW_FEATURE_ATTR_AUTO_TYPE_INFERRAL) | \
255 	BIT_ULL(HW_FEATURE_BRNDOUT_CC) | \
256 	BIT_ULL(HW_FEATURE_BRNDOUT_KILL) | \
257 	BIT_ULL(HW_FEATURE_LD_ST_LEA_TEX) | \
258 	BIT_ULL(HW_FEATURE_LD_ST_TILEBUFFER) | \
259 	BIT_ULL(HW_FEATURE_LINEAR_FILTER_FLOAT) | \
260 	BIT_ULL(HW_FEATURE_MRT) | \
261 	BIT_ULL(HW_FEATURE_MSAA_16X) | \
262 	BIT_ULL(HW_FEATURE_NEXT_INSTRUCTION_TYPE) | \
263 	BIT_ULL(HW_FEATURE_OUT_OF_ORDER_EXEC) | \
264 	BIT_ULL(HW_FEATURE_T7XX_PAIRING_RULES) | \
265 	BIT_ULL(HW_FEATURE_TEST4_DATUM_MODE) | \
266 	BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT) | \
267 	BIT_ULL(HW_FEATURE_FLUSH_REDUCTION) | \
268 	BIT_ULL(HW_FEATURE_PROTECTED_MODE) | \
269 	BIT_ULL(HW_FEATURE_PROTECTED_DEBUG_MODE) | \
270 	BIT_ULL(HW_FEATURE_COHERENCY_REG) | \
271 	BIT_ULL(HW_FEATURE_AARCH64_MMU) | \
272 	BIT_ULL(HW_FEATURE_TLS_HASHING) | \
273 	BIT_ULL(HW_FEATURE_3BIT_EXT_RW_L2_MMU_CONFIG))
274 
275 #define hw_features_g31 (\
276 	BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \
277 	BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \
278 	BIT_ULL(HW_FEATURE_XAFFINITY) | \
279 	BIT_ULL(HW_FEATURE_WARPING) | \
280 	BIT_ULL(HW_FEATURE_INTERPIPE_REG_ALIASING) | \
281 	BIT_ULL(HW_FEATURE_32_BIT_UNIFORM_ADDRESS) | \
282 	BIT_ULL(HW_FEATURE_ATTR_AUTO_TYPE_INFERRAL) | \
283 	BIT_ULL(HW_FEATURE_BRNDOUT_CC) | \
284 	BIT_ULL(HW_FEATURE_BRNDOUT_KILL) | \
285 	BIT_ULL(HW_FEATURE_LD_ST_LEA_TEX) | \
286 	BIT_ULL(HW_FEATURE_LD_ST_TILEBUFFER) | \
287 	BIT_ULL(HW_FEATURE_LINEAR_FILTER_FLOAT) | \
288 	BIT_ULL(HW_FEATURE_MRT) | \
289 	BIT_ULL(HW_FEATURE_MSAA_16X) | \
290 	BIT_ULL(HW_FEATURE_NEXT_INSTRUCTION_TYPE) | \
291 	BIT_ULL(HW_FEATURE_OUT_OF_ORDER_EXEC) | \
292 	BIT_ULL(HW_FEATURE_T7XX_PAIRING_RULES) | \
293 	BIT_ULL(HW_FEATURE_TEST4_DATUM_MODE) | \
294 	BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT) | \
295 	BIT_ULL(HW_FEATURE_FLUSH_REDUCTION) | \
296 	BIT_ULL(HW_FEATURE_PROTECTED_MODE) | \
297 	BIT_ULL(HW_FEATURE_PROTECTED_DEBUG_MODE) | \
298 	BIT_ULL(HW_FEATURE_COHERENCY_REG) | \
299 	BIT_ULL(HW_FEATURE_AARCH64_MMU) | \
300 	BIT_ULL(HW_FEATURE_TLS_HASHING) | \
301 	BIT_ULL(HW_FEATURE_3BIT_EXT_RW_L2_MMU_CONFIG))
302 
panfrost_has_hw_feature(struct panfrost_device * pfdev,enum panfrost_hw_feature feat)303 static inline bool panfrost_has_hw_feature(struct panfrost_device *pfdev,
304 					   enum panfrost_hw_feature feat)
305 {
306 	return test_bit(feat, pfdev->features.hw_features);
307 }
308 
309 #endif
310