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.

Signed-off-by: Collin Walling <[email protected]>
Reviewed-by: Hendrik Brueckner <[email protected]>
---
 target/s390x/cpu_features.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c
index 20f9947c7be..297c8129e2d 100644
--- a/target/s390x/cpu_features.c
+++ b/target/s390x/cpu_features.c
@@ -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)        \
-- 
2.55.0


Reply via email to