From: David Edmondson <david.edmondson@oracle.com>
To: qemu-devel@nongnu.org
Cc: David Edmondson <david.edmondson@oracle.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Eduardo Habkost <ehabkost@redhat.com>,
Richard Henderson <rth@twiddle.net>
Subject: [PATCH] hw/i386: -cpu model,-feature,+feature should enable feature
Date: Tue, 27 Oct 2020 10:28:26 +0000 [thread overview]
Message-ID: <20201027102826.68489-1-david.edmondson@oracle.com> (raw)
"Minus" features are applied after "plus" features, so ensure that a
later "plus" feature causes an earlier "minus" feature to be removed.
This has no effect on the existing "-feature,feature=on" backward
compatibility code (which warns and turns the feature off).
Signed-off-by: David Edmondson <david.edmondson@oracle.com>
---
target/i386/cpu.c | 31 ++++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 0d8606958e..c3dcfb868c 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -4720,13 +4720,30 @@ static void x86_cpu_parse_featurestr(const char *typename, char *features,
GlobalProperty *prop;
/* Compatibility syntax: */
- if (featurestr[0] == '+') {
- plus_features = g_list_append(plus_features,
- g_strdup(featurestr + 1));
- continue;
- } else if (featurestr[0] == '-') {
- minus_features = g_list_append(minus_features,
- g_strdup(featurestr + 1));
+ if (featurestr[0] == '+' || featurestr[0] == '-') {
+ const char *feat = featurestr + 1;
+ GList *val;
+ char *data;
+
+ /* Remove any existing +/- setting. */
+ val = g_list_find_custom(minus_features, feat, compare_string);
+ if (val) {
+ data = val->data;
+ minus_features = g_list_remove(minus_features, data);
+ g_free(data);
+ }
+ val = g_list_find_custom(plus_features, feat, compare_string);
+ if (val) {
+ data = val->data;
+ plus_features = g_list_remove(plus_features, data);
+ g_free(data);
+ }
+
+ if (featurestr[0] == '+') {
+ plus_features = g_list_append(plus_features, g_strdup(feat));
+ } else {
+ minus_features = g_list_append(minus_features, g_strdup(feat));
+ }
continue;
}
--
2.28.0
reply other threads:[~2020-10-27 10:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20201027102826.68489-1-david.edmondson@oracle.com \
--to=david.edmondson@oracle.com \
--cc=ehabkost@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).