From: Wei Huang <wei@redhat.com>
To: qemu-devel@nongnu.org
Cc: wei@redhat.com, peter.maydell@linaro.org, drjones@redhat.com,
qemu-arm@nongnu.org, abologna@redhat.com
Subject: [Qemu-devel] [PATCH RFC 2/2] arm: virt: Move machine class init code to the abstract machine type
Date: Mon, 22 Feb 2016 16:06:38 -0500 [thread overview]
Message-ID: <1456175198-25210-3-git-send-email-wei@redhat.com> (raw)
In-Reply-To: <1456175198-25210-1-git-send-email-wei@redhat.com>
This patch moves the common class initialization code from
"virt-2.5" to the new abstract class. An empty property is added to
"virt-2.5" machine. In the meanwhile, related machine funtion are
renamed to "virt_2_5_blah_blah" for consistency.
Signed-off-by: Wei Huang <wei@redhat.com>
---
hw/arm/virt.c | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index ee15301..650dfe6 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1253,6 +1253,18 @@ static void virt_set_gic_version(Object *obj, const char *value, Error **errp)
static void virt_machine_class_init(ObjectClass *oc, void *data)
{
+ MachineClass *mc = MACHINE_CLASS(oc);
+
+ mc->init = machvirt_init;
+ /* Start max_cpus at the maximum QEMU supports. We'll further restrict
+ * it later in machvirt_init, where we have more information about the
+ * configuration of the particular instance.
+ */
+ mc->max_cpus = MAX_CPUMASK_BITS;
+ mc->has_dynamic_sysbus = true;
+ mc->block_default_type = IF_VIRTIO;
+ mc->no_cdrom = 1;
+ mc->pci_allow_0_address = true;
}
static const TypeInfo virt_machine_info = {
@@ -1264,7 +1276,7 @@ static const TypeInfo virt_machine_info = {
.class_init = virt_machine_class_init,
};
-static void virt_instance_init(Object *obj)
+static void virt_2_5_instance_init(Object *obj)
{
VirtMachineState *vms = VIRT_MACHINE(obj);
@@ -1297,30 +1309,24 @@ static void virt_instance_init(Object *obj)
"Valid values are 2, 3 and host", NULL);
}
-static void virt_class_init(ObjectClass *oc, void *data)
+static void virt_2_5_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
+ static GlobalProperty compat_props[] = {
+ { /* end of list */ }
+ };
mc->desc = "QEMU 2.5 ARM Virtual Machine";
mc->alias = "virt";
mc->is_default = 1;
- mc->init = machvirt_init;
- /* Start max_cpus at the maximum QEMU supports. We'll further restrict
- * it later in machvirt_init, where we have more information about the
- * configuration of the particular instance.
- */
- mc->max_cpus = MAX_CPUMASK_BITS;
- mc->has_dynamic_sysbus = true;
- mc->block_default_type = IF_VIRTIO;
- mc->no_cdrom = 1;
- mc->pci_allow_0_address = true;
+ mc->compat_props = compat_props;
}
static const TypeInfo machvirt_info = {
.name = MACHINE_TYPE_NAME("virt-2.5"),
.parent = TYPE_VIRT_MACHINE,
- .instance_init = virt_instance_init,
- .class_init = virt_class_init,
+ .instance_init = virt_2_5_instance_init,
+ .class_init = virt_2_5_class_init,
};
static void machvirt_machine_init(void)
--
1.8.3.1
next prev parent reply other threads:[~2016-02-22 21:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-22 21:06 [Qemu-devel] [PATCH RFC 0/2] Versioning ARM virt machine types Wei Huang
2016-02-22 21:06 ` [Qemu-devel] [PATCH RFC 1/2] arm: virt: Add an abstract ARM virt machine type Wei Huang
2016-02-22 21:06 ` Wei Huang [this message]
2016-02-22 22:14 ` [Qemu-devel] [PATCH RFC 0/2] Versioning ARM virt machine types Peter Maydell
2016-02-23 18:34 ` Wei Huang
2016-02-23 18:42 ` Peter Maydell
2016-02-23 19:09 ` Andrew Jones
2016-03-10 9:03 ` 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=1456175198-25210-3-git-send-email-wei@redhat.com \
--to=wei@redhat.com \
--cc=abologna@redhat.com \
--cc=drjones@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.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).