qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Wei Huang <wei@redhat.com>
To: qemu-devel@nongnu.org
Cc: wei@redhat.com, peter.maydell@linaro.org
Subject: [Qemu-devel] [PATCH] arm: define version-based machine type for ARM
Date: Thu, 15 Jan 2015 12:50:26 -0500	[thread overview]
Message-ID: <1421344226-25695-1-git-send-email-wei@redhat.com> (raw)

ARM virt machine type (machvirt) had been stable for a while. But recently
new devices have been added to support extra features. Considerring the
support of long-term compatibility, it is time to create a version-based
machine types.

This patch defines a qemu 2.2 specific machine type (machvirt-2.2) and
points the default machvirt to it. In the future new machine types can
follow a similar naming scheme (e.g. machvirt-3.0, ...). Note that this
patch doesn't change the semantic of existing QEMU command line.

With this patch, machine type querry (-M ?) will print the following:

virt                 ARM Virtual Machine v2.2 (alias of machvirt-2.2)
machvirt-2.2         ARM Virtual Machine v2.2 (default)

Signed-off-by: Wei Huang <wei@redhat.com>
---
 hw/arm/virt.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 2353440..6174abd 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -701,15 +701,37 @@ static void virt_class_init(ObjectClass *oc, void *data)
 static const TypeInfo machvirt_info = {
     .name = TYPE_VIRT_MACHINE,
     .parent = TYPE_MACHINE,
+    .abstract = true,
     .instance_size = sizeof(VirtMachineState),
     .instance_init = virt_instance_init,
     .class_size = sizeof(VirtMachineClass),
     .class_init = virt_class_init,
 };
 
+static void machvirt_2_2_class_init(ObjectClass *oc, void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+    static GlobalProperty compat_props[] = {
+        { /* end of list */ }
+    };
+
+    mc->name = "machvirt-2.2";
+    mc->desc = "ARM Virtual Machine v2.2";
+    mc->alias = "virt";
+    mc->is_default = 1;
+    mc->compat_props = compat_props;
+}
+
+static const TypeInfo machvirt_2_2_info = {
+    .name = TYPE_VIRT_MACHINE "-2.2",
+    .parent = TYPE_VIRT_MACHINE,
+    .class_init = machvirt_2_2_class_init,
+};
+
 static void machvirt_machine_init(void)
 {
     type_register_static(&machvirt_info);
+    type_register_static(&machvirt_2_2_info);
 }
 
 machine_init(machvirt_machine_init);
-- 
1.8.3.1

             reply	other threads:[~2015-01-15 17:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-15 17:50 Wei Huang [this message]
2015-01-15 18:10 ` [Qemu-devel] [PATCH] arm: define version-based machine type for ARM Peter Maydell
2015-01-15 18:52   ` Wei Huang
2015-01-15 19:04     ` 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=1421344226-25695-1-git-send-email-wei@redhat.com \
    --to=wei@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).