2 * S390 feature list generator
4 * Copyright 2016 IBM Corp.
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
18 #include "cpu_features_def.h"
20 #define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
22 /***** BEGIN FEATURE DEFS *****/
24 #define S390_FEAT_GROUP_PLO \
35 S390_FEAT_PLO_DCSGR, \
38 S390_FEAT_PLO_CSSTG, \
39 S390_FEAT_PLO_CSSTGR, \
40 S390_FEAT_PLO_CSSTX, \
41 S390_FEAT_PLO_CSDST, \
42 S390_FEAT_PLO_CSDSTG, \
43 S390_FEAT_PLO_CSDSTGR, \
44 S390_FEAT_PLO_CSDSTX, \
45 S390_FEAT_PLO_CSTST, \
46 S390_FEAT_PLO_CSTSTG, \
47 S390_FEAT_PLO_CSTSTGR, \
50 #define S390_FEAT_GROUP_TOD_CLOCK_STEERING \
51 S390_FEAT_TOD_CLOCK_STEERING, \
57 #define S390_FEAT_GROUP_GEN13_PTFF \
59 S390_FEAT_PTFF_QTOU, \
62 #define S390_FEAT_GROUP_MSA \
65 S390_FEAT_KMAC_TDEA_128, \
66 S390_FEAT_KMAC_TDEA_192, \
68 S390_FEAT_KMC_TDEA_128, \
69 S390_FEAT_KMC_TDEA_192, \
71 S390_FEAT_KM_TDEA_128, \
72 S390_FEAT_KM_TDEA_192, \
73 S390_FEAT_KIMD_SHA_1, \
76 #define S390_FEAT_GROUP_MSA_EXT_1 \
77 S390_FEAT_KMC_AES_128, \
78 S390_FEAT_KM_AES_128, \
79 S390_FEAT_KIMD_SHA_256, \
80 S390_FEAT_KLMD_SHA_256
82 #define S390_FEAT_GROUP_MSA_EXT_2 \
83 S390_FEAT_KMC_AES_192, \
84 S390_FEAT_KMC_AES_256, \
86 S390_FEAT_KM_AES_192, \
87 S390_FEAT_KM_AES_256, \
88 S390_FEAT_KIMD_SHA_512, \
89 S390_FEAT_KLMD_SHA_512
91 #define S390_FEAT_GROUP_MSA_EXT_3 \
92 S390_FEAT_MSA_EXT_3, \
93 S390_FEAT_KMAC_EDEA, \
94 S390_FEAT_KMAC_ETDEA_128, \
95 S390_FEAT_KMAC_ETDEA_192, \
96 S390_FEAT_KMC_EAES_128, \
97 S390_FEAT_KMC_EAES_192, \
98 S390_FEAT_KMC_EAES_256, \
100 S390_FEAT_KMC_ETDEA_128, \
101 S390_FEAT_KMC_ETDEA_192, \
103 S390_FEAT_KM_ETDEA_128, \
104 S390_FEAT_KM_ETDEA_192, \
105 S390_FEAT_KM_EAES_128, \
106 S390_FEAT_KM_EAES_192, \
107 S390_FEAT_KM_EAES_256, \
108 S390_FEAT_PCKMO_EDEA, \
109 S390_FEAT_PCKMO_ETDEA_128, \
110 S390_FEAT_PCKMO_ETDEA_256, \
111 S390_FEAT_PCKMO_AES_128, \
112 S390_FEAT_PCKMO_AES_192, \
113 S390_FEAT_PCKMO_AES_256
115 #define S390_FEAT_GROUP_MSA_EXT_4 \
116 S390_FEAT_MSA_EXT_4, \
117 S390_FEAT_KMAC_AES_128, \
118 S390_FEAT_KMAC_AES_192, \
119 S390_FEAT_KMAC_AES_256, \
120 S390_FEAT_KMAC_EAES_128, \
121 S390_FEAT_KMAC_EAES_192, \
122 S390_FEAT_KMAC_EAES_256, \
123 S390_FEAT_KM_XTS_AES_128, \
124 S390_FEAT_KM_XTS_AES_256, \
125 S390_FEAT_KM_XTS_EAES_128, \
126 S390_FEAT_KM_XTS_EAES_256, \
127 S390_FEAT_KIMD_GHASH, \
128 S390_FEAT_KMCTR_DEA, \
129 S390_FEAT_KMCTR_TDEA_128, \
130 S390_FEAT_KMCTR_TDEA_192, \
131 S390_FEAT_KMCTR_EDEA, \
132 S390_FEAT_KMCTR_ETDEA_128, \
133 S390_FEAT_KMCTR_ETDEA_192, \
134 S390_FEAT_KMCTR_AES_128, \
135 S390_FEAT_KMCTR_AES_192, \
136 S390_FEAT_KMCTR_AES_256, \
137 S390_FEAT_KMCTR_EAES_128, \
138 S390_FEAT_KMCTR_EAES_192, \
139 S390_FEAT_KMCTR_EAES_256, \
141 S390_FEAT_KMF_TDEA_128, \
142 S390_FEAT_KMF_TDEA_192, \
143 S390_FEAT_KMF_EDEA, \
144 S390_FEAT_KMF_ETDEA_128, \
145 S390_FEAT_KMF_ETDEA_192, \
146 S390_FEAT_KMF_AES_128, \
147 S390_FEAT_KMF_AES_192, \
148 S390_FEAT_KMF_AES_256, \
149 S390_FEAT_KMF_EAES_128, \
150 S390_FEAT_KMF_EAES_192, \
151 S390_FEAT_KMF_EAES_256, \
153 S390_FEAT_KMO_TDEA_128, \
154 S390_FEAT_KMO_TDEA_192, \
155 S390_FEAT_KMO_EDEA, \
156 S390_FEAT_KMO_ETDEA_128, \
157 S390_FEAT_KMO_ETDEA_192, \
158 S390_FEAT_KMO_AES_128, \
159 S390_FEAT_KMO_AES_192, \
160 S390_FEAT_KMO_AES_256, \
161 S390_FEAT_KMO_EAES_128, \
162 S390_FEAT_KMO_EAES_192, \
163 S390_FEAT_KMO_EAES_256, \
164 S390_FEAT_PCC_CMAC_DEA, \
165 S390_FEAT_PCC_CMAC_TDEA_128, \
166 S390_FEAT_PCC_CMAC_TDEA_192, \
167 S390_FEAT_PCC_CMAC_ETDEA_128, \
168 S390_FEAT_PCC_CMAC_ETDEA_192, \
169 S390_FEAT_PCC_CMAC_TDEA, \
170 S390_FEAT_PCC_CMAC_AES_128, \
171 S390_FEAT_PCC_CMAC_AES_192, \
172 S390_FEAT_PCC_CMAC_AES_256, \
173 S390_FEAT_PCC_CMAC_EAES_128, \
174 S390_FEAT_PCC_CMAC_EAES_192, \
175 S390_FEAT_PCC_CMAC_EAES_256, \
176 S390_FEAT_PCC_XTS_AES_128, \
177 S390_FEAT_PCC_XTS_AES_256, \
178 S390_FEAT_PCC_XTS_EAES_128, \
179 S390_FEAT_PCC_XTS_EAES_256
181 #define S390_FEAT_GROUP_MSA_EXT_5 \
182 S390_FEAT_MSA_EXT_5, \
183 S390_FEAT_PPNO_SHA_512_DRNG
185 /* cpu feature groups */
186 static uint16_t group_PLO
[] = {
189 static uint16_t group_TOD_CLOCK_STEERING
[] = {
190 S390_FEAT_GROUP_TOD_CLOCK_STEERING
,
192 static uint16_t group_GEN13_PTFF
[] = {
193 S390_FEAT_GROUP_GEN13_PTFF
,
195 static uint16_t group_MSA
[] = {
198 static uint16_t group_MSA_EXT_1
[] = {
199 S390_FEAT_GROUP_MSA_EXT_1
,
201 static uint16_t group_MSA_EXT_2
[] = {
202 S390_FEAT_GROUP_MSA_EXT_2
,
204 static uint16_t group_MSA_EXT_3
[] = {
205 S390_FEAT_GROUP_MSA_EXT_3
,
207 static uint16_t group_MSA_EXT_4
[] = {
208 S390_FEAT_GROUP_MSA_EXT_4
,
210 static uint16_t group_MSA_EXT_5
[] = {
211 S390_FEAT_GROUP_MSA_EXT_5
,
214 /* base features in order of release */
215 static uint16_t base_GEN7_GA1
[] = {
220 #define base_GEN7_GA2 EmptyFeat
221 #define base_GEN7_GA3 EmptyFeat
222 static uint16_t base_GEN8_GA1
[] = {
224 S390_FEAT_EXTENDED_TRANSLATION_2
,
226 S390_FEAT_LONG_DISPLACEMENT
,
227 S390_FEAT_LONG_DISPLACEMENT_FAST
,
228 S390_FEAT_HFP_MADDSUB
,
230 #define base_GEN8_GA2 EmptyFeat
231 #define base_GEN8_GA3 EmptyFeat
232 #define base_GEN8_GA4 EmptyFeat
233 #define base_GEN8_GA5 EmptyFeat
234 static uint16_t base_GEN9_GA1
[] = {
235 S390_FEAT_IDTE_SEGMENT
,
236 S390_FEAT_ASN_LX_REUSE
,
238 S390_FEAT_SENSE_RUNNING_STATUS
,
239 S390_FEAT_EXTENDED_IMMEDIATE
,
240 S390_FEAT_EXTENDED_TRANSLATION_3
,
241 S390_FEAT_HFP_UNNORMALIZED_EXT
,
243 S390_FEAT_STORE_CLOCK_FAST
,
244 S390_FEAT_GROUP_TOD_CLOCK_STEERING
,
248 #define base_GEN9_GA2 EmptyFeat
249 #define base_GEN9_GA3 EmptyFeat
250 static uint16_t base_GEN10_GA1
[] = {
251 S390_FEAT_CONDITIONAL_SSKE
,
252 S390_FEAT_PARSING_ENH
,
253 S390_FEAT_MOVE_WITH_OPTIONAL_SPEC
,
254 S390_FEAT_EXTRACT_CPU_TIME
,
255 S390_FEAT_COMPARE_AND_SWAP_AND_STORE
,
256 S390_FEAT_COMPARE_AND_SWAP_AND_STORE_2
,
257 S390_FEAT_GENERAL_INSTRUCTIONS_EXT
,
258 S390_FEAT_EXECUTE_EXT
,
259 S390_FEAT_FLOATING_POINT_SUPPPORT_ENH
,
264 #define base_GEN10_GA2 EmptyFeat
265 #define base_GEN10_GA3 EmptyFeat
266 static uint16_t base_GEN11_GA1
[] = {
267 S390_FEAT_NONQ_KEY_SETTING
,
268 S390_FEAT_ENHANCED_MONITOR
,
269 S390_FEAT_FLOATING_POINT_EXT
,
270 S390_FEAT_SET_PROGRAM_PARAMETERS
,
273 S390_FEAT_INTERLOCKED_ACCESS_2
,
275 #define base_GEN11_GA2 EmptyFeat
276 static uint16_t base_GEN12_GA1
[] = {
277 S390_FEAT_DFP_ZONED_CONVERSION
,
279 S390_FEAT_LOCAL_TLB_CLEARING
,
281 #define base_GEN12_GA2 EmptyFeat
282 static uint16_t base_GEN13_GA1
[] = {
284 S390_FEAT_DFP_PACKED_CONVERSION
,
285 S390_FEAT_GROUP_GEN13_PTFF
,
287 #define base_GEN13_GA2 EmptyFeat
289 /* full features differing to the base in order of release */
290 static uint16_t full_GEN7_GA1
[] = {
297 static uint16_t full_GEN7_GA2
[] = {
298 S390_FEAT_EXTENDED_TRANSLATION_2
,
300 static uint16_t full_GEN7_GA3
[] = {
301 S390_FEAT_LONG_DISPLACEMENT
,
304 static uint16_t full_GEN8_GA1
[] = {
306 S390_FEAT_SIE_64BSCAO
,
308 #define full_GEN8_GA2 EmptyFeat
309 static uint16_t full_GEN8_GA3
[] = {
310 S390_FEAT_ASN_LX_REUSE
,
311 S390_FEAT_EXTENDED_TRANSLATION_3
,
313 #define full_GEN8_GA4 EmptyFeat
314 #define full_GEN8_GA5 EmptyFeat
315 static uint16_t full_GEN9_GA1
[] = {
316 S390_FEAT_STORE_HYPERVISOR_INFO
,
317 S390_FEAT_GROUP_MSA_EXT_1
,
321 static uint16_t full_GEN9_GA2
[] = {
322 S390_FEAT_MOVE_WITH_OPTIONAL_SPEC
,
323 S390_FEAT_EXTRACT_CPU_TIME
,
324 S390_FEAT_COMPARE_AND_SWAP_AND_STORE
,
325 S390_FEAT_FLOATING_POINT_SUPPPORT_ENH
,
328 static uint16_t full_GEN9_GA3
[] = {
329 S390_FEAT_CONDITIONAL_SSKE
,
332 static uint16_t full_GEN10_GA1
[] = {
334 S390_FEAT_CONFIGURATION_TOPOLOGY
,
335 S390_FEAT_GROUP_MSA_EXT_2
,
338 S390_FEAT_SIE_SIGPIF
,
340 static uint16_t full_GEN10_GA2
[] = {
341 S390_FEAT_SET_PROGRAM_PARAMETERS
,
344 static uint16_t full_GEN10_GA3
[] = {
345 S390_FEAT_GROUP_MSA_EXT_3
,
347 static uint16_t full_GEN11_GA1
[] = {
348 S390_FEAT_IPTE_RANGE
,
349 S390_FEAT_ACCESS_EXCEPTION_FS_INDICATION
,
350 S390_FEAT_GROUP_MSA_EXT_4
,
352 #define full_GEN11_GA2 EmptyFeat
353 static uint16_t full_GEN12_GA1
[] = {
354 S390_FEAT_CONSTRAINT_TRANSACTIONAL_EXE
,
355 S390_FEAT_TRANSACTIONAL_EXE
,
356 S390_FEAT_RUNTIME_INSTRUMENTATION
,
359 static uint16_t full_GEN12_GA2
[] = {
360 S390_FEAT_GROUP_MSA_EXT_5
,
362 static uint16_t full_GEN13_GA1
[] = {
365 #define full_GEN13_GA2 EmptyFeat
367 /* default features differing to the base in order of release */
368 #define default_GEN7_GA1 EmptyFeat
369 #define default_GEN7_GA2 EmptyFeat
370 #define default_GEN7_GA3 EmptyFeat
371 #define default_GEN8_GA1 EmptyFeat
372 #define default_GEN8_GA2 EmptyFeat
373 #define default_GEN8_GA3 EmptyFeat
374 #define default_GEN8_GA4 EmptyFeat
375 #define default_GEN8_GA5 EmptyFeat
376 static uint16_t default_GEN9_GA1
[] = {
377 S390_FEAT_STORE_HYPERVISOR_INFO
,
378 S390_FEAT_GROUP_MSA_EXT_1
,
381 #define default_GEN9_GA2 EmptyFeat
382 #define default_GEN9_GA3 EmptyFeat
383 static uint16_t default_GEN10_GA1
[] = {
385 S390_FEAT_GROUP_MSA_EXT_2
,
387 #define default_GEN10_GA2 EmptyFeat
388 #define default_GEN10_GA3 EmptyFeat
389 static uint16_t default_GEN11_GA1
[] = {
390 S390_FEAT_GROUP_MSA_EXT_3
,
391 S390_FEAT_IPTE_RANGE
,
392 S390_FEAT_ACCESS_EXCEPTION_FS_INDICATION
,
393 S390_FEAT_GROUP_MSA_EXT_4
,
395 #define default_GEN11_GA2 EmptyFeat
396 static uint16_t default_GEN12_GA1
[] = {
397 S390_FEAT_CONSTRAINT_TRANSACTIONAL_EXE
,
398 S390_FEAT_TRANSACTIONAL_EXE
,
399 S390_FEAT_RUNTIME_INSTRUMENTATION
,
402 #define default_GEN12_GA2 EmptyFeat
403 static uint16_t default_GEN13_GA1
[] = {
404 S390_FEAT_GROUP_MSA_EXT_5
,
407 #define default_GEN13_GA2 EmptyFeat
409 /****** END FEATURE DEFS ******/
411 #define _YEARS "2016"
412 #define _NAME_H "TARGET_S390X_GEN_FEATURES_H"
414 #define CPU_FEAT_INITIALIZER(_name) \
416 .name = "S390_FEAT_LIST_" #_name, \
418 { .data = base_##_name, \
419 .len = ARRAY_SIZE(base_##_name) }, \
421 { .data = default_##_name, \
422 .len = ARRAY_SIZE(default_##_name) }, \
424 { .data = full_##_name, \
425 .len = ARRAY_SIZE(full_##_name) }, \
428 typedef struct BitSpec
{
436 BitSpec default_bits
;
440 static uint16_t EmptyFeat
[] = {};
442 /*******************************
443 * processor GA series
444 *******************************/
445 static CpuFeatDefSpec CpuFeatDef
[] = {
446 CPU_FEAT_INITIALIZER(GEN7_GA1
),
447 CPU_FEAT_INITIALIZER(GEN7_GA2
),
448 CPU_FEAT_INITIALIZER(GEN7_GA3
),
449 CPU_FEAT_INITIALIZER(GEN8_GA1
),
450 CPU_FEAT_INITIALIZER(GEN8_GA2
),
451 CPU_FEAT_INITIALIZER(GEN8_GA3
),
452 CPU_FEAT_INITIALIZER(GEN8_GA4
),
453 CPU_FEAT_INITIALIZER(GEN8_GA5
),
454 CPU_FEAT_INITIALIZER(GEN9_GA1
),
455 CPU_FEAT_INITIALIZER(GEN9_GA2
),
456 CPU_FEAT_INITIALIZER(GEN9_GA3
),
457 CPU_FEAT_INITIALIZER(GEN10_GA1
),
458 CPU_FEAT_INITIALIZER(GEN10_GA2
),
459 CPU_FEAT_INITIALIZER(GEN10_GA3
),
460 CPU_FEAT_INITIALIZER(GEN11_GA1
),
461 CPU_FEAT_INITIALIZER(GEN11_GA2
),
462 CPU_FEAT_INITIALIZER(GEN12_GA1
),
463 CPU_FEAT_INITIALIZER(GEN12_GA2
),
464 CPU_FEAT_INITIALIZER(GEN13_GA1
),
465 CPU_FEAT_INITIALIZER(GEN13_GA2
),
468 #define FEAT_GROUP_INITIALIZER(_name) \
470 .name = "S390_FEAT_GROUP_LIST_" #_name, \
472 { .data = group_##_name, \
473 .len = ARRAY_SIZE(group_##_name) }, \
481 /*******************************
483 *******************************/
484 static FeatGroupDefSpec FeatGroupDef
[] = {
485 FEAT_GROUP_INITIALIZER(PLO
),
486 FEAT_GROUP_INITIALIZER(TOD_CLOCK_STEERING
),
487 FEAT_GROUP_INITIALIZER(GEN13_PTFF
),
488 FEAT_GROUP_INITIALIZER(MSA
),
489 FEAT_GROUP_INITIALIZER(MSA_EXT_1
),
490 FEAT_GROUP_INITIALIZER(MSA_EXT_2
),
491 FEAT_GROUP_INITIALIZER(MSA_EXT_3
),
492 FEAT_GROUP_INITIALIZER(MSA_EXT_4
),
493 FEAT_GROUP_INITIALIZER(MSA_EXT_5
),
496 static void set_bits(uint64_t list
[], BitSpec bits
)
500 for (i
= 0; i
< bits
.len
; i
++) {
501 list
[bits
.data
[i
] / 64] |= 1ULL << (bits
.data
[i
] % 64);
505 static void print_feature_defs(void)
507 uint64_t base_feat
[S390_FEAT_MAX
/ 64 + 1] = {};
508 uint64_t default_feat
[S390_FEAT_MAX
/ 64 + 1] = {};
509 uint64_t full_feat
[S390_FEAT_MAX
/ 64 + 1] = {};
512 printf("\n/* CPU model feature list data */\n");
514 for (i
= 0; i
< ARRAY_SIZE(CpuFeatDef
); i
++) {
515 set_bits(base_feat
, CpuFeatDef
[i
].base_bits
);
516 /* add the base to the default features */
517 set_bits(default_feat
, CpuFeatDef
[i
].base_bits
);
518 set_bits(default_feat
, CpuFeatDef
[i
].default_bits
);
519 /* add the base to the full features */
520 set_bits(full_feat
, CpuFeatDef
[i
].base_bits
);
521 set_bits(full_feat
, CpuFeatDef
[i
].full_bits
);
523 printf("#define %s_BASE\t", CpuFeatDef
[i
].name
);
524 for (j
= 0; j
< ARRAY_SIZE(base_feat
); j
++) {
525 printf("0x%016"PRIx64
"ULL", base_feat
[j
]);
526 if (j
< ARRAY_SIZE(base_feat
) - 1) {
532 printf("#define %s_DEFAULT\t", CpuFeatDef
[i
].name
);
533 for (j
= 0; j
< ARRAY_SIZE(default_feat
); j
++) {
534 printf("0x%016"PRIx64
"ULL", default_feat
[j
]);
535 if (j
< ARRAY_SIZE(default_feat
) - 1) {
541 printf("#define %s_FULL\t\t", CpuFeatDef
[i
].name
);
542 for (j
= 0; j
< ARRAY_SIZE(full_feat
); j
++) {
543 printf("0x%016"PRIx64
"ULL", full_feat
[j
]);
544 if (j
< ARRAY_SIZE(full_feat
) - 1) {
553 static void print_feature_group_defs(void)
557 printf("\n/* CPU feature group list data */\n");
559 for (i
= 0; i
< ARRAY_SIZE(FeatGroupDef
); i
++) {
560 uint64_t feat
[S390_FEAT_MAX
/ 64 + 1] = {};
562 set_bits(feat
, FeatGroupDef
[i
].bits
);
563 printf("#define %s\t", FeatGroupDef
[i
].name
);
564 for (j
= 0; j
< ARRAY_SIZE(feat
); j
++) {
565 printf("0x%016"PRIx64
"ULL", feat
[j
]);
566 if (j
< ARRAY_SIZE(feat
) - 1) {
575 int main(int argc
, char *argv
[])
578 " * AUTOMATICALLY GENERATED, DO NOT MODIFY HERE, EDIT\n"
579 " * SOURCE FILE \"%s\" INSTEAD.\n"
581 " * Copyright %s IBM Corp.\n"
583 " * This work is licensed under the terms of the GNU GPL, "
584 "version 2 or (at\n * your option) any later version. See "
585 "the COPYING file in the top-level\n * directory.\n"
587 "#ifndef %s\n#define %s\n", __FILE__
, _YEARS
, _NAME_H
, _NAME_H
);
588 print_feature_defs();
589 print_feature_group_defs();
590 printf("\n#endif\n");