Skip to contentSkip to conversation

s390: mark features that depend on deprecated features as deprecated

PATCH Superseded Collin Walling 2 participants 5 messages Oct 8 – Oct 9

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#1 lore raw

PATCH 1/2 target/s390x: externalize feat dependency array

In reply to Collin Walling

Move the feature dependency array (dep[][2]) from cpu_models.c to cpu_features.c, rename the array to s390_feat_deps, and externalize its length.

This will allow the array to be used between both files.

---
 target/s390x/cpu_features.c | 126 ++++++++++++++++++++++++++++++++++
 target/s390x/cpu_features.h |   4 ++
 target/s390x/cpu_models.c   | 133 ++----------------------------------
 3 files changed, 135 insertions(+), 128 deletions(-)
target/s390x/cpu_features.c +126 -0
index c634e741236..20f9947c7be 100644
@@ -223,6 +223,132 @@ void s390_feat_bitmap_to_ascii(const S390FeatBitmap features, void *opaque,
     };
 }
 
+const int s390_feat_deps[][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_PACKED_DECIMAL_ENH, S390_FEAT_VECTOR_PACKED_DECIMAL },
+    { S390_FEAT_VECTOR_PACKED_DECIMAL_ENH2, S390_FEAT_VECTOR_PACKED_DECIMAL_ENH },
+    { S390_FEAT_VECTOR_PACKED_DECIMAL_ENH3, S390_FEAT_VECTOR_PACKED_DECIMAL_ENH2 },
+    { S390_FEAT_VECTOR_ENH, S390_FEAT_VECTOR },
+    { S390_FEAT_VECTOR_ENH2, S390_FEAT_VECTOR_ENH },
+    { S390_FEAT_VECTOR_ENH3, S390_FEAT_VECTOR_ENH2 },
+    { 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_KMAC_HMAC_SHA_224, S390_FEAT_MSA_EXT_3 },
+    { S390_FEAT_KMAC_HMAC_SHA_256, S390_FEAT_MSA_EXT_3 },
+    { S390_FEAT_KMAC_HMAC_SHA_384, S390_FEAT_MSA_EXT_3 },
+    { S390_FEAT_KMAC_HMAC_SHA_512, S390_FEAT_MSA_EXT_3 },
+    { S390_FEAT_KMAC_HMAC_ESHA_224, S390_FEAT_MSA_EXT_3 },
+    { S390_FEAT_KMAC_HMAC_ESHA_256, S390_FEAT_MSA_EXT_3 },
+    { S390_FEAT_KMAC_HMAC_ESHA_384, S390_FEAT_MSA_EXT_3 },
+    { S390_FEAT_KMAC_HMAC_ESHA_512, S390_FEAT_MSA_EXT_3 },
+    { S390_FEAT_KM_FULL_XTS_AES_128, S390_FEAT_MSA_EXT_4 },
+    { S390_FEAT_KM_FULL_XTS_AES_256, S390_FEAT_MSA_EXT_4 },
+    { S390_FEAT_KM_FULL_XTS_EAES_128, S390_FEAT_MSA_EXT_4 },
+    { S390_FEAT_KM_FULL_XTS_EAES_256, S390_FEAT_MSA_EXT_4 },
+    { 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 },
+    { S390_FEAT_DIAG_318, S390_FEAT_EXTENDED_LENGTH_SCCB },
+    { S390_FEAT_CERT_STORE, S390_FEAT_EXTENDED_LENGTH_SCCB },
+    { S390_FEAT_SIPL, S390_FEAT_EXTENDED_LENGTH_SCCB },
+    { S390_FEAT_SCLAF, S390_FEAT_EXTENDED_LENGTH_SCCB },
+    { S390_FEAT_SCLAF, S390_FEAT_SIPL },
+    { S390_FEAT_NNPA, S390_FEAT_VECTOR },
+    { S390_FEAT_RDP, S390_FEAT_LOCAL_TLB_CLEARING },
+    { S390_FEAT_UV_FEAT_AP, S390_FEAT_AP },
+    { S390_FEAT_UV_FEAT_AP_INTR, S390_FEAT_UV_FEAT_AP },
+    { S390_FEAT_PFCR_QAF, S390_FEAT_CCF_BASE },
+    { S390_FEAT_PFCR_CSDST, S390_FEAT_CCF_BASE },
+    { S390_FEAT_PFCR_CSDSTG, S390_FEAT_CCF_BASE },
+    { S390_FEAT_PFCR_CSTST, S390_FEAT_CCF_BASE },
+    { S390_FEAT_PFCR_CSTSTG, S390_FEAT_CCF_BASE },
+    { S390_FEAT_INEFF_NC_TX, S390_FEAT_TRANSACTIONAL_EXE },
+    { S390_FEAT_PLO_CLO, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_CSO, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_DCSO, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_CSSTO, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_CSDSTO, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_CSTSTO, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_TCS, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_TCSG, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_TCSX, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_TCSO, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_QCS, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_QCSG, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_QCSX, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_QCSO, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_LO, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_DLX, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_DLO, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_TL, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_TLG, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_TLX, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_TLO, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_QL, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_QLG, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_QLX, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_QLO, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_STO, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_DST, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_DSTG, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_DSTX, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_DSTO, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_TST, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_TSTG, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_TSTX, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_TSTO, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_QST, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_QSTG, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_QSTX, S390_FEAT_PLO_EXT },
+    { S390_FEAT_PLO_QSTO, S390_FEAT_PLO_EXT },
+    { S390_FEAT_SIE_ASTFLEIE2, S390_FEAT_STFLE },
+};
+
+const size_t s390_feat_deps_len = ARRAY_SIZE(s390_feat_deps);
+
 void s390_get_deprecated_features(S390FeatBitmap features)
 {
     static const int feats[] = {
target/s390x/cpu_features.h +4 -0
index 421978faa40..8097b219599 100644
@@ -57,6 +57,10 @@ typedef struct {
     int bit;                /* bit within the feature type area (fixed) */
 } S390FeatDef;
 
+/* Tuple of features[][0] that depend on other features[][1] */
+extern const int s390_feat_deps[][2];
+extern const size_t s390_feat_deps_len;
+
 /* use ordinary bitmap operations to work with features */
 typedef unsigned long S390FeatBitmap[BITS_TO_LONGS(S390_FEAT_MAX)];
 
target/s390x/cpu_models.c +5 -128

142 lines not on this page · raw message

Signature · 1 line
2.55.0
#2 lore raw

PATCH 2/2 target/s390x: mark feats dependent on deprecated feats as deprecated

In reply to Collin Walling

There are certain CPU model features that depend on other features that are flagged for deprecation. For example ineff_nc_tx depends on the te deprecated feature.

If a user defines a VM with the current list of deprecated features disabled, the following is observed:

warning: 'ineff_nc_tx' requires 'te'

In some cases, this will cause a VM to crash or it may refuse to start.

To alleviate this, add these "dependent features" to the deprecated features list. This allows the user to see *all* features that should be disabled to ensure a successful migration to a host system that does not support certain deprecated features.

---
 target/s390x/cpu_features.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
target/s390x/cpu_features.c +10 -1
index 20f9947c7be..297c8129e2d 100644
@@ -359,11 +359,20 @@ void s390_get_deprecated_features(S390FeatBitmap features)
          S390_FEAT_CONSTRAINT_TRANSACTIONAL_EXE,
          S390_FEAT_TRANSACTIONAL_EXE
     };
-    int i;
+    int i, j;
 
     for (i = 0; i < ARRAY_SIZE(feats); i++) {
         set_bit(feats[i], features);
     }
+
+    /* Mark features that depend on feats[] */
+    for (i = 0; i < ARRAY_SIZE(feats); i++) {
+        for (j = 0; j < s390_feat_deps_len; j++) {
+            if (s390_feat_deps[j][1] == feats[i]) {
+                set_bit(s390_feat_deps[j][0], features);
+            }
+        }
+    }
 }
 
 #define FEAT_GROUP_INIT(_name, _group, _desc)        \
Signature · 1 line
2.55.0
#0 lore raw

cover s390: mark features that depend on deprecated features as deprecated

When the CPU model deprecated-features work was completed in QEMU, features that have a dependency on a deprecated feature were not themselves marked deprecated. This patch series corrects that oversight.

Specifically, ineff_nc_tx depends on te, which has been deprecated. When a user starts a VM with deprecated features disabled, QEMU currently emits:

warning: 'ineff_nc_tx' requires 'te'

In most cases this is only a warning, but it can also cause the VM to fail to start entirely. One observed instance is virt-install aborting due to this warning.

With these patches, query-cpu-model-expansion includes ineff_nc_tx in the deprecated-props array alongside the other deprecated features:

{

  "return": {
    "deprecated-props": [
      "ineff_nc_tx",
      "bpb",
      "te",
      "cte",
      "csske"
    ],
    "model": {
      "name": "gen17a-base",
      "props": { ... }
    }

}
}

libvirt uses this response to determine which features to disable when the deprecated_features=on|off attribute is set. With these patches, ineff_nc_tx will be disabled along with the other deprecated features. The result can be verified with virsh domcapabilities:

$ virsh domcapabilities --disable-deprecated-features \
    --xpath "/domainCapabilities/cpu/mode[@name='host-model']/feature[@policy='disable']"
<feature policy="disable" name="bpb"/>
<feature policy="disable" name="csske"/>
<feature policy="disable" name="cte"/>
<feature policy="disable" name="ineff_nc_tx"/>
<feature policy="disable" name="te"/>

Collin L. Walling (2):
target/s390x: externalize feat dependency array target/s390x: mark feats dependent on deprecated feats as deprecated

 target/s390x/cpu_features.c | 137 +++++++++++++++++++++++++++++++++++-
 target/s390x/cpu_features.h |   4 ++
 target/s390x/cpu_models.c   | 133 ++--------------------------------
 3 files changed, 145 insertions(+), 129 deletions(-)
Signature · 1 line
2.55.0
#3 lore raw

Re: [PATCH v1 2/2] target/s390x: mark feats dependent on deprecated feats as deprecated

In reply to Collin Walling
Quoted 11 lines · Collin Walling

There are certain CPU model features that depend on other features that are flagged for deprecation. For example ineff_nc_tx depends on the te deprecated feature.

If a user defines a VM with the current list of deprecated features disabled, the following is observed:

warning: 'ineff_nc_tx' requires 'te'

In some cases, this will cause a VM to crash or it may refuse to start.

Does this need cc stable and/or a fixes tag then?

#4 lore raw

Re: [PATCH v1 2/2] target/s390x: mark feats dependent on deprecated feats as deprecated

Quoted 8 lines · Matthew Rosato
Quoted 7 lines · Collin Walling

There are certain CPU model features that depend on other features that are flagged for deprecation. For example ineff_nc_tx depends on the te deprecated feature.

If a user defines a VM with the current list of deprecated features disabled, the following is observed:

Quoted 9 lines
Quoted 4 lines

warning: 'ineff_nc_tx' requires 'te'

In some cases, this will cause a VM to crash or it may refuse to start.

Does this need cc stable and/or a fixes tag then?

Yes, I should've tagged one of the deprecated features patches. I think the one where te was flagged is appropriate:

Fixes 6e55b32d45 ("target/s390x: flag te and cte as deprecated")
Signature · 2 lines
Regards,
  Collin