Skip to content

Commit

Permalink
target/s390x: improve baselining if certain base features are missing
Browse files Browse the repository at this point in the history
There are certain features that we put into base models, but that are
not relevant for the actual search. The most famous example are
MSA subfunctions that might be disabled on certain real hardware out
there.

While the kvm host model detection will usually detect the correct model
on such machines (as it will in the common case not pass features to check
for into s390_find_cpu_def()), baselining will fall back to a quite old
model just because some MSA subfunctions are missing.

Let's improve that by ignoring lack of these features while performing
the search for a base model.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170720123721.12366-6-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
  • Loading branch information
davidhildenbrand authored and cohuck committed Jul 25, 2017
1 parent e23bc1b commit 30e82de
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions target/s390x/cpu_models.c
Expand Up @@ -78,6 +78,9 @@ static S390CPUDef s390_cpu_defs[] = {
CPUDEF_INIT(0x3906, 14, 1, 47, 0x08000000U, "z14", "IBM z14 GA1"),
};

/* features part of a base model but not relevant for finding a base model */
S390FeatBitmap ignored_base_feat;

void s390_cpudef_featoff(uint8_t gen, uint8_t ec_ga, S390Feat feat)
{
const S390CPUDef *def;
Expand Down Expand Up @@ -237,6 +240,11 @@ const S390CPUDef *s390_find_cpu_def(uint16_t type, uint8_t gen, uint8_t ec_ga,
if (features) {
/* see if the model satisfies the minimum features */
bitmap_andnot(missing, def->base_feat, features, S390_FEAT_MAX);
/*
* Ignore certain features that are in the base model, but not
* relevant for the search (esp. MSA subfunctions).
*/
bitmap_andnot(missing, missing, ignored_base_feat, S390_FEAT_MAX);
if (!bitmap_empty(missing, S390_FEAT_MAX)) {
break;
}
Expand Down Expand Up @@ -1210,10 +1218,35 @@ static const TypeInfo host_s390_cpu_type_info = {
};
#endif

static void init_ignored_base_feat(void)
{
static const int feats[] = {
/* MSA subfunctions that could not be available on certain machines */
S390_FEAT_KMAC_DEA,
S390_FEAT_KMAC_TDEA_128,
S390_FEAT_KMAC_TDEA_192,
S390_FEAT_KMC_DEA,
S390_FEAT_KMC_TDEA_128,
S390_FEAT_KMC_TDEA_192,
S390_FEAT_KM_DEA,
S390_FEAT_KM_TDEA_128,
S390_FEAT_KM_TDEA_192,
S390_FEAT_KIMD_SHA_1,
S390_FEAT_KLMD_SHA_1,
};
int i;

for (i = 0; i < ARRAY_SIZE(feats); i++) {
set_bit(feats[i], ignored_base_feat);
}
}

static void register_types(void)
{
int i;

init_ignored_base_feat();

/* init all bitmaps from gnerated data initially */
for (i = 0; i < ARRAY_SIZE(s390_cpu_defs); i++) {
s390_init_feat_bitmap(s390_cpu_defs[i].base_init,
Expand Down

0 comments on commit 30e82de

Please sign in to comment.