Currently we check "if bit X is set, bit Y is required". We want to perform "if bit Y is not set, bit X must also not be set" when creating CPU models that will pass all consistency checks.
Signed-off-by: David Hildenbrand <da...@redhat.com> --- target/s390x/cpu_models.c | 115 +++++++++++++++++++------------------- 1 file changed, 58 insertions(+), 57 deletions(-) diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 009afc38b9..57c06e5ea1 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -88,6 +88,59 @@ static S390CPUDef s390_cpu_defs[] = { CPUDEF_INIT(0x8562, 15, 1, 47, 0x08000000U, "gen15b", "IBM 8562 GA1"), }; +static const int cpu_feature_dependencies[][2] = { + { S390_FEAT_IPTE_RANGE, S390_FEAT_DAT_ENH }, + { S390_FEAT_IDTE_SEGMENT, S390_FEAT_DAT_ENH }, + { S390_FEAT_IDTE_REGION, S390_FEAT_DAT_ENH }, + { S390_FEAT_IDTE_REGION, S390_FEAT_IDTE_SEGMENT }, + { S390_FEAT_LOCAL_TLB_CLEARING, S390_FEAT_DAT_ENH}, + { S390_FEAT_LONG_DISPLACEMENT_FAST, S390_FEAT_LONG_DISPLACEMENT }, + { S390_FEAT_DFP_FAST, S390_FEAT_DFP }, + { S390_FEAT_TRANSACTIONAL_EXE, S390_FEAT_STFLE_49 }, + { S390_FEAT_EDAT_2, S390_FEAT_EDAT}, + { S390_FEAT_MSA_EXT_5, S390_FEAT_KIMD_SHA_512 }, + { S390_FEAT_MSA_EXT_5, S390_FEAT_KLMD_SHA_512 }, + { S390_FEAT_MSA_EXT_4, S390_FEAT_MSA_EXT_3 }, + { S390_FEAT_SIE_CMMA, S390_FEAT_CMM }, + { S390_FEAT_SIE_CMMA, S390_FEAT_SIE_GSLS }, + { S390_FEAT_SIE_PFMFI, S390_FEAT_EDAT }, + { S390_FEAT_MSA_EXT_8, S390_FEAT_MSA_EXT_3 }, + { S390_FEAT_MSA_EXT_9, S390_FEAT_MSA_EXT_3 }, + { S390_FEAT_MSA_EXT_9, S390_FEAT_MSA_EXT_4 }, + { S390_FEAT_MULTIPLE_EPOCH, S390_FEAT_TOD_CLOCK_STEERING }, + { S390_FEAT_VECTOR_PACKED_DECIMAL, S390_FEAT_VECTOR }, + { S390_FEAT_VECTOR_ENH, S390_FEAT_VECTOR }, + { S390_FEAT_INSTRUCTION_EXEC_PROT, S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2 }, + { S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2, S390_FEAT_ESOP }, + { S390_FEAT_CMM_NT, S390_FEAT_CMM }, + { S390_FEAT_GUARDED_STORAGE, S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2 }, + { S390_FEAT_MULTIPLE_EPOCH, S390_FEAT_STORE_CLOCK_FAST }, + { S390_FEAT_MULTIPLE_EPOCH, S390_FEAT_TOD_CLOCK_STEERING }, + { S390_FEAT_SEMAPHORE_ASSIST, S390_FEAT_STFLE_49 }, + { S390_FEAT_KIMD_SHA3_224, S390_FEAT_MSA }, + { S390_FEAT_KIMD_SHA3_256, S390_FEAT_MSA }, + { S390_FEAT_KIMD_SHA3_384, S390_FEAT_MSA }, + { S390_FEAT_KIMD_SHA3_512, S390_FEAT_MSA }, + { S390_FEAT_KIMD_SHAKE_128, S390_FEAT_MSA }, + { S390_FEAT_KIMD_SHAKE_256, S390_FEAT_MSA }, + { S390_FEAT_KLMD_SHA3_224, S390_FEAT_MSA }, + { S390_FEAT_KLMD_SHA3_256, S390_FEAT_MSA }, + { S390_FEAT_KLMD_SHA3_384, S390_FEAT_MSA }, + { S390_FEAT_KLMD_SHA3_512, S390_FEAT_MSA }, + { S390_FEAT_KLMD_SHAKE_128, S390_FEAT_MSA }, + { S390_FEAT_KLMD_SHAKE_256, S390_FEAT_MSA }, + { S390_FEAT_PRNO_TRNG_QRTCR, S390_FEAT_MSA_EXT_5 }, + { S390_FEAT_PRNO_TRNG, S390_FEAT_MSA_EXT_5 }, + { S390_FEAT_SIE_KSS, S390_FEAT_SIE_F2 }, + { S390_FEAT_AP_QUERY_CONFIG_INFO, S390_FEAT_AP }, + { S390_FEAT_AP_FACILITIES_TEST, S390_FEAT_AP }, + { S390_FEAT_PTFF_QSIE, S390_FEAT_MULTIPLE_EPOCH }, + { S390_FEAT_PTFF_QTOUE, S390_FEAT_MULTIPLE_EPOCH }, + { S390_FEAT_PTFF_STOE, S390_FEAT_MULTIPLE_EPOCH }, + { S390_FEAT_PTFF_STOUE, S390_FEAT_MULTIPLE_EPOCH }, + { S390_FEAT_AP_QUEUE_INTERRUPT_CONTROL, S390_FEAT_AP }, +}; + #define QEMU_MAX_CPU_TYPE 0x2964 #define QEMU_MAX_CPU_GEN 13 #define QEMU_MAX_CPU_EC_GA 2 @@ -768,66 +821,14 @@ CpuModelBaselineInfo *qmp_query_cpu_model_baseline(CpuModelInfo *infoa, static void check_consistency(const S390CPUModel *model) { - static int dep[][2] = { - { S390_FEAT_IPTE_RANGE, S390_FEAT_DAT_ENH }, - { S390_FEAT_IDTE_SEGMENT, S390_FEAT_DAT_ENH }, - { S390_FEAT_IDTE_REGION, S390_FEAT_DAT_ENH }, - { S390_FEAT_IDTE_REGION, S390_FEAT_IDTE_SEGMENT }, - { S390_FEAT_LOCAL_TLB_CLEARING, S390_FEAT_DAT_ENH}, - { S390_FEAT_LONG_DISPLACEMENT_FAST, S390_FEAT_LONG_DISPLACEMENT }, - { S390_FEAT_DFP_FAST, S390_FEAT_DFP }, - { S390_FEAT_TRANSACTIONAL_EXE, S390_FEAT_STFLE_49 }, - { S390_FEAT_EDAT_2, S390_FEAT_EDAT}, - { S390_FEAT_MSA_EXT_5, S390_FEAT_KIMD_SHA_512 }, - { S390_FEAT_MSA_EXT_5, S390_FEAT_KLMD_SHA_512 }, - { S390_FEAT_MSA_EXT_4, S390_FEAT_MSA_EXT_3 }, - { S390_FEAT_SIE_CMMA, S390_FEAT_CMM }, - { S390_FEAT_SIE_CMMA, S390_FEAT_SIE_GSLS }, - { S390_FEAT_SIE_PFMFI, S390_FEAT_EDAT }, - { S390_FEAT_MSA_EXT_8, S390_FEAT_MSA_EXT_3 }, - { S390_FEAT_MSA_EXT_9, S390_FEAT_MSA_EXT_3 }, - { S390_FEAT_MSA_EXT_9, S390_FEAT_MSA_EXT_4 }, - { S390_FEAT_MULTIPLE_EPOCH, S390_FEAT_TOD_CLOCK_STEERING }, - { S390_FEAT_VECTOR_PACKED_DECIMAL, S390_FEAT_VECTOR }, - { S390_FEAT_VECTOR_ENH, S390_FEAT_VECTOR }, - { S390_FEAT_INSTRUCTION_EXEC_PROT, S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2 }, - { S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2, S390_FEAT_ESOP }, - { S390_FEAT_CMM_NT, S390_FEAT_CMM }, - { S390_FEAT_GUARDED_STORAGE, S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2 }, - { S390_FEAT_MULTIPLE_EPOCH, S390_FEAT_STORE_CLOCK_FAST }, - { S390_FEAT_MULTIPLE_EPOCH, S390_FEAT_TOD_CLOCK_STEERING }, - { S390_FEAT_SEMAPHORE_ASSIST, S390_FEAT_STFLE_49 }, - { S390_FEAT_KIMD_SHA3_224, S390_FEAT_MSA }, - { S390_FEAT_KIMD_SHA3_256, S390_FEAT_MSA }, - { S390_FEAT_KIMD_SHA3_384, S390_FEAT_MSA }, - { S390_FEAT_KIMD_SHA3_512, S390_FEAT_MSA }, - { S390_FEAT_KIMD_SHAKE_128, S390_FEAT_MSA }, - { S390_FEAT_KIMD_SHAKE_256, S390_FEAT_MSA }, - { S390_FEAT_KLMD_SHA3_224, S390_FEAT_MSA }, - { S390_FEAT_KLMD_SHA3_256, S390_FEAT_MSA }, - { S390_FEAT_KLMD_SHA3_384, S390_FEAT_MSA }, - { S390_FEAT_KLMD_SHA3_512, S390_FEAT_MSA }, - { S390_FEAT_KLMD_SHAKE_128, S390_FEAT_MSA }, - { S390_FEAT_KLMD_SHAKE_256, S390_FEAT_MSA }, - { S390_FEAT_PRNO_TRNG_QRTCR, S390_FEAT_MSA_EXT_5 }, - { S390_FEAT_PRNO_TRNG, S390_FEAT_MSA_EXT_5 }, - { S390_FEAT_SIE_KSS, S390_FEAT_SIE_F2 }, - { S390_FEAT_AP_QUERY_CONFIG_INFO, S390_FEAT_AP }, - { S390_FEAT_AP_FACILITIES_TEST, S390_FEAT_AP }, - { S390_FEAT_PTFF_QSIE, S390_FEAT_MULTIPLE_EPOCH }, - { S390_FEAT_PTFF_QTOUE, S390_FEAT_MULTIPLE_EPOCH }, - { S390_FEAT_PTFF_STOE, S390_FEAT_MULTIPLE_EPOCH }, - { S390_FEAT_PTFF_STOUE, S390_FEAT_MULTIPLE_EPOCH }, - { S390_FEAT_AP_QUEUE_INTERRUPT_CONTROL, S390_FEAT_AP }, - }; int i; - for (i = 0; i < ARRAY_SIZE(dep); i++) { - if (test_bit(dep[i][0], model->features) && - !test_bit(dep[i][1], model->features)) { + for (i = 0; i < ARRAY_SIZE(cpu_feature_dependencies); i++) { + if (test_bit(cpu_feature_dependencies[i][0], model->features) && + !test_bit(cpu_feature_dependencies[i][1], model->features)) { warn_report("\'%s\' requires \'%s\'.", - s390_feat_def(dep[i][0])->name, - s390_feat_def(dep[i][1])->name); + s390_feat_def(cpu_feature_dependencies[i][0])->name, + s390_feat_def(cpu_feature_dependencies[i][1])->name); } } } -- 2.21.0