2 * S390 feature list generator
4 * Copyright IBM Corp. 2016, 2018
6 * Author(s): Michael Mueller <mimu@linux.vnet.ibm.com>
7 * David Hildenbrand <dahi@linux.vnet.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2 or (at
10 * your option) any later version. See the COPYING file in the top-level
17 #include "cpu_features_def.h"
19 #define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
21 /***** BEGIN FEATURE DEFS *****/
23 #define S390_FEAT_GROUP_PLO \
34 S390_FEAT_PLO_DCSGR, \
37 S390_FEAT_PLO_CSSTG, \
38 S390_FEAT_PLO_CSSTGR, \
39 S390_FEAT_PLO_CSSTX, \
40 S390_FEAT_PLO_CSDST, \
41 S390_FEAT_PLO_CSDSTG, \
42 S390_FEAT_PLO_CSDSTGR, \
43 S390_FEAT_PLO_CSDSTX, \
44 S390_FEAT_PLO_CSTST, \
45 S390_FEAT_PLO_CSTSTG, \
46 S390_FEAT_PLO_CSTSTGR, \
49 #define S390_FEAT_GROUP_TOD_CLOCK_STEERING \
50 S390_FEAT_TOD_CLOCK_STEERING, \
56 #define S390_FEAT_GROUP_GEN13_PTFF \
58 S390_FEAT_PTFF_QTOU, \
61 #define S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF \
62 S390_FEAT_PTFF_QSIE, \
63 S390_FEAT_PTFF_QTOUE, \
64 S390_FEAT_PTFF_STOE, \
67 #define S390_FEAT_GROUP_MSA \
70 S390_FEAT_KMAC_TDEA_128, \
71 S390_FEAT_KMAC_TDEA_192, \
73 S390_FEAT_KMC_TDEA_128, \
74 S390_FEAT_KMC_TDEA_192, \
76 S390_FEAT_KM_TDEA_128, \
77 S390_FEAT_KM_TDEA_192, \
78 S390_FEAT_KIMD_SHA_1, \
81 #define S390_FEAT_GROUP_MSA_EXT_1 \
82 S390_FEAT_KMC_AES_128, \
83 S390_FEAT_KM_AES_128, \
84 S390_FEAT_KIMD_SHA_256, \
85 S390_FEAT_KLMD_SHA_256
87 #define S390_FEAT_GROUP_MSA_EXT_2 \
88 S390_FEAT_KMC_AES_192, \
89 S390_FEAT_KMC_AES_256, \
91 S390_FEAT_KM_AES_192, \
92 S390_FEAT_KM_AES_256, \
93 S390_FEAT_KIMD_SHA_512, \
94 S390_FEAT_KLMD_SHA_512
96 #define S390_FEAT_GROUP_MSA_EXT_3 \
97 S390_FEAT_MSA_EXT_3, \
98 S390_FEAT_KMAC_EDEA, \
99 S390_FEAT_KMAC_ETDEA_128, \
100 S390_FEAT_KMAC_ETDEA_192, \
101 S390_FEAT_KMC_EAES_128, \
102 S390_FEAT_KMC_EAES_192, \
103 S390_FEAT_KMC_EAES_256, \
104 S390_FEAT_KMC_EDEA, \
105 S390_FEAT_KMC_ETDEA_128, \
106 S390_FEAT_KMC_ETDEA_192, \
108 S390_FEAT_KM_ETDEA_128, \
109 S390_FEAT_KM_ETDEA_192, \
110 S390_FEAT_KM_EAES_128, \
111 S390_FEAT_KM_EAES_192, \
112 S390_FEAT_KM_EAES_256, \
113 S390_FEAT_PCKMO_EDEA, \
114 S390_FEAT_PCKMO_ETDEA_128, \
115 S390_FEAT_PCKMO_ETDEA_256, \
116 S390_FEAT_PCKMO_AES_128, \
117 S390_FEAT_PCKMO_AES_192, \
118 S390_FEAT_PCKMO_AES_256
120 #define S390_FEAT_GROUP_MSA_EXT_4 \
121 S390_FEAT_MSA_EXT_4, \
122 S390_FEAT_KMAC_AES_128, \
123 S390_FEAT_KMAC_AES_192, \
124 S390_FEAT_KMAC_AES_256, \
125 S390_FEAT_KMAC_EAES_128, \
126 S390_FEAT_KMAC_EAES_192, \
127 S390_FEAT_KMAC_EAES_256, \
128 S390_FEAT_KM_XTS_AES_128, \
129 S390_FEAT_KM_XTS_AES_256, \
130 S390_FEAT_KM_XTS_EAES_128, \
131 S390_FEAT_KM_XTS_EAES_256, \
132 S390_FEAT_KIMD_GHASH, \
133 S390_FEAT_KMCTR_DEA, \
134 S390_FEAT_KMCTR_TDEA_128, \
135 S390_FEAT_KMCTR_TDEA_192, \
136 S390_FEAT_KMCTR_EDEA, \
137 S390_FEAT_KMCTR_ETDEA_128, \
138 S390_FEAT_KMCTR_ETDEA_192, \
139 S390_FEAT_KMCTR_AES_128, \
140 S390_FEAT_KMCTR_AES_192, \
141 S390_FEAT_KMCTR_AES_256, \
142 S390_FEAT_KMCTR_EAES_128, \
143 S390_FEAT_KMCTR_EAES_192, \
144 S390_FEAT_KMCTR_EAES_256, \
146 S390_FEAT_KMF_TDEA_128, \
147 S390_FEAT_KMF_TDEA_192, \
148 S390_FEAT_KMF_EDEA, \
149 S390_FEAT_KMF_ETDEA_128, \
150 S390_FEAT_KMF_ETDEA_192, \
151 S390_FEAT_KMF_AES_128, \
152 S390_FEAT_KMF_AES_192, \
153 S390_FEAT_KMF_AES_256, \
154 S390_FEAT_KMF_EAES_128, \
155 S390_FEAT_KMF_EAES_192, \
156 S390_FEAT_KMF_EAES_256, \
158 S390_FEAT_KMO_TDEA_128, \
159 S390_FEAT_KMO_TDEA_192, \
160 S390_FEAT_KMO_EDEA, \
161 S390_FEAT_KMO_ETDEA_128, \
162 S390_FEAT_KMO_ETDEA_192, \
163 S390_FEAT_KMO_AES_128, \
164 S390_FEAT_KMO_AES_192, \
165 S390_FEAT_KMO_AES_256, \
166 S390_FEAT_KMO_EAES_128, \
167 S390_FEAT_KMO_EAES_192, \
168 S390_FEAT_KMO_EAES_256, \
169 S390_FEAT_PCC_CMAC_DEA, \
170 S390_FEAT_PCC_CMAC_TDEA_128, \
171 S390_FEAT_PCC_CMAC_TDEA_192, \
172 S390_FEAT_PCC_CMAC_ETDEA_128, \
173 S390_FEAT_PCC_CMAC_ETDEA_192, \
174 S390_FEAT_PCC_CMAC_TDEA, \
175 S390_FEAT_PCC_CMAC_AES_128, \
176 S390_FEAT_PCC_CMAC_AES_192, \
177 S390_FEAT_PCC_CMAC_AES_256, \
178 S390_FEAT_PCC_CMAC_EAES_128, \
179 S390_FEAT_PCC_CMAC_EAES_192, \
180 S390_FEAT_PCC_CMAC_EAES_256, \
181 S390_FEAT_PCC_XTS_AES_128, \
182 S390_FEAT_PCC_XTS_AES_256, \
183 S390_FEAT_PCC_XTS_EAES_128, \
184 S390_FEAT_PCC_XTS_EAES_256
186 #define S390_FEAT_GROUP_MSA_EXT_5 \
187 S390_FEAT_MSA_EXT_5, \
188 S390_FEAT_PPNO_SHA_512_DRNG
190 #define S390_FEAT_GROUP_MSA_EXT_6 \
191 S390_FEAT_KIMD_SHA3_224, \
192 S390_FEAT_KIMD_SHA3_256, \
193 S390_FEAT_KIMD_SHA3_384, \
194 S390_FEAT_KIMD_SHA3_512, \
195 S390_FEAT_KIMD_SHAKE_128, \
196 S390_FEAT_KIMD_SHAKE_256, \
197 S390_FEAT_KLMD_SHA3_224, \
198 S390_FEAT_KLMD_SHA3_256, \
199 S390_FEAT_KLMD_SHA3_384, \
200 S390_FEAT_KLMD_SHA3_512, \
201 S390_FEAT_KLMD_SHAKE_128, \
202 S390_FEAT_KLMD_SHAKE_256
204 #define S390_FEAT_GROUP_MSA_EXT_7 \
205 S390_FEAT_PRNO_TRNG_QRTCR, \
208 #define S390_FEAT_GROUP_MSA_EXT_8 \
209 S390_FEAT_MSA_EXT_8, \
210 S390_FEAT_KMA_GCM_AES_128, \
211 S390_FEAT_KMA_GCM_AES_192, \
212 S390_FEAT_KMA_GCM_AES_256 , \
213 S390_FEAT_KMA_GCM_EAES_128, \
214 S390_FEAT_KMA_GCM_EAES_192, \
215 S390_FEAT_KMA_GCM_EAES_256
217 #define S390_FEAT_GROUP_MSA_EXT_9 \
218 S390_FEAT_MSA_EXT_9, \
219 S390_FEAT_KDSA_ECDSA_VERIFY_P256, \
220 S390_FEAT_KDSA_ECDSA_VERIFY_P384, \
221 S390_FEAT_KDSA_ECDSA_VERIFY_P512, \
222 S390_FEAT_KDSA_ECDSA_SIGN_P256, \
223 S390_FEAT_KDSA_ECDSA_SIGN_P384, \
224 S390_FEAT_KDSA_ECDSA_SIGN_P512, \
225 S390_FEAT_KDSA_EECDSA_SIGN_P256, \
226 S390_FEAT_KDSA_EECDSA_SIGN_P384, \
227 S390_FEAT_KDSA_EECDSA_SIGN_P512, \
228 S390_FEAT_KDSA_EDDSA_VERIFY_ED25519, \
229 S390_FEAT_KDSA_EDDSA_VERIFY_ED448, \
230 S390_FEAT_KDSA_EDDSA_SIGN_ED25519, \
231 S390_FEAT_KDSA_EDDSA_SIGN_ED448, \
232 S390_FEAT_KDSA_EEDDSA_SIGN_ED25519, \
233 S390_FEAT_KDSA_EEDDSA_SIGN_ED448, \
234 S390_FEAT_PCC_SCALAR_MULT_P256, \
235 S390_FEAT_PCC_SCALAR_MULT_P384, \
236 S390_FEAT_PCC_SCALAR_MULT_P512, \
237 S390_FEAT_PCC_SCALAR_MULT_ED25519, \
238 S390_FEAT_PCC_SCALAR_MULT_ED448, \
239 S390_FEAT_PCC_SCALAR_MULT_X25519, \
240 S390_FEAT_PCC_SCALAR_MULT_X448
242 #define S390_FEAT_GROUP_MSA_EXT_9_PCKMO \
243 S390_FEAT_PCKMO_ECC_P256, \
244 S390_FEAT_PCKMO_ECC_P384, \
245 S390_FEAT_PCKMO_ECC_P521, \
246 S390_FEAT_PCKMO_ECC_ED25519, \
247 S390_FEAT_PCKMO_ECC_ED448
249 #define S390_FEAT_GROUP_ENH_SORT \
250 S390_FEAT_ESORT_BASE, \
251 S390_FEAT_SORTL_SFLR, \
252 S390_FEAT_SORTL_SVLR, \
253 S390_FEAT_SORTL_32, \
254 S390_FEAT_SORTL_128, \
258 #define S390_FEAT_GROUP_DEFLATE_CONVERSION \
259 S390_FEAT_DEFLATE_BASE, \
260 S390_FEAT_DEFLATE_GHDT, \
261 S390_FEAT_DEFLATE_CMPR, \
262 S390_FEAT_DEFLATE_XPND, \
265 /* cpu feature groups */
266 static uint16_t group_PLO
[] = {
269 static uint16_t group_TOD_CLOCK_STEERING
[] = {
270 S390_FEAT_GROUP_TOD_CLOCK_STEERING
,
272 static uint16_t group_GEN13_PTFF
[] = {
273 S390_FEAT_GROUP_GEN13_PTFF
,
275 static uint16_t group_MULTIPLE_EPOCH_PTFF
[] = {
276 S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF
,
278 static uint16_t group_MSA
[] = {
281 static uint16_t group_MSA_EXT_1
[] = {
282 S390_FEAT_GROUP_MSA_EXT_1
,
284 static uint16_t group_MSA_EXT_2
[] = {
285 S390_FEAT_GROUP_MSA_EXT_2
,
287 static uint16_t group_MSA_EXT_3
[] = {
288 S390_FEAT_GROUP_MSA_EXT_3
,
290 static uint16_t group_MSA_EXT_4
[] = {
291 S390_FEAT_GROUP_MSA_EXT_4
,
293 static uint16_t group_MSA_EXT_5
[] = {
294 S390_FEAT_GROUP_MSA_EXT_5
,
296 static uint16_t group_MSA_EXT_6
[] = {
297 S390_FEAT_GROUP_MSA_EXT_6
,
299 static uint16_t group_MSA_EXT_7
[] = {
300 S390_FEAT_GROUP_MSA_EXT_7
,
302 static uint16_t group_MSA_EXT_8
[] = {
303 S390_FEAT_GROUP_MSA_EXT_8
,
306 static uint16_t group_MSA_EXT_9
[] = {
307 S390_FEAT_GROUP_MSA_EXT_9
,
310 static uint16_t group_MSA_EXT_9_PCKMO
[] = {
311 S390_FEAT_GROUP_MSA_EXT_9_PCKMO
,
314 static uint16_t group_ENH_SORT
[] = {
315 S390_FEAT_GROUP_ENH_SORT
,
318 static uint16_t group_DEFLATE_CONVERSION
[] = {
319 S390_FEAT_GROUP_DEFLATE_CONVERSION
,
322 /* Base features (in order of release)
323 * Only non-hypervisor managed features belong here.
324 * Base feature sets are static meaning they do not change in future QEMU
327 static uint16_t base_GEN7_GA1
[] = {
333 #define base_GEN7_GA2 EmptyFeat
334 #define base_GEN7_GA3 EmptyFeat
336 static uint16_t base_GEN8_GA1
[] = {
338 S390_FEAT_EXTENDED_TRANSLATION_2
,
340 S390_FEAT_LONG_DISPLACEMENT
,
341 S390_FEAT_LONG_DISPLACEMENT_FAST
,
342 S390_FEAT_HFP_MADDSUB
,
345 #define base_GEN8_GA2 EmptyFeat
346 #define base_GEN8_GA3 EmptyFeat
347 #define base_GEN8_GA4 EmptyFeat
348 #define base_GEN8_GA5 EmptyFeat
350 static uint16_t base_GEN9_GA1
[] = {
351 S390_FEAT_IDTE_SEGMENT
,
352 S390_FEAT_ASN_LX_REUSE
,
354 S390_FEAT_SENSE_RUNNING_STATUS
,
355 S390_FEAT_EXTENDED_IMMEDIATE
,
356 S390_FEAT_EXTENDED_TRANSLATION_3
,
357 S390_FEAT_HFP_UNNORMALIZED_EXT
,
359 S390_FEAT_STORE_CLOCK_FAST
,
360 S390_FEAT_GROUP_TOD_CLOCK_STEERING
,
365 #define base_GEN9_GA2 EmptyFeat
366 #define base_GEN9_GA3 EmptyFeat
368 static uint16_t base_GEN10_GA1
[] = {
369 S390_FEAT_CONDITIONAL_SSKE
,
370 S390_FEAT_PARSING_ENH
,
371 S390_FEAT_MOVE_WITH_OPTIONAL_SPEC
,
372 S390_FEAT_EXTRACT_CPU_TIME
,
373 S390_FEAT_COMPARE_AND_SWAP_AND_STORE
,
374 S390_FEAT_COMPARE_AND_SWAP_AND_STORE_2
,
375 S390_FEAT_GENERAL_INSTRUCTIONS_EXT
,
376 S390_FEAT_EXECUTE_EXT
,
377 S390_FEAT_FLOATING_POINT_SUPPPORT_ENH
,
382 #define base_GEN10_GA2 EmptyFeat
383 #define base_GEN10_GA3 EmptyFeat
385 static uint16_t base_GEN11_GA1
[] = {
386 S390_FEAT_NONQ_KEY_SETTING
,
387 S390_FEAT_ENHANCED_MONITOR
,
388 S390_FEAT_FLOATING_POINT_EXT
,
389 S390_FEAT_SET_PROGRAM_PARAMETERS
,
392 S390_FEAT_INTERLOCKED_ACCESS_2
,
395 #define base_GEN11_GA2 EmptyFeat
397 static uint16_t base_GEN12_GA1
[] = {
398 S390_FEAT_DFP_ZONED_CONVERSION
,
400 S390_FEAT_LOCAL_TLB_CLEARING
,
403 #define base_GEN12_GA2 EmptyFeat
405 static uint16_t base_GEN13_GA1
[] = {
407 S390_FEAT_DFP_PACKED_CONVERSION
,
408 S390_FEAT_GROUP_GEN13_PTFF
,
411 #define base_GEN13_GA2 EmptyFeat
413 static uint16_t base_GEN14_GA1
[] = {
414 S390_FEAT_ENTROPY_ENC_COMP
,
415 S390_FEAT_MISC_INSTRUCTION_EXT2
,
416 S390_FEAT_SEMAPHORE_ASSIST
,
417 S390_FEAT_TIME_SLICE_INSTRUMENTATION
,
418 S390_FEAT_ORDER_PRESERVING_COMPRESSION
,
421 #define base_GEN14_GA2 EmptyFeat
423 static uint16_t base_GEN15_GA1
[] = {
424 S390_FEAT_MISC_INSTRUCTION_EXT3
,
427 #define base_GEN16_GA1 EmptyFeat
429 /* Full features (in order of release)
430 * Automatically includes corresponding base features.
431 * Full features are all features this hardware supports even if kvm/QEMU do not
432 * support these features yet.
434 static uint16_t full_GEN7_GA1
[] = {
444 static uint16_t full_GEN7_GA2
[] = {
445 S390_FEAT_EXTENDED_TRANSLATION_2
,
448 static uint16_t full_GEN7_GA3
[] = {
449 S390_FEAT_LONG_DISPLACEMENT
,
453 static uint16_t full_GEN8_GA1
[] = {
455 S390_FEAT_SIE_64BSCAO
,
458 #define full_GEN8_GA2 EmptyFeat
460 static uint16_t full_GEN8_GA3
[] = {
461 S390_FEAT_ASN_LX_REUSE
,
462 S390_FEAT_EXTENDED_TRANSLATION_3
,
465 #define full_GEN8_GA4 EmptyFeat
466 #define full_GEN8_GA5 EmptyFeat
468 static uint16_t full_GEN9_GA1
[] = {
469 S390_FEAT_STORE_HYPERVISOR_INFO
,
470 S390_FEAT_GROUP_MSA_EXT_1
,
475 static uint16_t full_GEN9_GA2
[] = {
476 S390_FEAT_MOVE_WITH_OPTIONAL_SPEC
,
477 S390_FEAT_EXTRACT_CPU_TIME
,
478 S390_FEAT_COMPARE_AND_SWAP_AND_STORE
,
479 S390_FEAT_FLOATING_POINT_SUPPPORT_ENH
,
483 static uint16_t full_GEN9_GA3
[] = {
484 S390_FEAT_CONDITIONAL_SSKE
,
488 static uint16_t full_GEN10_GA1
[] = {
490 S390_FEAT_CONFIGURATION_TOPOLOGY
,
491 S390_FEAT_GROUP_MSA_EXT_2
,
494 S390_FEAT_SIE_SIGPIF
,
497 static uint16_t full_GEN10_GA2
[] = {
498 S390_FEAT_SET_PROGRAM_PARAMETERS
,
502 static uint16_t full_GEN10_GA3
[] = {
503 S390_FEAT_GROUP_MSA_EXT_3
,
506 static uint16_t full_GEN11_GA1
[] = {
507 S390_FEAT_IPTE_RANGE
,
508 S390_FEAT_ACCESS_EXCEPTION_FS_INDICATION
,
509 S390_FEAT_GROUP_MSA_EXT_4
,
512 #define full_GEN11_GA2 EmptyFeat
514 static uint16_t full_GEN12_GA1
[] = {
515 S390_FEAT_CONSTRAINT_TRANSACTIONAL_EXE
,
516 S390_FEAT_TRANSACTIONAL_EXE
,
517 S390_FEAT_RUNTIME_INSTRUMENTATION
,
519 S390_FEAT_ADAPTER_EVENT_NOTIFICATION
,
520 S390_FEAT_ADAPTER_INT_SUPPRESSION
,
522 S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2
,
523 S390_FEAT_AP_QUERY_CONFIG_INFO
,
524 S390_FEAT_AP_QUEUE_INTERRUPT_CONTROL
,
525 S390_FEAT_AP_FACILITIES_TEST
,
527 S390_FEAT_EXTENDED_LENGTH_SCCB
,
531 static uint16_t full_GEN12_GA2
[] = {
532 S390_FEAT_GROUP_MSA_EXT_5
,
535 static uint16_t full_GEN13_GA1
[] = {
539 #define full_GEN13_GA2 EmptyFeat
541 static uint16_t full_GEN14_GA1
[] = {
542 S390_FEAT_INSTRUCTION_EXEC_PROT
,
543 S390_FEAT_GUARDED_STORAGE
,
544 S390_FEAT_VECTOR_PACKED_DECIMAL
,
545 S390_FEAT_VECTOR_ENH
,
546 S390_FEAT_MULTIPLE_EPOCH
,
547 S390_FEAT_TEST_PENDING_EXT_INTERRUPTION
,
548 S390_FEAT_INSERT_REFERENCE_BITS_MULT
,
549 S390_FEAT_GROUP_MSA_EXT_6
,
550 S390_FEAT_GROUP_MSA_EXT_7
,
551 S390_FEAT_GROUP_MSA_EXT_8
,
556 S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF
,
559 #define full_GEN14_GA2 EmptyFeat
561 static uint16_t full_GEN15_GA1
[] = {
562 S390_FEAT_VECTOR_ENH2
,
563 S390_FEAT_GROUP_ENH_SORT
,
564 S390_FEAT_GROUP_DEFLATE_CONVERSION
,
565 S390_FEAT_VECTOR_PACKED_DECIMAL_ENH
,
566 S390_FEAT_GROUP_MSA_EXT_9
,
567 S390_FEAT_GROUP_MSA_EXT_9_PCKMO
,
572 static uint16_t full_GEN16_GA1
[] = {
574 S390_FEAT_VECTOR_PACKED_DECIMAL_ENH2
,
581 /* Default features (in order of release)
582 * Automatically includes corresponding base features.
583 * Default features are all features this version of QEMU supports for this
584 * hardware model. Default feature sets can grow with new QEMU releases.
586 #define default_GEN7_GA1 EmptyFeat
587 #define default_GEN7_GA2 EmptyFeat
588 #define default_GEN7_GA3 EmptyFeat
589 #define default_GEN8_GA1 EmptyFeat
590 #define default_GEN8_GA2 EmptyFeat
591 #define default_GEN8_GA3 EmptyFeat
592 #define default_GEN8_GA4 EmptyFeat
593 #define default_GEN8_GA5 EmptyFeat
595 static uint16_t default_GEN9_GA1
[] = {
596 S390_FEAT_STORE_HYPERVISOR_INFO
,
597 S390_FEAT_GROUP_MSA_EXT_1
,
601 #define default_GEN9_GA2 EmptyFeat
602 #define default_GEN9_GA3 EmptyFeat
604 static uint16_t default_GEN10_GA1
[] = {
606 S390_FEAT_GROUP_MSA_EXT_2
,
609 #define default_GEN10_GA2 EmptyFeat
610 #define default_GEN10_GA3 EmptyFeat
612 static uint16_t default_GEN11_GA1
[] = {
613 S390_FEAT_GROUP_MSA_EXT_3
,
614 S390_FEAT_IPTE_RANGE
,
615 S390_FEAT_ACCESS_EXCEPTION_FS_INDICATION
,
616 S390_FEAT_GROUP_MSA_EXT_4
,
621 #define default_GEN11_GA2 EmptyFeat
623 static uint16_t default_GEN12_GA1
[] = {
624 S390_FEAT_CONSTRAINT_TRANSACTIONAL_EXE
,
625 S390_FEAT_TRANSACTIONAL_EXE
,
626 S390_FEAT_RUNTIME_INSTRUMENTATION
,
628 S390_FEAT_ADAPTER_EVENT_NOTIFICATION
,
631 S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2
,
634 #define default_GEN12_GA2 EmptyFeat
636 static uint16_t default_GEN13_GA1
[] = {
637 S390_FEAT_GROUP_MSA_EXT_5
,
641 #define default_GEN13_GA2 EmptyFeat
643 static uint16_t default_GEN14_GA1
[] = {
644 S390_FEAT_INSTRUCTION_EXEC_PROT
,
645 S390_FEAT_GUARDED_STORAGE
,
646 S390_FEAT_VECTOR_PACKED_DECIMAL
,
647 S390_FEAT_VECTOR_ENH
,
648 S390_FEAT_GROUP_MSA_EXT_6
,
649 S390_FEAT_GROUP_MSA_EXT_7
,
650 S390_FEAT_GROUP_MSA_EXT_8
,
651 S390_FEAT_MULTIPLE_EPOCH
,
652 S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF
,
655 #define default_GEN14_GA2 EmptyFeat
657 static uint16_t default_GEN15_GA1
[] = {
658 S390_FEAT_VECTOR_ENH2
,
659 S390_FEAT_GROUP_DEFLATE_CONVERSION
,
660 S390_FEAT_VECTOR_PACKED_DECIMAL_ENH
,
661 S390_FEAT_GROUP_MSA_EXT_9
,
662 S390_FEAT_GROUP_MSA_EXT_9_PCKMO
,
666 static uint16_t default_GEN16_GA1
[] = {
668 S390_FEAT_VECTOR_PACKED_DECIMAL_ENH2
,
674 /* QEMU (CPU model) features */
676 static uint16_t qemu_V2_11
[] = {
682 static uint16_t qemu_V3_1
[] = {
684 S390_FEAT_IDTE_SEGMENT
,
686 S390_FEAT_SENSE_RUNNING_STATUS
,
687 S390_FEAT_EXTENDED_TRANSLATION_2
,
689 S390_FEAT_LONG_DISPLACEMENT
,
690 S390_FEAT_LONG_DISPLACEMENT_FAST
,
691 S390_FEAT_EXTENDED_IMMEDIATE
,
692 S390_FEAT_EXTENDED_TRANSLATION_3
,
694 S390_FEAT_STORE_CLOCK_FAST
,
695 S390_FEAT_MOVE_WITH_OPTIONAL_SPEC
,
697 S390_FEAT_EXTRACT_CPU_TIME
,
698 S390_FEAT_COMPARE_AND_SWAP_AND_STORE
,
699 S390_FEAT_COMPARE_AND_SWAP_AND_STORE_2
,
700 S390_FEAT_GENERAL_INSTRUCTIONS_EXT
,
701 S390_FEAT_EXECUTE_EXT
,
702 S390_FEAT_SET_PROGRAM_PARAMETERS
,
703 S390_FEAT_FLOATING_POINT_SUPPPORT_ENH
,
706 S390_FEAT_LOCAL_TLB_CLEARING
,
707 S390_FEAT_INTERLOCKED_ACCESS_2
,
708 S390_FEAT_ADAPTER_EVENT_NOTIFICATION
,
709 S390_FEAT_ADAPTER_INT_SUPPRESSION
,
714 static uint16_t qemu_V4_0
[] = {
716 * Only BFP bits are implemented (HFP, DFP, PFPO and DIVIDE TO INTEGER not
719 S390_FEAT_FLOATING_POINT_EXT
,
723 static uint16_t qemu_V4_1
[] = {
728 static uint16_t qemu_V6_0
[] = {
729 S390_FEAT_ACCESS_EXCEPTION_FS_INDICATION
,
730 S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2
,
734 static uint16_t qemu_LATEST
[] = {
735 S390_FEAT_INSTRUCTION_EXEC_PROT
,
736 S390_FEAT_MISC_INSTRUCTION_EXT2
,
738 S390_FEAT_VECTOR_ENH
,
741 /* add all new definitions before this point */
742 static uint16_t qemu_MAX
[] = {
743 /* generates a dependency warning, leave it out for now */
747 /****** END FEATURE DEFS ******/
749 #define _YEARS "2016"
750 #define _NAME_H "TARGET_S390X_GEN_FEATURES_H"
752 #define CPU_FEAT_INITIALIZER(_name) \
754 .name = "S390_FEAT_LIST_" #_name, \
756 { .data = base_##_name, \
757 .len = ARRAY_SIZE(base_##_name) }, \
759 { .data = default_##_name, \
760 .len = ARRAY_SIZE(default_##_name) }, \
762 { .data = full_##_name, \
763 .len = ARRAY_SIZE(full_##_name) }, \
766 typedef struct BitSpec
{
774 BitSpec default_bits
;
778 static uint16_t EmptyFeat
[] = {};
780 /*******************************
781 * processor GA series
782 *******************************/
783 static CpuFeatDefSpec CpuFeatDef
[] = {
784 CPU_FEAT_INITIALIZER(GEN7_GA1
),
785 CPU_FEAT_INITIALIZER(GEN7_GA2
),
786 CPU_FEAT_INITIALIZER(GEN7_GA3
),
787 CPU_FEAT_INITIALIZER(GEN8_GA1
),
788 CPU_FEAT_INITIALIZER(GEN8_GA2
),
789 CPU_FEAT_INITIALIZER(GEN8_GA3
),
790 CPU_FEAT_INITIALIZER(GEN8_GA4
),
791 CPU_FEAT_INITIALIZER(GEN8_GA5
),
792 CPU_FEAT_INITIALIZER(GEN9_GA1
),
793 CPU_FEAT_INITIALIZER(GEN9_GA2
),
794 CPU_FEAT_INITIALIZER(GEN9_GA3
),
795 CPU_FEAT_INITIALIZER(GEN10_GA1
),
796 CPU_FEAT_INITIALIZER(GEN10_GA2
),
797 CPU_FEAT_INITIALIZER(GEN10_GA3
),
798 CPU_FEAT_INITIALIZER(GEN11_GA1
),
799 CPU_FEAT_INITIALIZER(GEN11_GA2
),
800 CPU_FEAT_INITIALIZER(GEN12_GA1
),
801 CPU_FEAT_INITIALIZER(GEN12_GA2
),
802 CPU_FEAT_INITIALIZER(GEN13_GA1
),
803 CPU_FEAT_INITIALIZER(GEN13_GA2
),
804 CPU_FEAT_INITIALIZER(GEN14_GA1
),
805 CPU_FEAT_INITIALIZER(GEN14_GA2
),
806 CPU_FEAT_INITIALIZER(GEN15_GA1
),
807 CPU_FEAT_INITIALIZER(GEN16_GA1
),
810 #define FEAT_GROUP_INITIALIZER(_name) \
812 .name = "S390_FEAT_GROUP_LIST_" #_name, \
813 .enum_name = "S390_FEAT_GROUP_" #_name, \
815 { .data = group_##_name, \
816 .len = ARRAY_SIZE(group_##_name) }, \
821 const char *enum_name
;
825 /*******************************
827 *******************************/
828 static FeatGroupDefSpec FeatGroupDef
[] = {
829 FEAT_GROUP_INITIALIZER(PLO
),
830 FEAT_GROUP_INITIALIZER(TOD_CLOCK_STEERING
),
831 FEAT_GROUP_INITIALIZER(GEN13_PTFF
),
832 FEAT_GROUP_INITIALIZER(MSA
),
833 FEAT_GROUP_INITIALIZER(MSA_EXT_1
),
834 FEAT_GROUP_INITIALIZER(MSA_EXT_2
),
835 FEAT_GROUP_INITIALIZER(MSA_EXT_3
),
836 FEAT_GROUP_INITIALIZER(MSA_EXT_4
),
837 FEAT_GROUP_INITIALIZER(MSA_EXT_5
),
838 FEAT_GROUP_INITIALIZER(MSA_EXT_6
),
839 FEAT_GROUP_INITIALIZER(MSA_EXT_7
),
840 FEAT_GROUP_INITIALIZER(MSA_EXT_8
),
841 FEAT_GROUP_INITIALIZER(MSA_EXT_9
),
842 FEAT_GROUP_INITIALIZER(MSA_EXT_9_PCKMO
),
843 FEAT_GROUP_INITIALIZER(MULTIPLE_EPOCH_PTFF
),
844 FEAT_GROUP_INITIALIZER(ENH_SORT
),
845 FEAT_GROUP_INITIALIZER(DEFLATE_CONVERSION
),
848 #define QEMU_FEAT_INITIALIZER(_name) \
850 .name = "S390_FEAT_LIST_QEMU_" #_name, \
852 { .data = qemu_##_name, \
853 .len = ARRAY_SIZE(qemu_##_name) }, \
856 /*******************************
857 * QEMU (CPU model) features
858 *******************************/
859 static FeatGroupDefSpec QemuFeatDef
[] = {
860 QEMU_FEAT_INITIALIZER(V2_11
),
861 QEMU_FEAT_INITIALIZER(V3_1
),
862 QEMU_FEAT_INITIALIZER(V4_0
),
863 QEMU_FEAT_INITIALIZER(V4_1
),
864 QEMU_FEAT_INITIALIZER(V6_0
),
865 QEMU_FEAT_INITIALIZER(LATEST
),
866 QEMU_FEAT_INITIALIZER(MAX
),
870 static void set_bits(uint64_t list
[], BitSpec bits
)
874 for (i
= 0; i
< bits
.len
; i
++) {
875 list
[bits
.data
[i
] / 64] |= 1ULL << (bits
.data
[i
] % 64);
879 static inline void clear_bit(uint64_t list
[], unsigned long nr
)
881 list
[nr
/ 64] &= ~(1ULL << (nr
% 64));
884 static void print_feature_defs(void)
886 uint64_t base_feat
[S390_FEAT_MAX
/ 64 + 1] = {};
887 uint64_t default_feat
[S390_FEAT_MAX
/ 64 + 1] = {};
888 uint64_t full_feat
[S390_FEAT_MAX
/ 64 + 1] = {};
891 printf("\n/* CPU model feature list data */\n");
893 for (i
= 0; i
< ARRAY_SIZE(CpuFeatDef
); i
++) {
894 /* With gen15 CSSKE and BPB are deprecated */
895 if (strcmp(CpuFeatDef
[i
].name
, "S390_FEAT_LIST_GEN15_GA1") == 0) {
896 clear_bit(base_feat
, S390_FEAT_CONDITIONAL_SSKE
);
897 clear_bit(default_feat
, S390_FEAT_CONDITIONAL_SSKE
);
898 clear_bit(default_feat
, S390_FEAT_BPB
);
900 set_bits(base_feat
, CpuFeatDef
[i
].base_bits
);
901 /* add the base to the default features */
902 set_bits(default_feat
, CpuFeatDef
[i
].base_bits
);
903 set_bits(default_feat
, CpuFeatDef
[i
].default_bits
);
904 /* add the base to the full features */
905 set_bits(full_feat
, CpuFeatDef
[i
].base_bits
);
906 set_bits(full_feat
, CpuFeatDef
[i
].full_bits
);
908 printf("#define %s_BASE\t", CpuFeatDef
[i
].name
);
909 for (j
= 0; j
< ARRAY_SIZE(base_feat
); j
++) {
910 printf("0x%016"PRIx64
"ULL", base_feat
[j
]);
911 if (j
< ARRAY_SIZE(base_feat
) - 1) {
917 printf("#define %s_DEFAULT\t", CpuFeatDef
[i
].name
);
918 for (j
= 0; j
< ARRAY_SIZE(default_feat
); j
++) {
919 printf("0x%016"PRIx64
"ULL", default_feat
[j
]);
920 if (j
< ARRAY_SIZE(default_feat
) - 1) {
926 printf("#define %s_FULL\t\t", CpuFeatDef
[i
].name
);
927 for (j
= 0; j
< ARRAY_SIZE(full_feat
); j
++) {
928 printf("0x%016"PRIx64
"ULL", full_feat
[j
]);
929 if (j
< ARRAY_SIZE(full_feat
) - 1) {
938 static void print_qemu_feature_defs(void)
940 uint64_t feat
[S390_FEAT_MAX
/ 64 + 1] = {};
943 printf("\n/* QEMU (CPU model) feature list data */\n");
945 /* for now we assume that we only add new features */
946 for (i
= 0; i
< ARRAY_SIZE(QemuFeatDef
); i
++) {
947 set_bits(feat
, QemuFeatDef
[i
].bits
);
949 printf("#define %s\t", QemuFeatDef
[i
].name
);
950 for (j
= 0; j
< ARRAY_SIZE(feat
); j
++) {
951 printf("0x%016"PRIx64
"ULL", feat
[j
]);
952 if (j
< ARRAY_SIZE(feat
) - 1) {
961 static void print_feature_group_defs(void)
965 printf("\n/* CPU feature group list data */\n");
967 for (i
= 0; i
< ARRAY_SIZE(FeatGroupDef
); i
++) {
968 uint64_t feat
[S390_FEAT_MAX
/ 64 + 1] = {};
970 set_bits(feat
, FeatGroupDef
[i
].bits
);
971 printf("#define %s\t", FeatGroupDef
[i
].name
);
972 for (j
= 0; j
< ARRAY_SIZE(feat
); j
++) {
973 printf("0x%016"PRIx64
"ULL", feat
[j
]);
974 if (j
< ARRAY_SIZE(feat
) - 1) {
983 static void print_feature_group_enum_type(void)
987 printf("\n/* CPU feature group enum type */\n"
989 for (i
= 0; i
< ARRAY_SIZE(FeatGroupDef
); i
++) {
990 printf("\t%s,\n", FeatGroupDef
[i
].enum_name
);
992 printf("\tS390_FEAT_GROUP_MAX,\n"
993 "} S390FeatGroup;\n");
996 int main(int argc
, char *argv
[])
999 " * AUTOMATICALLY GENERATED, DO NOT MODIFY HERE, EDIT\n"
1000 " * SOURCE FILE \"%s\" INSTEAD.\n"
1002 " * Copyright %s IBM Corp.\n"
1004 " * This work is licensed under the terms of the GNU GPL, "
1005 "version 2 or (at\n * your option) any later version. See "
1006 "the COPYING file in the top-level\n * directory.\n"
1008 "#ifndef %s\n#define %s\n", __FILE__
, _YEARS
, _NAME_H
, _NAME_H
);
1009 print_feature_defs();
1010 print_feature_group_defs();
1011 print_qemu_feature_defs();
1012 print_feature_group_enum_type();
1013 printf("\n#endif\n");