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
16 #include "cpu_features_def.h"
18 #define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
20 /***** BEGIN FEATURE DEFS *****/
22 #define S390_FEAT_GROUP_PLO \
33 S390_FEAT_PLO_DCSGR, \
36 S390_FEAT_PLO_CSSTG, \
37 S390_FEAT_PLO_CSSTGR, \
38 S390_FEAT_PLO_CSSTX, \
39 S390_FEAT_PLO_CSDST, \
40 S390_FEAT_PLO_CSDSTG, \
41 S390_FEAT_PLO_CSDSTGR, \
42 S390_FEAT_PLO_CSDSTX, \
43 S390_FEAT_PLO_CSTST, \
44 S390_FEAT_PLO_CSTSTG, \
45 S390_FEAT_PLO_CSTSTGR, \
48 #define S390_FEAT_GROUP_TOD_CLOCK_STEERING \
49 S390_FEAT_TOD_CLOCK_STEERING, \
55 #define S390_FEAT_GROUP_GEN13_PTFF \
57 S390_FEAT_PTFF_QTOU, \
60 #define S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF \
61 S390_FEAT_PTFF_QSIE, \
62 S390_FEAT_PTFF_QTOUE, \
63 S390_FEAT_PTFF_STOE, \
66 #define S390_FEAT_GROUP_MSA \
69 S390_FEAT_KMAC_TDEA_128, \
70 S390_FEAT_KMAC_TDEA_192, \
72 S390_FEAT_KMC_TDEA_128, \
73 S390_FEAT_KMC_TDEA_192, \
75 S390_FEAT_KM_TDEA_128, \
76 S390_FEAT_KM_TDEA_192, \
77 S390_FEAT_KIMD_SHA_1, \
80 #define S390_FEAT_GROUP_MSA_EXT_1 \
81 S390_FEAT_KMC_AES_128, \
82 S390_FEAT_KM_AES_128, \
83 S390_FEAT_KIMD_SHA_256, \
84 S390_FEAT_KLMD_SHA_256
86 #define S390_FEAT_GROUP_MSA_EXT_2 \
87 S390_FEAT_KMC_AES_192, \
88 S390_FEAT_KMC_AES_256, \
90 S390_FEAT_KM_AES_192, \
91 S390_FEAT_KM_AES_256, \
92 S390_FEAT_KIMD_SHA_512, \
93 S390_FEAT_KLMD_SHA_512
95 #define S390_FEAT_GROUP_MSA_EXT_3 \
96 S390_FEAT_MSA_EXT_3, \
97 S390_FEAT_KMAC_EDEA, \
98 S390_FEAT_KMAC_ETDEA_128, \
99 S390_FEAT_KMAC_ETDEA_192, \
100 S390_FEAT_KMC_EAES_128, \
101 S390_FEAT_KMC_EAES_192, \
102 S390_FEAT_KMC_EAES_256, \
103 S390_FEAT_KMC_EDEA, \
104 S390_FEAT_KMC_ETDEA_128, \
105 S390_FEAT_KMC_ETDEA_192, \
107 S390_FEAT_KM_ETDEA_128, \
108 S390_FEAT_KM_ETDEA_192, \
109 S390_FEAT_KM_EAES_128, \
110 S390_FEAT_KM_EAES_192, \
111 S390_FEAT_KM_EAES_256, \
112 S390_FEAT_PCKMO_EDEA, \
113 S390_FEAT_PCKMO_ETDEA_128, \
114 S390_FEAT_PCKMO_ETDEA_256, \
115 S390_FEAT_PCKMO_AES_128, \
116 S390_FEAT_PCKMO_AES_192, \
117 S390_FEAT_PCKMO_AES_256
119 #define S390_FEAT_GROUP_MSA_EXT_4 \
120 S390_FEAT_MSA_EXT_4, \
121 S390_FEAT_KMAC_AES_128, \
122 S390_FEAT_KMAC_AES_192, \
123 S390_FEAT_KMAC_AES_256, \
124 S390_FEAT_KMAC_EAES_128, \
125 S390_FEAT_KMAC_EAES_192, \
126 S390_FEAT_KMAC_EAES_256, \
127 S390_FEAT_KM_XTS_AES_128, \
128 S390_FEAT_KM_XTS_AES_256, \
129 S390_FEAT_KM_XTS_EAES_128, \
130 S390_FEAT_KM_XTS_EAES_256, \
131 S390_FEAT_KIMD_GHASH, \
132 S390_FEAT_KMCTR_DEA, \
133 S390_FEAT_KMCTR_TDEA_128, \
134 S390_FEAT_KMCTR_TDEA_192, \
135 S390_FEAT_KMCTR_EDEA, \
136 S390_FEAT_KMCTR_ETDEA_128, \
137 S390_FEAT_KMCTR_ETDEA_192, \
138 S390_FEAT_KMCTR_AES_128, \
139 S390_FEAT_KMCTR_AES_192, \
140 S390_FEAT_KMCTR_AES_256, \
141 S390_FEAT_KMCTR_EAES_128, \
142 S390_FEAT_KMCTR_EAES_192, \
143 S390_FEAT_KMCTR_EAES_256, \
145 S390_FEAT_KMF_TDEA_128, \
146 S390_FEAT_KMF_TDEA_192, \
147 S390_FEAT_KMF_EDEA, \
148 S390_FEAT_KMF_ETDEA_128, \
149 S390_FEAT_KMF_ETDEA_192, \
150 S390_FEAT_KMF_AES_128, \
151 S390_FEAT_KMF_AES_192, \
152 S390_FEAT_KMF_AES_256, \
153 S390_FEAT_KMF_EAES_128, \
154 S390_FEAT_KMF_EAES_192, \
155 S390_FEAT_KMF_EAES_256, \
157 S390_FEAT_KMO_TDEA_128, \
158 S390_FEAT_KMO_TDEA_192, \
159 S390_FEAT_KMO_EDEA, \
160 S390_FEAT_KMO_ETDEA_128, \
161 S390_FEAT_KMO_ETDEA_192, \
162 S390_FEAT_KMO_AES_128, \
163 S390_FEAT_KMO_AES_192, \
164 S390_FEAT_KMO_AES_256, \
165 S390_FEAT_KMO_EAES_128, \
166 S390_FEAT_KMO_EAES_192, \
167 S390_FEAT_KMO_EAES_256, \
168 S390_FEAT_PCC_CMAC_DEA, \
169 S390_FEAT_PCC_CMAC_TDEA_128, \
170 S390_FEAT_PCC_CMAC_TDEA_192, \
171 S390_FEAT_PCC_CMAC_ETDEA_128, \
172 S390_FEAT_PCC_CMAC_ETDEA_192, \
173 S390_FEAT_PCC_CMAC_TDEA, \
174 S390_FEAT_PCC_CMAC_AES_128, \
175 S390_FEAT_PCC_CMAC_AES_192, \
176 S390_FEAT_PCC_CMAC_AES_256, \
177 S390_FEAT_PCC_CMAC_EAES_128, \
178 S390_FEAT_PCC_CMAC_EAES_192, \
179 S390_FEAT_PCC_CMAC_EAES_256, \
180 S390_FEAT_PCC_XTS_AES_128, \
181 S390_FEAT_PCC_XTS_AES_256, \
182 S390_FEAT_PCC_XTS_EAES_128, \
183 S390_FEAT_PCC_XTS_EAES_256
185 #define S390_FEAT_GROUP_MSA_EXT_5 \
186 S390_FEAT_MSA_EXT_5, \
187 S390_FEAT_PPNO_SHA_512_DRNG
189 #define S390_FEAT_GROUP_MSA_EXT_6 \
190 S390_FEAT_KIMD_SHA3_224, \
191 S390_FEAT_KIMD_SHA3_256, \
192 S390_FEAT_KIMD_SHA3_384, \
193 S390_FEAT_KIMD_SHA3_512, \
194 S390_FEAT_KIMD_SHAKE_128, \
195 S390_FEAT_KIMD_SHAKE_256, \
196 S390_FEAT_KLMD_SHA3_224, \
197 S390_FEAT_KLMD_SHA3_256, \
198 S390_FEAT_KLMD_SHA3_384, \
199 S390_FEAT_KLMD_SHA3_512, \
200 S390_FEAT_KLMD_SHAKE_128, \
201 S390_FEAT_KLMD_SHAKE_256
203 #define S390_FEAT_GROUP_MSA_EXT_7 \
204 S390_FEAT_PRNO_TRNG_QRTCR, \
207 #define S390_FEAT_GROUP_MSA_EXT_8 \
208 S390_FEAT_MSA_EXT_8, \
209 S390_FEAT_KMA_GCM_AES_128, \
210 S390_FEAT_KMA_GCM_AES_192, \
211 S390_FEAT_KMA_GCM_AES_256 , \
212 S390_FEAT_KMA_GCM_EAES_128, \
213 S390_FEAT_KMA_GCM_EAES_192, \
214 S390_FEAT_KMA_GCM_EAES_256
216 /* cpu feature groups */
217 static uint16_t group_PLO
[] = {
220 static uint16_t group_TOD_CLOCK_STEERING
[] = {
221 S390_FEAT_GROUP_TOD_CLOCK_STEERING
,
223 static uint16_t group_GEN13_PTFF
[] = {
224 S390_FEAT_GROUP_GEN13_PTFF
,
226 static uint16_t group_MULTIPLE_EPOCH_PTFF
[] = {
227 S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF
,
229 static uint16_t group_MSA
[] = {
232 static uint16_t group_MSA_EXT_1
[] = {
233 S390_FEAT_GROUP_MSA_EXT_1
,
235 static uint16_t group_MSA_EXT_2
[] = {
236 S390_FEAT_GROUP_MSA_EXT_2
,
238 static uint16_t group_MSA_EXT_3
[] = {
239 S390_FEAT_GROUP_MSA_EXT_3
,
241 static uint16_t group_MSA_EXT_4
[] = {
242 S390_FEAT_GROUP_MSA_EXT_4
,
244 static uint16_t group_MSA_EXT_5
[] = {
245 S390_FEAT_GROUP_MSA_EXT_5
,
247 static uint16_t group_MSA_EXT_6
[] = {
248 S390_FEAT_GROUP_MSA_EXT_6
,
250 static uint16_t group_MSA_EXT_7
[] = {
251 S390_FEAT_GROUP_MSA_EXT_7
,
253 static uint16_t group_MSA_EXT_8
[] = {
254 S390_FEAT_GROUP_MSA_EXT_8
,
257 /* Base features (in order of release)
258 * Only non-hypervisor managed features belong here.
259 * Base feature sets are static meaning they do not change in future QEMU
262 static uint16_t base_GEN7_GA1
[] = {
268 #define base_GEN7_GA2 EmptyFeat
269 #define base_GEN7_GA3 EmptyFeat
271 static uint16_t base_GEN8_GA1
[] = {
273 S390_FEAT_EXTENDED_TRANSLATION_2
,
275 S390_FEAT_LONG_DISPLACEMENT
,
276 S390_FEAT_LONG_DISPLACEMENT_FAST
,
277 S390_FEAT_HFP_MADDSUB
,
280 #define base_GEN8_GA2 EmptyFeat
281 #define base_GEN8_GA3 EmptyFeat
282 #define base_GEN8_GA4 EmptyFeat
283 #define base_GEN8_GA5 EmptyFeat
285 static uint16_t base_GEN9_GA1
[] = {
286 S390_FEAT_IDTE_SEGMENT
,
287 S390_FEAT_ASN_LX_REUSE
,
289 S390_FEAT_SENSE_RUNNING_STATUS
,
290 S390_FEAT_EXTENDED_IMMEDIATE
,
291 S390_FEAT_EXTENDED_TRANSLATION_3
,
292 S390_FEAT_HFP_UNNORMALIZED_EXT
,
294 S390_FEAT_STORE_CLOCK_FAST
,
295 S390_FEAT_GROUP_TOD_CLOCK_STEERING
,
300 #define base_GEN9_GA2 EmptyFeat
301 #define base_GEN9_GA3 EmptyFeat
303 static uint16_t base_GEN10_GA1
[] = {
304 S390_FEAT_CONDITIONAL_SSKE
,
305 S390_FEAT_PARSING_ENH
,
306 S390_FEAT_MOVE_WITH_OPTIONAL_SPEC
,
307 S390_FEAT_EXTRACT_CPU_TIME
,
308 S390_FEAT_COMPARE_AND_SWAP_AND_STORE
,
309 S390_FEAT_COMPARE_AND_SWAP_AND_STORE_2
,
310 S390_FEAT_GENERAL_INSTRUCTIONS_EXT
,
311 S390_FEAT_EXECUTE_EXT
,
312 S390_FEAT_FLOATING_POINT_SUPPPORT_ENH
,
317 #define base_GEN10_GA2 EmptyFeat
318 #define base_GEN10_GA3 EmptyFeat
320 static uint16_t base_GEN11_GA1
[] = {
321 S390_FEAT_NONQ_KEY_SETTING
,
322 S390_FEAT_ENHANCED_MONITOR
,
323 S390_FEAT_FLOATING_POINT_EXT
,
324 S390_FEAT_SET_PROGRAM_PARAMETERS
,
327 S390_FEAT_INTERLOCKED_ACCESS_2
,
330 #define base_GEN11_GA2 EmptyFeat
332 static uint16_t base_GEN12_GA1
[] = {
333 S390_FEAT_DFP_ZONED_CONVERSION
,
335 S390_FEAT_LOCAL_TLB_CLEARING
,
338 #define base_GEN12_GA2 EmptyFeat
340 static uint16_t base_GEN13_GA1
[] = {
342 S390_FEAT_DFP_PACKED_CONVERSION
,
343 S390_FEAT_GROUP_GEN13_PTFF
,
346 #define base_GEN13_GA2 EmptyFeat
348 static uint16_t base_GEN14_GA1
[] = {
349 S390_FEAT_ENTROPY_ENC_COMP
,
350 S390_FEAT_MISC_INSTRUCTION_EXT
,
351 S390_FEAT_SEMAPHORE_ASSIST
,
352 S390_FEAT_TIME_SLICE_INSTRUMENTATION
,
353 S390_FEAT_ORDER_PRESERVING_COMPRESSION
,
356 #define base_GEN14_GA2 EmptyFeat
358 /* Full features (in order of release)
359 * Automatically includes corresponding base features.
360 * Full features are all features this hardware supports even if kvm/QEMU do not
361 * support these features yet.
363 static uint16_t full_GEN7_GA1
[] = {
373 static uint16_t full_GEN7_GA2
[] = {
374 S390_FEAT_EXTENDED_TRANSLATION_2
,
377 static uint16_t full_GEN7_GA3
[] = {
378 S390_FEAT_LONG_DISPLACEMENT
,
382 static uint16_t full_GEN8_GA1
[] = {
384 S390_FEAT_SIE_64BSCAO
,
387 #define full_GEN8_GA2 EmptyFeat
389 static uint16_t full_GEN8_GA3
[] = {
390 S390_FEAT_ASN_LX_REUSE
,
391 S390_FEAT_EXTENDED_TRANSLATION_3
,
394 #define full_GEN8_GA4 EmptyFeat
395 #define full_GEN8_GA5 EmptyFeat
397 static uint16_t full_GEN9_GA1
[] = {
398 S390_FEAT_STORE_HYPERVISOR_INFO
,
399 S390_FEAT_GROUP_MSA_EXT_1
,
404 static uint16_t full_GEN9_GA2
[] = {
405 S390_FEAT_MOVE_WITH_OPTIONAL_SPEC
,
406 S390_FEAT_EXTRACT_CPU_TIME
,
407 S390_FEAT_COMPARE_AND_SWAP_AND_STORE
,
408 S390_FEAT_FLOATING_POINT_SUPPPORT_ENH
,
412 static uint16_t full_GEN9_GA3
[] = {
413 S390_FEAT_CONDITIONAL_SSKE
,
417 static uint16_t full_GEN10_GA1
[] = {
419 S390_FEAT_CONFIGURATION_TOPOLOGY
,
420 S390_FEAT_GROUP_MSA_EXT_2
,
423 S390_FEAT_SIE_SIGPIF
,
426 static uint16_t full_GEN10_GA2
[] = {
427 S390_FEAT_SET_PROGRAM_PARAMETERS
,
431 static uint16_t full_GEN10_GA3
[] = {
432 S390_FEAT_GROUP_MSA_EXT_3
,
435 static uint16_t full_GEN11_GA1
[] = {
436 S390_FEAT_IPTE_RANGE
,
437 S390_FEAT_ACCESS_EXCEPTION_FS_INDICATION
,
438 S390_FEAT_GROUP_MSA_EXT_4
,
441 #define full_GEN11_GA2 EmptyFeat
443 static uint16_t full_GEN12_GA1
[] = {
444 S390_FEAT_CONSTRAINT_TRANSACTIONAL_EXE
,
445 S390_FEAT_TRANSACTIONAL_EXE
,
446 S390_FEAT_RUNTIME_INSTRUMENTATION
,
448 S390_FEAT_ADAPTER_EVENT_NOTIFICATION
,
449 S390_FEAT_ADAPTER_INT_SUPPRESSION
,
451 S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2
,
452 S390_FEAT_AP_QUERY_CONFIG_INFO
,
453 S390_FEAT_AP_FACILITIES_TEST
,
457 static uint16_t full_GEN12_GA2
[] = {
458 S390_FEAT_GROUP_MSA_EXT_5
,
461 static uint16_t full_GEN13_GA1
[] = {
465 #define full_GEN13_GA2 EmptyFeat
467 static uint16_t full_GEN14_GA1
[] = {
468 S390_FEAT_INSTRUCTION_EXEC_PROT
,
469 S390_FEAT_GUARDED_STORAGE
,
470 S390_FEAT_VECTOR_PACKED_DECIMAL
,
471 S390_FEAT_VECTOR_ENH
,
472 S390_FEAT_MULTIPLE_EPOCH
,
473 S390_FEAT_TEST_PENDING_EXT_INTERRUPTION
,
474 S390_FEAT_INSERT_REFERENCE_BITS_MULT
,
475 S390_FEAT_GROUP_MSA_EXT_6
,
476 S390_FEAT_GROUP_MSA_EXT_7
,
477 S390_FEAT_GROUP_MSA_EXT_8
,
482 S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF
,
485 #define full_GEN14_GA2 EmptyFeat
487 /* Default features (in order of release)
488 * Automatically includes corresponding base features.
489 * Default features are all features this version of QEMU supports for this
490 * hardware model. Default feature sets can grow with new QEMU releases.
492 #define default_GEN7_GA1 EmptyFeat
493 #define default_GEN7_GA2 EmptyFeat
494 #define default_GEN7_GA3 EmptyFeat
495 #define default_GEN8_GA1 EmptyFeat
496 #define default_GEN8_GA2 EmptyFeat
497 #define default_GEN8_GA3 EmptyFeat
498 #define default_GEN8_GA4 EmptyFeat
499 #define default_GEN8_GA5 EmptyFeat
501 static uint16_t default_GEN9_GA1
[] = {
502 S390_FEAT_STORE_HYPERVISOR_INFO
,
503 S390_FEAT_GROUP_MSA_EXT_1
,
507 #define default_GEN9_GA2 EmptyFeat
508 #define default_GEN9_GA3 EmptyFeat
510 static uint16_t default_GEN10_GA1
[] = {
512 S390_FEAT_GROUP_MSA_EXT_2
,
515 #define default_GEN10_GA2 EmptyFeat
516 #define default_GEN10_GA3 EmptyFeat
518 static uint16_t default_GEN11_GA1
[] = {
519 S390_FEAT_GROUP_MSA_EXT_3
,
520 S390_FEAT_IPTE_RANGE
,
521 S390_FEAT_ACCESS_EXCEPTION_FS_INDICATION
,
522 S390_FEAT_GROUP_MSA_EXT_4
,
527 #define default_GEN11_GA2 EmptyFeat
529 static uint16_t default_GEN12_GA1
[] = {
530 S390_FEAT_CONSTRAINT_TRANSACTIONAL_EXE
,
531 S390_FEAT_TRANSACTIONAL_EXE
,
532 S390_FEAT_RUNTIME_INSTRUMENTATION
,
534 S390_FEAT_ADAPTER_EVENT_NOTIFICATION
,
537 S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2
,
540 #define default_GEN12_GA2 EmptyFeat
542 static uint16_t default_GEN13_GA1
[] = {
543 S390_FEAT_GROUP_MSA_EXT_5
,
547 #define default_GEN13_GA2 EmptyFeat
549 static uint16_t default_GEN14_GA1
[] = {
550 S390_FEAT_INSTRUCTION_EXEC_PROT
,
551 S390_FEAT_GUARDED_STORAGE
,
552 S390_FEAT_VECTOR_PACKED_DECIMAL
,
553 S390_FEAT_VECTOR_ENH
,
554 S390_FEAT_GROUP_MSA_EXT_6
,
555 S390_FEAT_GROUP_MSA_EXT_7
,
556 S390_FEAT_GROUP_MSA_EXT_8
,
557 S390_FEAT_MULTIPLE_EPOCH
,
558 S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF
,
561 #define default_GEN14_GA2 EmptyFeat
563 /* QEMU (CPU model) features */
565 static uint16_t qemu_V2_11
[] = {
571 static uint16_t qemu_V3_1
[] = {
573 S390_FEAT_IDTE_SEGMENT
,
575 S390_FEAT_SENSE_RUNNING_STATUS
,
576 S390_FEAT_EXTENDED_TRANSLATION_2
,
578 S390_FEAT_LONG_DISPLACEMENT
,
579 S390_FEAT_LONG_DISPLACEMENT_FAST
,
580 S390_FEAT_EXTENDED_IMMEDIATE
,
581 S390_FEAT_EXTENDED_TRANSLATION_3
,
583 S390_FEAT_STORE_CLOCK_FAST
,
584 S390_FEAT_MOVE_WITH_OPTIONAL_SPEC
,
586 S390_FEAT_EXTRACT_CPU_TIME
,
587 S390_FEAT_COMPARE_AND_SWAP_AND_STORE
,
588 S390_FEAT_COMPARE_AND_SWAP_AND_STORE_2
,
589 S390_FEAT_GENERAL_INSTRUCTIONS_EXT
,
590 S390_FEAT_EXECUTE_EXT
,
591 S390_FEAT_SET_PROGRAM_PARAMETERS
,
592 S390_FEAT_FLOATING_POINT_SUPPPORT_ENH
,
595 S390_FEAT_LOCAL_TLB_CLEARING
,
596 S390_FEAT_INTERLOCKED_ACCESS_2
,
597 S390_FEAT_ADAPTER_EVENT_NOTIFICATION
,
598 S390_FEAT_ADAPTER_INT_SUPPRESSION
,
603 static uint16_t qemu_LATEST
[] = {
607 /* add all new definitions before this point */
608 static uint16_t qemu_MAX
[] = {
611 /* generates a dependency warning, leave it out for now */
615 /****** END FEATURE DEFS ******/
617 #define _YEARS "2016"
618 #define _NAME_H "TARGET_S390X_GEN_FEATURES_H"
620 #define CPU_FEAT_INITIALIZER(_name) \
622 .name = "S390_FEAT_LIST_" #_name, \
624 { .data = base_##_name, \
625 .len = ARRAY_SIZE(base_##_name) }, \
627 { .data = default_##_name, \
628 .len = ARRAY_SIZE(default_##_name) }, \
630 { .data = full_##_name, \
631 .len = ARRAY_SIZE(full_##_name) }, \
634 typedef struct BitSpec
{
642 BitSpec default_bits
;
646 static uint16_t EmptyFeat
[] = {};
648 /*******************************
649 * processor GA series
650 *******************************/
651 static CpuFeatDefSpec CpuFeatDef
[] = {
652 CPU_FEAT_INITIALIZER(GEN7_GA1
),
653 CPU_FEAT_INITIALIZER(GEN7_GA2
),
654 CPU_FEAT_INITIALIZER(GEN7_GA3
),
655 CPU_FEAT_INITIALIZER(GEN8_GA1
),
656 CPU_FEAT_INITIALIZER(GEN8_GA2
),
657 CPU_FEAT_INITIALIZER(GEN8_GA3
),
658 CPU_FEAT_INITIALIZER(GEN8_GA4
),
659 CPU_FEAT_INITIALIZER(GEN8_GA5
),
660 CPU_FEAT_INITIALIZER(GEN9_GA1
),
661 CPU_FEAT_INITIALIZER(GEN9_GA2
),
662 CPU_FEAT_INITIALIZER(GEN9_GA3
),
663 CPU_FEAT_INITIALIZER(GEN10_GA1
),
664 CPU_FEAT_INITIALIZER(GEN10_GA2
),
665 CPU_FEAT_INITIALIZER(GEN10_GA3
),
666 CPU_FEAT_INITIALIZER(GEN11_GA1
),
667 CPU_FEAT_INITIALIZER(GEN11_GA2
),
668 CPU_FEAT_INITIALIZER(GEN12_GA1
),
669 CPU_FEAT_INITIALIZER(GEN12_GA2
),
670 CPU_FEAT_INITIALIZER(GEN13_GA1
),
671 CPU_FEAT_INITIALIZER(GEN13_GA2
),
672 CPU_FEAT_INITIALIZER(GEN14_GA1
),
673 CPU_FEAT_INITIALIZER(GEN14_GA2
),
676 #define FEAT_GROUP_INITIALIZER(_name) \
678 .name = "S390_FEAT_GROUP_LIST_" #_name, \
679 .enum_name = "S390_FEAT_GROUP_" #_name, \
681 { .data = group_##_name, \
682 .len = ARRAY_SIZE(group_##_name) }, \
687 const char *enum_name
;
691 /*******************************
693 *******************************/
694 static FeatGroupDefSpec FeatGroupDef
[] = {
695 FEAT_GROUP_INITIALIZER(PLO
),
696 FEAT_GROUP_INITIALIZER(TOD_CLOCK_STEERING
),
697 FEAT_GROUP_INITIALIZER(GEN13_PTFF
),
698 FEAT_GROUP_INITIALIZER(MSA
),
699 FEAT_GROUP_INITIALIZER(MSA_EXT_1
),
700 FEAT_GROUP_INITIALIZER(MSA_EXT_2
),
701 FEAT_GROUP_INITIALIZER(MSA_EXT_3
),
702 FEAT_GROUP_INITIALIZER(MSA_EXT_4
),
703 FEAT_GROUP_INITIALIZER(MSA_EXT_5
),
704 FEAT_GROUP_INITIALIZER(MSA_EXT_6
),
705 FEAT_GROUP_INITIALIZER(MSA_EXT_7
),
706 FEAT_GROUP_INITIALIZER(MSA_EXT_8
),
707 FEAT_GROUP_INITIALIZER(MULTIPLE_EPOCH_PTFF
),
710 #define QEMU_FEAT_INITIALIZER(_name) \
712 .name = "S390_FEAT_LIST_QEMU_" #_name, \
714 { .data = qemu_##_name, \
715 .len = ARRAY_SIZE(qemu_##_name) }, \
718 /*******************************
719 * QEMU (CPU model) features
720 *******************************/
721 static FeatGroupDefSpec QemuFeatDef
[] = {
722 QEMU_FEAT_INITIALIZER(V2_11
),
723 QEMU_FEAT_INITIALIZER(V3_1
),
724 QEMU_FEAT_INITIALIZER(LATEST
),
725 QEMU_FEAT_INITIALIZER(MAX
),
729 static void set_bits(uint64_t list
[], BitSpec bits
)
733 for (i
= 0; i
< bits
.len
; i
++) {
734 list
[bits
.data
[i
] / 64] |= 1ULL << (bits
.data
[i
] % 64);
738 static void print_feature_defs(void)
740 uint64_t base_feat
[S390_FEAT_MAX
/ 64 + 1] = {};
741 uint64_t default_feat
[S390_FEAT_MAX
/ 64 + 1] = {};
742 uint64_t full_feat
[S390_FEAT_MAX
/ 64 + 1] = {};
745 printf("\n/* CPU model feature list data */\n");
747 for (i
= 0; i
< ARRAY_SIZE(CpuFeatDef
); i
++) {
748 set_bits(base_feat
, CpuFeatDef
[i
].base_bits
);
749 /* add the base to the default features */
750 set_bits(default_feat
, CpuFeatDef
[i
].base_bits
);
751 set_bits(default_feat
, CpuFeatDef
[i
].default_bits
);
752 /* add the base to the full features */
753 set_bits(full_feat
, CpuFeatDef
[i
].base_bits
);
754 set_bits(full_feat
, CpuFeatDef
[i
].full_bits
);
756 printf("#define %s_BASE\t", CpuFeatDef
[i
].name
);
757 for (j
= 0; j
< ARRAY_SIZE(base_feat
); j
++) {
758 printf("0x%016"PRIx64
"ULL", base_feat
[j
]);
759 if (j
< ARRAY_SIZE(base_feat
) - 1) {
765 printf("#define %s_DEFAULT\t", CpuFeatDef
[i
].name
);
766 for (j
= 0; j
< ARRAY_SIZE(default_feat
); j
++) {
767 printf("0x%016"PRIx64
"ULL", default_feat
[j
]);
768 if (j
< ARRAY_SIZE(default_feat
) - 1) {
774 printf("#define %s_FULL\t\t", CpuFeatDef
[i
].name
);
775 for (j
= 0; j
< ARRAY_SIZE(full_feat
); j
++) {
776 printf("0x%016"PRIx64
"ULL", full_feat
[j
]);
777 if (j
< ARRAY_SIZE(full_feat
) - 1) {
786 static void print_qemu_feature_defs(void)
788 uint64_t feat
[S390_FEAT_MAX
/ 64 + 1] = {};
791 printf("\n/* QEMU (CPU model) feature list data */\n");
793 /* for now we assume that we only add new features */
794 for (i
= 0; i
< ARRAY_SIZE(QemuFeatDef
); i
++) {
795 set_bits(feat
, QemuFeatDef
[i
].bits
);
797 printf("#define %s\t", QemuFeatDef
[i
].name
);
798 for (j
= 0; j
< ARRAY_SIZE(feat
); j
++) {
799 printf("0x%016"PRIx64
"ULL", feat
[j
]);
800 if (j
< ARRAY_SIZE(feat
) - 1) {
809 static void print_feature_group_defs(void)
813 printf("\n/* CPU feature group list data */\n");
815 for (i
= 0; i
< ARRAY_SIZE(FeatGroupDef
); i
++) {
816 uint64_t feat
[S390_FEAT_MAX
/ 64 + 1] = {};
818 set_bits(feat
, FeatGroupDef
[i
].bits
);
819 printf("#define %s\t", FeatGroupDef
[i
].name
);
820 for (j
= 0; j
< ARRAY_SIZE(feat
); j
++) {
821 printf("0x%016"PRIx64
"ULL", feat
[j
]);
822 if (j
< ARRAY_SIZE(feat
) - 1) {
831 static void print_feature_group_enum_type(void)
835 printf("\n/* CPU feature group enum type */\n"
837 for (i
= 0; i
< ARRAY_SIZE(FeatGroupDef
); i
++) {
838 printf("\t%s,\n", FeatGroupDef
[i
].enum_name
);
840 printf("\tS390_FEAT_GROUP_MAX,\n"
841 "} S390FeatGroup;\n");
844 int main(int argc
, char *argv
[])
847 " * AUTOMATICALLY GENERATED, DO NOT MODIFY HERE, EDIT\n"
848 " * SOURCE FILE \"%s\" INSTEAD.\n"
850 " * Copyright %s IBM Corp.\n"
852 " * This work is licensed under the terms of the GNU GPL, "
853 "version 2 or (at\n * your option) any later version. See "
854 "the COPYING file in the top-level\n * directory.\n"
856 "#ifndef %s\n#define %s\n", __FILE__
, _YEARS
, _NAME_H
, _NAME_H
);
857 print_feature_defs();
858 print_feature_group_defs();
859 print_qemu_feature_defs();
860 print_feature_group_enum_type();
861 printf("\n#endif\n");