qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH V1 0/2] Versioning ARM virt machine types
@ 2016-03-11 17:36 Wei Huang
  2016-03-11 17:36 ` [Qemu-devel] [PATCH V1 1/2] arm: virt: Add an abstract ARM virt machine type Wei Huang
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Wei Huang @ 2016-03-11 17:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, drjones, qemu-arm, abologna, wei

We start to see more features been added to ARM virtual machine models.
For the purpose of backward compatibility (e.g. migration), it is time
to consider versioning machine types for ARM VMs. As a beginning step, this
patchset defines an abstract machine type for ARM VMs. The current
"virt" machine is re-written based on this new abstract type accordingly.
These patches have been verified by booting existing VMs.

RFC->V1:
 * Rename the machine type to "virt-2.6", matching the imminent QEMU version
 * Remove mc->is_default (Peter's comment)

Thanks,
-Wei

Wei Huang (2):
  arm: virt: Add an abstract ARM virt machine type
  arm: virt: Move machine class init code to the abstract machine type

 hw/arm/virt.c | 57 ++++++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 38 insertions(+), 19 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH V1 1/2] arm: virt: Add an abstract ARM virt machine type
  2016-03-11 17:36 [Qemu-devel] [PATCH V1 0/2] Versioning ARM virt machine types Wei Huang
@ 2016-03-11 17:36 ` Wei Huang
  2016-03-11 17:36 ` [Qemu-devel] [PATCH V1 2/2] arm: virt: Move machine class init code to the abstract " Wei Huang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Wei Huang @ 2016-03-11 17:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, drjones, qemu-arm, abologna, wei

In preparation for future ARM virt machine types, this patch creates
an abstract type for all ARM machines. The current machine type in
QEMU (i.e. "virt") is renamed to "virt-2.6", whose naming scheme is
similar to other architectures. For the purpose of backward compatibility,
"virt" is converted to an alias, pointing to "virt-2.6". With this patch,
"qemu -M ?" lists the following virtual machine types along with others:

virt                 QEMU 2.6 ARM Virtual Machine (alias of virt-2.6)
virt-2.6             QEMU 2.6 ARM Virtual Machine

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

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 8c6c996..be9bbfb 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1345,6 +1345,19 @@ static void virt_set_gic_version(Object *obj, const char *value, Error **errp)
     }
 }
 
+static void virt_machine_class_init(ObjectClass *oc, void *data)
+{
+}
+
+static const TypeInfo virt_machine_info = {
+    .name          = TYPE_VIRT_MACHINE,
+    .parent        = TYPE_MACHINE,
+    .abstract      = true,
+    .instance_size = sizeof(VirtMachineState),
+    .class_size    = sizeof(VirtMachineClass),
+    .class_init    = virt_machine_class_init,
+};
+
 static void virt_instance_init(Object *obj)
 {
     VirtMachineState *vms = VIRT_MACHINE(obj);
@@ -1382,7 +1395,8 @@ static void virt_class_init(ObjectClass *oc, void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
 
-    mc->desc = "ARM Virtual Machine",
+    mc->desc = "QEMU 2.6 ARM Virtual Machine";
+    mc->alias = "virt";
     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
@@ -1396,16 +1410,15 @@ static void virt_class_init(ObjectClass *oc, void *data)
 }
 
 static const TypeInfo machvirt_info = {
-    .name = TYPE_VIRT_MACHINE,
-    .parent = TYPE_MACHINE,
-    .instance_size = sizeof(VirtMachineState),
+    .name = MACHINE_TYPE_NAME("virt-2.6"),
+    .parent = TYPE_VIRT_MACHINE,
     .instance_init = virt_instance_init,
-    .class_size = sizeof(VirtMachineClass),
     .class_init = virt_class_init,
 };
 
 static void machvirt_machine_init(void)
 {
+    type_register_static(&virt_machine_info);
     type_register_static(&machvirt_info);
 }
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH V1 2/2] arm: virt: Move machine class init code to the abstract machine type
  2016-03-11 17:36 [Qemu-devel] [PATCH V1 0/2] Versioning ARM virt machine types Wei Huang
  2016-03-11 17:36 ` [Qemu-devel] [PATCH V1 1/2] arm: virt: Add an abstract ARM virt machine type Wei Huang
@ 2016-03-11 17:36 ` Wei Huang
  2016-03-16 10:51 ` [Qemu-devel] [PATCH V1 0/2] Versioning ARM virt machine types Peter Maydell
  2016-06-07 15:17 ` Peter Maydell
  3 siblings, 0 replies; 7+ messages in thread
From: Wei Huang @ 2016-03-11 17:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, drjones, qemu-arm, abologna, wei

This patch moves the common class initialization code from
"virt-2.6" to the new abstract class. An empty property is added to
"virt-2.6" machine. In the meanwhile, related funtions are renamed
to "virt_2_6_*" 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 be9bbfb..8c3ac0d 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1347,6 +1347,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 = {
@@ -1358,7 +1370,7 @@ static const TypeInfo virt_machine_info = {
     .class_init    = virt_machine_class_init,
 };
 
-static void virt_instance_init(Object *obj)
+static void virt_2_6_instance_init(Object *obj)
 {
     VirtMachineState *vms = VIRT_MACHINE(obj);
 
@@ -1391,29 +1403,23 @@ 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_6_class_init(ObjectClass *oc, void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
+    static GlobalProperty compat_props[] = {
+        { /* end of list */ }
+    };
 
     mc->desc = "QEMU 2.6 ARM Virtual Machine";
     mc->alias = "virt";
-    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.6"),
     .parent = TYPE_VIRT_MACHINE,
-    .instance_init = virt_instance_init,
-    .class_init = virt_class_init,
+    .instance_init = virt_2_6_instance_init,
+    .class_init = virt_2_6_class_init,
 };
 
 static void machvirt_machine_init(void)
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH V1 0/2] Versioning ARM virt machine types
  2016-03-11 17:36 [Qemu-devel] [PATCH V1 0/2] Versioning ARM virt machine types Wei Huang
  2016-03-11 17:36 ` [Qemu-devel] [PATCH V1 1/2] arm: virt: Add an abstract ARM virt machine type Wei Huang
  2016-03-11 17:36 ` [Qemu-devel] [PATCH V1 2/2] arm: virt: Move machine class init code to the abstract " Wei Huang
@ 2016-03-16 10:51 ` Peter Maydell
  2016-06-07 15:17 ` Peter Maydell
  3 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2016-03-16 10:51 UTC (permalink / raw)
  To: Wei Huang; +Cc: Andrew Jones, qemu-arm, QEMU Developers, wei, Andrea Bolognani

On 11 March 2016 at 17:36, Wei Huang <wei@redhat.com> wrote:
> We start to see more features been added to ARM virtual machine models.
> For the purpose of backward compatibility (e.g. migration), it is time
> to consider versioning machine types for ARM VMs. As a beginning step, this
> patchset defines an abstract machine type for ARM VMs. The current
> "virt" machine is re-written based on this new abstract type accordingly.
> These patches have been verified by booting existing VMs.
>
> RFC->V1:
>  * Rename the machine type to "virt-2.6", matching the imminent QEMU version
>  * Remove mc->is_default (Peter's comment)



Applied to target-arm.next, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH V1 0/2] Versioning ARM virt machine types
  2016-03-11 17:36 [Qemu-devel] [PATCH V1 0/2] Versioning ARM virt machine types Wei Huang
                   ` (2 preceding siblings ...)
  2016-03-16 10:51 ` [Qemu-devel] [PATCH V1 0/2] Versioning ARM virt machine types Peter Maydell
@ 2016-06-07 15:17 ` Peter Maydell
  2016-06-07 15:51   ` Andrew Jones
  3 siblings, 1 reply; 7+ messages in thread
From: Peter Maydell @ 2016-06-07 15:17 UTC (permalink / raw)
  To: Wei Huang; +Cc: QEMU Developers, qemu-arm, Andrew Jones, Andrea Bolognani

On 11 March 2016 at 17:36, Wei Huang <wei@redhat.com> wrote:
> We start to see more features been added to ARM virtual machine models.
> For the purpose of backward compatibility (e.g. migration), it is time
> to consider versioning machine types for ARM VMs. As a beginning step, this
> patchset defines an abstract machine type for ARM VMs. The current
> "virt" machine is re-written based on this new abstract type accordingly.
> These patches have been verified by booting existing VMs.
>
> RFC->V1:
>  * Rename the machine type to "virt-2.6", matching the imminent QEMU version
>  * Remove mc->is_default (Peter's comment)

So is there a plan to provide a virt-2.7 for the next release?

thanks
-- PMM

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH V1 0/2] Versioning ARM virt machine types
  2016-06-07 15:17 ` Peter Maydell
@ 2016-06-07 15:51   ` Andrew Jones
  2016-06-07 16:15     ` Wei Huang
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Jones @ 2016-06-07 15:51 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Wei Huang, qemu-arm, QEMU Developers, Andrea Bolognani

On Tue, Jun 07, 2016 at 04:17:09PM +0100, Peter Maydell wrote:
> On 11 March 2016 at 17:36, Wei Huang <wei@redhat.com> wrote:
> > We start to see more features been added to ARM virtual machine models.
> > For the purpose of backward compatibility (e.g. migration), it is time
> > to consider versioning machine types for ARM VMs. As a beginning step, this
> > patchset defines an abstract machine type for ARM VMs. The current
> > "virt" machine is re-written based on this new abstract type accordingly.
> > These patches have been verified by booting existing VMs.
> >
> > RFC->V1:
> >  * Rename the machine type to "virt-2.6", matching the imminent QEMU version
> >  * Remove mc->is_default (Peter's comment)
> 
> So is there a plan to provide a virt-2.7 for the next release?

Yup. I was planning to send it as part of a small "hw/arm/virt: add
cpu-map" series I pretty much have ready, but didn't finish and send
yet because I got distracted working on the larger plan (among other
things). The motivation (larger plan) for cpu-map is full cpu-topology
configuration, but working on that has led to an smp parameter rework
RFC (hoping to send this week...) Wei or I can just send the virt-2.7
patch now though to get it done sooner than later.

Thanks,
drew

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH V1 0/2] Versioning ARM virt machine types
  2016-06-07 15:51   ` Andrew Jones
@ 2016-06-07 16:15     ` Wei Huang
  0 siblings, 0 replies; 7+ messages in thread
From: Wei Huang @ 2016-06-07 16:15 UTC (permalink / raw)
  To: Andrew Jones, Peter Maydell; +Cc: qemu-arm, QEMU Developers, Andrea Bolognani



On 06/07/2016 11:51 PM, Andrew Jones wrote:
> On Tue, Jun 07, 2016 at 04:17:09PM +0100, Peter Maydell wrote:
>> On 11 March 2016 at 17:36, Wei Huang <wei@redhat.com> wrote:
>>> We start to see more features been added to ARM virtual machine models.
>>> For the purpose of backward compatibility (e.g. migration), it is time
>>> to consider versioning machine types for ARM VMs. As a beginning step, this
>>> patchset defines an abstract machine type for ARM VMs. The current
>>> "virt" machine is re-written based on this new abstract type accordingly.
>>> These patches have been verified by booting existing VMs.
>>>
>>> RFC->V1:
>>>  * Rename the machine type to "virt-2.6", matching the imminent QEMU version
>>>  * Remove mc->is_default (Peter's comment)
>>
>> So is there a plan to provide a virt-2.7 for the next release?
> 
> Yup. I was planning to send it as part of a small "hw/arm/virt: add
> cpu-map" series I pretty much have ready, but didn't finish and send
> yet because I got distracted working on the larger plan (among other
> things). The motivation (larger plan) for cpu-map is full cpu-topology
> configuration, but working on that has led to an smp parameter rework
> RFC (hoping to send this week...) Wei or I can just send the virt-2.7
> patch now though to get it done sooner than later.

It makes sense to go with Drew's patches, so he doesn't need to re-base
his existing current implementation.

> 
> Thanks,
> drew
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-06-07 16:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-11 17:36 [Qemu-devel] [PATCH V1 0/2] Versioning ARM virt machine types Wei Huang
2016-03-11 17:36 ` [Qemu-devel] [PATCH V1 1/2] arm: virt: Add an abstract ARM virt machine type Wei Huang
2016-03-11 17:36 ` [Qemu-devel] [PATCH V1 2/2] arm: virt: Move machine class init code to the abstract " Wei Huang
2016-03-16 10:51 ` [Qemu-devel] [PATCH V1 0/2] Versioning ARM virt machine types Peter Maydell
2016-06-07 15:17 ` Peter Maydell
2016-06-07 15:51   ` Andrew Jones
2016-06-07 16:15     ` Wei Huang

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).