Part of the query-cpu-definitions return payload includes an array of of "unavailable-features" which helps determine if the CPU model is compatible with the system's configuration. When a KVM guest is using a CPU model with deprecated features disabled, query-cpu-definitions will claim that certain models are incompatible due to these features missing.
Since deprecated features are preferred to be disabled for s390 CPU models, lets filter them out from the "missing" features list. Signed-off-by: Collin Walling <[email protected]> --- Examples output of query-cpu-definitions ran on a gen17a host: WithOUT patch: ``` { "return": [ { "name": "z13", "typename": "z13-s390x-cpu", "unavailable-features": [ "csske" ], "static": false, "migration-safe": true, "deprecated": false }, ... ``` WITH patch: ``` { "return": [ { "name": "z13", "typename": "z13-s390x-cpu", "unavailable-features": [], "static": false, "migration-safe": true, "deprecated": false }, ... ``` --- target/s390x/cpu_models_system.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/s390x/cpu_models_system.c b/target/s390x/cpu_models_system.c index 5b846048675..f2f6b00b547 100644 --- a/target/s390x/cpu_models_system.c +++ b/target/s390x/cpu_models_system.c @@ -28,6 +28,7 @@ static void check_unavailable_features(const S390CPUModel *max_model, strList **unavailable) { S390FeatBitmap missing; + S390FeatBitmap deprecated_feats; /* check general model compatibility */ if (max_model->def->gen < model->def->gen || @@ -39,6 +40,13 @@ static void check_unavailable_features(const S390CPUModel *max_model, /* detect missing features if any to properly report them */ bitmap_andnot(missing, model->features, max_model->features, S390_FEAT_MAX); + + /* deprecated features are optional so do not report them as missing */ + bitmap_zero(deprecated_feats, S390_FEAT_MAX); + s390_get_deprecated_features(deprecated_feats); + + bitmap_andnot(missing, missing, deprecated_feats, S390_FEAT_MAX); + if (!bitmap_empty(missing, S390_FEAT_MAX)) { s390_feat_bitmap_to_ascii(missing, unavailable, list_add_feat); } -- 2.54.0
