From: Collin Walling <walling@linux.ibm.com>
To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org
Cc: thuth@redhat.com, david@redhat.com, wangyanan55@huawei.com,
philmd@linaro.org, marcel.apfelbaum@gmail.com,
eduardo@habkost.net, armbru@redhat.com,
Collin Walling <walling@linux.ibm.com>
Subject: [PATCH v2 2/3] target/s390x: add support for "disable-deprecated-feats" expansion option
Date: Tue, 23 Apr 2024 17:06:54 -0400 [thread overview]
Message-ID: <20240423210655.66656-3-walling@linux.ibm.com> (raw)
In-Reply-To: <20240423210655.66656-1-walling@linux.ibm.com>
Retain a list of deprecated features disjoint from any particular
CPU model. When a query-cpu-model-expansion is provided with the
"disable-deprecated-feats" option set, the resulting properties list
will include all deprecated features paired with false. Example:
{ ... "bpb": false, "csske": false, ...}
It is recommended that s390 guests operate with these features
explicitly disabled to ensure compatability with future hardware.
Signed-off-by: Collin Walling <walling@linux.ibm.com>
---
target/s390x/cpu_features.c | 14 ++++++++++++++
target/s390x/cpu_features.h | 1 +
target/s390x/cpu_models_sysemu.c | 20 ++++++++++++--------
3 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c
index d28eb65845..efafc9711c 100644
--- a/target/s390x/cpu_features.c
+++ b/target/s390x/cpu_features.c
@@ -212,6 +212,20 @@ void s390_feat_bitmap_to_ascii(const S390FeatBitmap features, void *opaque,
};
}
+void s390_get_deprecated_features(S390FeatBitmap features)
+{
+ static const int feats[] = {
+ /* CSSKE is deprecated on newer generations */
+ S390_FEAT_CONDITIONAL_SSKE,
+ S390_FEAT_BPB,
+ };
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(feats); i++) {
+ set_bit(feats[i], features);
+ }
+}
+
#define FEAT_GROUP_INIT(_name, _group, _desc) \
{ \
.name = _name, \
diff --git a/target/s390x/cpu_features.h b/target/s390x/cpu_features.h
index a9bd68a2e1..661a8cd6db 100644
--- a/target/s390x/cpu_features.h
+++ b/target/s390x/cpu_features.h
@@ -69,6 +69,7 @@ void s390_add_from_feat_block(S390FeatBitmap features, S390FeatType type,
uint8_t *data);
void s390_feat_bitmap_to_ascii(const S390FeatBitmap features, void *opaque,
void (*fn)(const char *name, void *opaque));
+void s390_get_deprecated_features(S390FeatBitmap features);
/* Definition of a CPU feature group */
typedef struct {
diff --git a/target/s390x/cpu_models_sysemu.c b/target/s390x/cpu_models_sysemu.c
index ef9fa80efd..b002819188 100644
--- a/target/s390x/cpu_models_sysemu.c
+++ b/target/s390x/cpu_models_sysemu.c
@@ -171,7 +171,8 @@ static void qdict_add_enabled_feat(const char *name, void *opaque)
/* convert S390CPUDef into a static CpuModelInfo */
static void cpu_info_from_model(CpuModelInfo *info, const S390CPUModel *model,
- bool delta_changes)
+ bool delta_changes,
+ bool disable_deprecated_feats)
{
QDict *qdict = qdict_new();
S390FeatBitmap bitmap;
@@ -201,6 +202,13 @@ static void cpu_info_from_model(CpuModelInfo *info, const S390CPUModel *model,
s390_feat_bitmap_to_ascii(bitmap, qdict, qdict_add_disabled_feat);
}
+ /* features flagged as deprecated */
+ if (disable_deprecated_feats) {
+ bitmap_zero(bitmap, S390_FEAT_MAX);
+ s390_get_deprecated_features(bitmap);
+ s390_feat_bitmap_to_ascii(bitmap, qdict, qdict_add_disabled_feat);
+ }
+
if (!qdict_size(qdict)) {
qobject_unref(qdict);
} else {
@@ -219,11 +227,6 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
S390CPUModel s390_model;
bool delta_changes = false;
- if (has_disable_deprecated_feats) {
- error_setg(&err, "Unsupported option 'disable-deprecated-feats'");
- return NULL;
- }
-
/* convert it to our internal representation */
cpu_model_from_info(&s390_model, model, "model", &err);
if (err) {
@@ -241,7 +244,8 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
/* convert it back to a static representation */
expansion_info = g_new0(CpuModelExpansionInfo, 1);
expansion_info->model = g_malloc0(sizeof(*expansion_info->model));
- cpu_info_from_model(expansion_info->model, &s390_model, delta_changes);
+ cpu_info_from_model(expansion_info->model, &s390_model,
+ delta_changes, disable_deprecated_feats);
return expansion_info;
}
@@ -390,7 +394,7 @@ CpuModelBaselineInfo *qmp_query_cpu_model_baseline(CpuModelInfo *infoa,
baseline_info = g_new0(CpuModelBaselineInfo, 1);
baseline_info->model = g_malloc0(sizeof(*baseline_info->model));
- cpu_info_from_model(baseline_info->model, &model, true);
+ cpu_info_from_model(baseline_info->model, &model, true, false);
return baseline_info;
}
--
2.43.0
next prev parent reply other threads:[~2024-04-23 21:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-23 21:06 [PATCH v2 0/3] query-cpu-model-expansion: add disable-deprecated-feats arg Collin Walling
2024-04-23 21:06 ` [PATCH v2 1/3] cpu-models: add "disable-deprecated-feats" option to cpu model expansion Collin Walling
2024-04-24 6:19 ` Markus Armbruster
2024-04-24 17:46 ` Collin Walling
2024-04-25 6:31 ` Markus Armbruster
2024-04-25 17:35 ` Collin Walling
2024-04-26 8:18 ` Markus Armbruster
2024-04-24 8:20 ` Daniel P. Berrangé
2024-04-24 17:51 ` Collin Walling
2024-04-24 19:12 ` Collin Walling
2024-04-25 13:35 ` Daniel P. Berrangé
2024-04-25 16:58 ` Collin Walling
2024-04-23 21:06 ` Collin Walling [this message]
2024-04-24 7:24 ` [PATCH v2 2/3] target/s390x: add support for "disable-deprecated-feats" expansion option David Hildenbrand
2024-04-24 18:33 ` Collin Walling
2024-04-25 8:10 ` David Hildenbrand
2024-04-25 16:56 ` Collin Walling
2024-04-23 21:06 ` [PATCH v2 3/3] target/s390x: flag te and cte as deprecated Collin Walling
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240423210655.66656-3-walling@linux.ibm.com \
--to=walling@linux.ibm.com \
--cc=armbru@redhat.com \
--cc=david@redhat.com \
--cc=eduardo@habkost.net \
--cc=marcel.apfelbaum@gmail.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=thuth@redhat.com \
--cc=wangyanan55@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).