From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
"Daniel P. Berrange" <berrange@redhat.com>,
Igor Mammedov <imammedo@redhat.com>
Subject: [PULL 06/10] i386: Register most CPU properties as class properties
Date: Wed, 14 Oct 2020 10:34:11 -0400 [thread overview]
Message-ID: <20201014143415.240472-7-ehabkost@redhat.com> (raw)
In-Reply-To: <20201014143415.240472-1-ehabkost@redhat.com>
Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20200921221045.699690-14-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
target/i386/cpu.c | 66 ++++++++++++++++++++++++-----------------------
1 file changed, 34 insertions(+), 32 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 9eafbe3690..5d713c8528 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6925,44 +6925,12 @@ static void x86_cpu_initfn(Object *obj)
env->nr_dies = 1;
cpu_set_cpustate_pointers(cpu);
- object_property_add(obj, "family", "int",
- x86_cpuid_version_get_family,
- x86_cpuid_version_set_family, NULL, NULL);
- object_property_add(obj, "model", "int",
- x86_cpuid_version_get_model,
- x86_cpuid_version_set_model, NULL, NULL);
- object_property_add(obj, "stepping", "int",
- x86_cpuid_version_get_stepping,
- x86_cpuid_version_set_stepping, NULL, NULL);
- object_property_add_str(obj, "vendor",
- x86_cpuid_get_vendor,
- x86_cpuid_set_vendor);
- object_property_add_str(obj, "model-id",
- x86_cpuid_get_model_id,
- x86_cpuid_set_model_id);
- object_property_add(obj, "tsc-frequency", "int",
- x86_cpuid_get_tsc_freq,
- x86_cpuid_set_tsc_freq, NULL, NULL);
object_property_add(obj, "feature-words", "X86CPUFeatureWordInfo",
x86_cpu_get_feature_words,
NULL, NULL, (void *)env->features);
object_property_add(obj, "filtered-features", "X86CPUFeatureWordInfo",
x86_cpu_get_feature_words,
NULL, NULL, (void *)cpu->filtered_features);
- /*
- * The "unavailable-features" property has the same semantics as
- * CpuDefinitionInfo.unavailable-features on the "query-cpu-definitions"
- * QMP command: they list the features that would have prevented the
- * CPU from running if the "enforce" flag was set.
- */
- object_property_add(obj, "unavailable-features", "strList",
- x86_cpu_get_unavailable_features,
- NULL, NULL, NULL);
-
-#if !defined(CONFIG_USER_ONLY)
- object_property_add(obj, "crash-information", "GuestPanicInformation",
- x86_cpu_get_crash_info_qom, NULL, NULL, NULL);
-#endif
for (w = 0; w < FEATURE_WORDS; w++) {
int bitnr;
@@ -7312,6 +7280,40 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
cc->disas_set_info = x86_disas_set_info;
dc->user_creatable = true;
+
+ object_class_property_add(oc, "family", "int",
+ x86_cpuid_version_get_family,
+ x86_cpuid_version_set_family, NULL, NULL);
+ object_class_property_add(oc, "model", "int",
+ x86_cpuid_version_get_model,
+ x86_cpuid_version_set_model, NULL, NULL);
+ object_class_property_add(oc, "stepping", "int",
+ x86_cpuid_version_get_stepping,
+ x86_cpuid_version_set_stepping, NULL, NULL);
+ object_class_property_add_str(oc, "vendor",
+ x86_cpuid_get_vendor,
+ x86_cpuid_set_vendor);
+ object_class_property_add_str(oc, "model-id",
+ x86_cpuid_get_model_id,
+ x86_cpuid_set_model_id);
+ object_class_property_add(oc, "tsc-frequency", "int",
+ x86_cpuid_get_tsc_freq,
+ x86_cpuid_set_tsc_freq, NULL, NULL);
+ /*
+ * The "unavailable-features" property has the same semantics as
+ * CpuDefinitionInfo.unavailable-features on the "query-cpu-definitions"
+ * QMP command: they list the features that would have prevented the
+ * CPU from running if the "enforce" flag was set.
+ */
+ object_class_property_add(oc, "unavailable-features", "strList",
+ x86_cpu_get_unavailable_features,
+ NULL, NULL, NULL);
+
+#if !defined(CONFIG_USER_ONLY)
+ object_class_property_add(oc, "crash-information", "GuestPanicInformation",
+ x86_cpu_get_crash_info_qom, NULL, NULL, NULL);
+#endif
+
}
static const TypeInfo x86_cpu_type_info = {
--
2.28.0
next prev parent reply other threads:[~2020-10-14 14:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-14 14:34 [PULL 00/10] machine + QOM queue, 2020-10-14 Eduardo Habkost
2020-10-14 14:34 ` [PULL 01/10] rng-egd: Register "chardev" as class property Eduardo Habkost
2020-10-14 14:34 ` [PULL 02/10] rng-random: register "filename" " Eduardo Habkost
2020-10-14 14:34 ` [PULL 03/10] rng: Register "opened" " Eduardo Habkost
2020-10-14 14:34 ` [PULL 04/10] input-linux: Register properties as class properties Eduardo Habkost
2020-10-14 14:34 ` [PULL 05/10] input-barrier: " Eduardo Habkost
2020-10-14 14:34 ` Eduardo Habkost [this message]
2020-10-14 14:34 ` [PULL 07/10] vga-pci: Register "big-endian-framebuffer" as class property Eduardo Habkost
2020-10-14 14:34 ` [PULL 08/10] vhost-user: Register "chardev" " Eduardo Habkost
2020-10-14 14:34 ` [PULL 09/10] authz-list-file: Fix crash when filename is not set Eduardo Habkost
2020-10-14 14:34 ` [PULL 10/10] can-host-socketcan: Fix crash when 'if' option " Eduardo Habkost
2020-10-15 19:30 ` [PULL 00/10] machine + QOM queue, 2020-10-14 Peter Maydell
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=20201014143415.240472-7-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=berrange@redhat.com \
--cc=imammedo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--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).