arm: virt: Move machine class init code to the abstract machine type

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>
Message-id: 1457717778-17727-3-git-send-email-wei@redhat.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Wei Huang 2016-03-16 17:05:59 +00:00 committed by Peter Maydell
parent ed796373b4
commit 9c94d8e6c9
1 changed files with 20 additions and 14 deletions

View File

@ -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) 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 = { static const TypeInfo virt_machine_info = {
@ -1358,7 +1370,7 @@ static const TypeInfo virt_machine_info = {
.class_init = virt_machine_class_init, .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); VirtMachineState *vms = VIRT_MACHINE(obj);
@ -1391,29 +1403,23 @@ static void virt_instance_init(Object *obj)
"Valid values are 2, 3 and host", NULL); "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); MachineClass *mc = MACHINE_CLASS(oc);
static GlobalProperty compat_props[] = {
{ /* end of list */ }
};
mc->desc = "QEMU 2.6 ARM Virtual Machine"; mc->desc = "QEMU 2.6 ARM Virtual Machine";
mc->alias = "virt"; mc->alias = "virt";
mc->init = machvirt_init; mc->compat_props = compat_props;
/* 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 machvirt_info = { static const TypeInfo machvirt_info = {
.name = MACHINE_TYPE_NAME("virt-2.6"), .name = MACHINE_TYPE_NAME("virt-2.6"),
.parent = TYPE_VIRT_MACHINE, .parent = TYPE_VIRT_MACHINE,
.instance_init = virt_instance_init, .instance_init = virt_2_6_instance_init,
.class_init = virt_class_init, .class_init = virt_2_6_class_init,
}; };
static void machvirt_machine_init(void) static void machvirt_machine_init(void)