From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: Igor Mammedov <imammedo@redhat.com>,
Jiri Denemark <jdenemar@redhat.com>,
"Daniel P. Berrange" <berrange@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: [Qemu-devel] [PATCH v2 3/9] i386: Get model-id from CPU object on "-cpu help"
Date: Thu, 27 Jun 2019 21:28:38 -0300 [thread overview]
Message-ID: <20190628002844.24894-4-ehabkost@redhat.com> (raw)
In-Reply-To: <20190628002844.24894-1-ehabkost@redhat.com>
When introducing versioned CPU models, the string at
X86CPUDefinition::model_id might not be the model-id we'll really
use. Instantiate a CPU object and check the model-id property on
"-cpu help"
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
(New patch, added to series in v2)
---
target/i386/cpu.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 1bdb906e9f..49bf92d3f9 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -3766,18 +3766,28 @@ static GSList *get_sorted_cpu_model_list(void)
return list;
}
+static char *x86_cpu_class_get_model_id(X86CPUClass *xc)
+{
+ Object *obj = object_new(object_class_get_name(OBJECT_CLASS(xc)));
+ char *r = object_property_get_str(obj, "model-id", &error_abort);
+ object_unref(obj);
+ return r;
+}
+
static void x86_cpu_list_entry(gpointer data, gpointer user_data)
{
ObjectClass *oc = data;
X86CPUClass *cc = X86_CPU_CLASS(oc);
char *name = x86_cpu_class_get_model_name(cc);
- const char *desc = cc->model_description;
- if (!desc && cc->cpu_def) {
- desc = cc->cpu_def->model_id;
+ char *desc = g_strdup(cc->model_description);
+
+ if (!desc) {
+ desc = x86_cpu_class_get_model_id(cc);
}
qemu_printf("x86 %-20s %-48s\n", name, desc);
g_free(name);
+ g_free(desc);
}
/* list available CPU models and flags */
--
2.18.0.rc1.1.g3f1ff2140
next prev parent reply other threads:[~2019-06-28 0:30 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-28 0:28 [Qemu-devel] [PATCH v2 0/9] x86 CPU model versioning Eduardo Habkost
2019-06-28 0:28 ` [Qemu-devel] [PATCH v2 1/9] qmp: Add "alias-of" field to query-cpu-definitions Eduardo Habkost
2019-07-02 9:26 ` Daniel P. Berrangé
2019-06-28 0:28 ` [Qemu-devel] [PATCH v2 2/9] i386: Add x-force-features option for testing Eduardo Habkost
2019-07-02 9:30 ` Daniel P. Berrangé
2019-06-28 0:28 ` Eduardo Habkost [this message]
2019-07-02 9:32 ` [Qemu-devel] [PATCH v2 3/9] i386: Get model-id from CPU object on "-cpu help" Daniel P. Berrangé
2019-06-28 0:28 ` [Qemu-devel] [PATCH v2 4/9] i386: Register versioned CPU models Eduardo Habkost
2019-07-02 9:38 ` Daniel P. Berrangé
2019-06-28 0:28 ` [Qemu-devel] [PATCH v2 5/9] i386: Define -IBRS, -noTSX, -IBRS versions of " Eduardo Habkost
2019-07-02 9:40 ` Daniel P. Berrangé
2019-07-02 9:50 ` Daniel P. Berrangé
2019-06-28 0:28 ` [Qemu-devel] [PATCH v2 6/9] i386: Replace -noTSX, -IBRS, -IBPB CPU models with aliases Eduardo Habkost
2019-07-02 9:41 ` Daniel P. Berrangé
2019-06-28 0:28 ` [Qemu-devel] [PATCH v2 7/9] i386: Make unversioned CPU models be aliases Eduardo Habkost
2019-07-02 9:45 ` Daniel P. Berrangé
2019-07-02 13:57 ` Daniel P. Berrangé
2019-06-28 0:28 ` [Qemu-devel] [PATCH v2 8/9] docs: Deprecate CPU model runnability guarantees Eduardo Habkost
2019-07-02 9:46 ` Daniel P. Berrangé
2019-06-28 0:28 ` [Qemu-devel] [PATCH v2 9/9] i386: Add Cascadelake-Server-v2 CPU model Eduardo Habkost
2019-07-01 7:23 ` Xiaoyao Li
2019-07-01 20:38 ` Eduardo Habkost
2019-07-02 9:47 ` Daniel P. Berrangé
2019-07-02 13:55 ` Eduardo Habkost
2019-06-28 1:16 ` [Qemu-devel] [PATCH v2 0/9] x86 CPU model versioning no-reply
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=20190628002844.24894-4-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=berrange@redhat.com \
--cc=dgilbert@redhat.com \
--cc=imammedo@redhat.com \
--cc=jdenemar@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).