2 * CPU features/facilities helper structs and utility functions for s390
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
14 #ifndef TARGET_S390X_CPU_FEATURES_H
15 #define TARGET_S390X_CPU_FEATURES_H
17 #include "qemu/bitmap.h"
18 #include "cpu_features_def.h"
20 /* CPU features are announced via different ways */
23 S390_FEAT_TYPE_SCLP_CONF_CHAR
,
24 S390_FEAT_TYPE_SCLP_CONF_CHAR_EXT
,
25 S390_FEAT_TYPE_SCLP_CPU
,
42 /* Definition of a CPU feature */
44 const char *name
; /* name exposed to the user */
45 const char *desc
; /* description exposed to the user */
46 S390FeatType type
; /* feature type (way of indication)*/
47 int bit
; /* bit within the feature type area (fixed) */
50 /* use ordinary bitmap operations to work with features */
51 typedef unsigned long S390FeatBitmap
[BITS_TO_LONGS(S390_FEAT_MAX
)];
53 /* 64bit based bitmap used to init S390FeatBitmap from generated data */
54 typedef uint64_t S390FeatInit
[S390_FEAT_MAX
/ 64 + 1];
56 const S390FeatDef
*s390_feat_def(S390Feat feat
);
57 S390Feat
s390_feat_by_type_and_bit(S390FeatType type
, int bit
);
58 void s390_init_feat_bitmap(const S390FeatInit init
, S390FeatBitmap bitmap
);
59 void s390_fill_feat_block(const S390FeatBitmap features
, S390FeatType type
,
61 void s390_add_from_feat_block(S390FeatBitmap features
, S390FeatType type
,
63 void s390_feat_bitmap_to_ascii(const S390FeatBitmap features
, void *opaque
,
64 void (*fn
)(const char *name
, void *opaque
));
66 /* static groups that will never change */
69 S390_FEAT_GROUP_TOD_CLOCK_STEERING
,
70 S390_FEAT_GROUP_GEN13_PTFF_ENH
,
72 S390_FEAT_GROUP_MSA_EXT_1
,
73 S390_FEAT_GROUP_MSA_EXT_2
,
74 S390_FEAT_GROUP_MSA_EXT_3
,
75 S390_FEAT_GROUP_MSA_EXT_4
,
76 S390_FEAT_GROUP_MSA_EXT_5
,
80 /* Definition of a CPU feature group */
82 const char *name
; /* name exposed to the user */
83 const char *desc
; /* description exposed to the user */
84 S390FeatBitmap feat
; /* features contained in the group */
85 S390FeatInit init
; /* used to init feat from generated data */
88 const S390FeatGroupDef
*s390_feat_group_def(S390FeatGroup group
);
90 #define BE_BIT_NR(BIT) (BIT ^ (BITS_PER_LONG - 1))
91 #define BE_BIT(BIT) (1ULL < BE_BIT_NR(BIT))
93 #endif /* TARGET_S390X_CPU_FEATURES_H */