[PATCH v2 0/3] query-cpu-model-expansion: add disable-deprecated-feats arg

Collin Walling posted 3 patches 1 week, 3 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240423210655.66656-1-walling@linux.ibm.com
Maintainers: Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Yanan Wang <wangyanan55@huawei.com>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, David Hildenbrand <david@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Ilya Leoshkevich <iii@linux.ibm.com>, Thomas Huth <thuth@redhat.com>
qapi/machine-target.json         |  7 ++++++-
target/arm/arm-qmp-cmds.c        |  7 +++++++
target/i386/cpu-sysemu.c         |  7 +++++++
target/s390x/cpu_features.c      | 17 +++++++++++++++++
target/s390x/cpu_features.h      |  1 +
target/s390x/cpu_models_sysemu.c | 17 ++++++++++++++---
6 files changed, 52 insertions(+), 4 deletions(-)
[PATCH v2 0/3] query-cpu-model-expansion: add disable-deprecated-feats arg
Posted by Collin Walling 1 week, 3 days ago
The current implementation of query-cpu-model-expansion is lacking a way to
conditionally retrieve CPU models with properties (i.e. features) that are
flagged as deprecated set to disabled. To remedy this, a new optional boolean
"disable-deprecated-feats" argument has been added to the query.

Here is a sample QMP command that includes this new argument:

    { "execute": "query-cpu-model-expansion", "arguments": { "type": "full", "model": { "name": "host" }, "disable-deprecated-features": true}}

This patchset adds full support for this argument on s390x. A simple interface is
designed that contains an array of feature bits that are flagged for deprecation.
This list may be easily populated with more features in the future.

    void s390_get_deprecated_features(S390FeatBitmap features)
    {
        static const int feats[] = {
             /* CSSKE is deprecated on newer generations */
             S390_FEAT_CONDITIONAL_SSKE,
             S390_FEAT_BPB,
             /* Deprecated on z16 */
             S390_FEAT_CONSTRAINT_TRANSACTIONAL_EXE,
             S390_FEAT_TRANSACTIONAL_EXE
        };
        int i;

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

For architectures that support model expansion but do not support the new arg,
an error message will print to stdio if this option is present.

Use case example:

Newer s390 machines may signal the end-of-support for particular CPU features,
rendering guests operating with older CPU models incapable of running on
said machines. A manual effort to disable certain CPU features would be
required.

This feature may alleviate this issue by allowing for a query of a CPU model
with deprecated features listed in the props response paired with false. The
caller of this query may use this information to explicitly disable these
features for the guest's CPU model, ensuring a safe migration to the next
generation if desired.

I have developed a way for libvirt to make use of this functionality, but I
will hold back review on those patches until a QEMU interface is agreed upon.

Collin L. Walling (3):
  cpu-models: add "disable-deprecated-feats" option to cpu model
    expansion
  target/s390x: add support for "disable-deprecated-feats" expansion
    option
  target/s390x: flag te and cte as deprecated

 qapi/machine-target.json         |  7 ++++++-
 target/arm/arm-qmp-cmds.c        |  7 +++++++
 target/i386/cpu-sysemu.c         |  7 +++++++
 target/s390x/cpu_features.c      | 17 +++++++++++++++++
 target/s390x/cpu_features.h      |  1 +
 target/s390x/cpu_models_sysemu.c | 17 ++++++++++++++---
 6 files changed, 52 insertions(+), 4 deletions(-)

-- 
2.43.0