[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 21/60] pc: Don't use QEMUMachine anymore
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v2 21/60] pc: Don't use QEMUMachine anymore |
Date: |
Mon, 1 Jun 2015 14:23:30 +0200 |
From: Eduardo Habkost <address@hidden>
Now that we have a DEFINE_PC_MACHINE helper macro that just requires an
initialization function, it is trivial to convert them to register a QOM
machine class directly, instead of using QEMUMachine.
Signed-off-by: Eduardo Habkost <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
include/hw/i386/pc.h | 22 +++++++++++++++-------
hw/i386/pc_piix.c | 44 ++++++++++++++++++++++----------------------
hw/i386/pc_q35.c | 20 ++++++++++----------
3 files changed, 47 insertions(+), 39 deletions(-)
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index c4f0808..f3bf500 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -517,12 +517,12 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t
*);
.value = stringify(0),\
},
-static inline void pc_common_machine_options(QEMUMachine *m)
+static inline void pc_common_machine_options(MachineClass *m)
{
m->default_boot_order = "cad";
}
-static inline void pc_default_machine_options(QEMUMachine *m)
+static inline void pc_default_machine_options(MachineClass *m)
{
pc_common_machine_options(m);
m->hot_add_cpu = pc_hot_add_cpu;
@@ -530,13 +530,21 @@ static inline void pc_default_machine_options(QEMUMachine
*m)
}
#define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \
+ static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \
+ { \
+ MachineClass *mc = MACHINE_CLASS(oc); \
+ optsfn(mc); \
+ mc->name = namestr; \
+ mc->init = initfn; \
+ } \
+ static const TypeInfo pc_machine_type_##suffix = { \
+ .name = namestr TYPE_MACHINE_SUFFIX, \
+ .parent = TYPE_PC_MACHINE, \
+ .class_init = pc_machine_##suffix##_class_init, \
+ }; \
static void pc_machine_init_##suffix(void) \
{ \
- static QEMUMachine m = { }; \
- optsfn(&m); \
- m.name = namestr; \
- m.init = initfn; \
- qemu_register_pc_machine(&m); \
+ type_register(&pc_machine_type_##suffix); \
} \
machine_init(pc_machine_init_##suffix)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 89f55d7..052fca2 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -518,7 +518,7 @@ static void pc_xen_hvm_init(MachineState *machine)
#endif
-static void pc_i440fx_machine_options(QEMUMachine *m)
+static void pc_i440fx_machine_options(MachineClass *m)
{
pc_default_machine_options(m);
m->family = "pc_piix";
@@ -526,7 +526,7 @@ static void pc_i440fx_machine_options(QEMUMachine *m)
m->hot_add_cpu = pc_hot_add_cpu;
}
-static void pc_i440fx_2_4_machine_options(QEMUMachine *m)
+static void pc_i440fx_2_4_machine_options(MachineClass *m)
{
pc_i440fx_machine_options(m);
m->default_machine_opts = "firmware=bios-256k.bin";
@@ -539,7 +539,7 @@ DEFINE_PC_MACHINE(v2_4, "pc-i440fx-2.4", pc_init_pci,
pc_i440fx_2_4_machine_options)
-static void pc_i440fx_2_3_machine_options(QEMUMachine *m)
+static void pc_i440fx_2_3_machine_options(MachineClass *m)
{
pc_i440fx_machine_options(m);
m->alias = NULL;
@@ -551,7 +551,7 @@ DEFINE_PC_MACHINE(v2_3, "pc-i440fx-2.3", pc_init_pci_2_3,
pc_i440fx_2_3_machine_options);
-static void pc_i440fx_2_2_machine_options(QEMUMachine *m)
+static void pc_i440fx_2_2_machine_options(MachineClass *m)
{
pc_i440fx_2_3_machine_options(m);
SET_MACHINE_COMPAT(m, PC_COMPAT_2_2);
@@ -561,7 +561,7 @@ DEFINE_PC_MACHINE(v2_2, "pc-i440fx-2.2", pc_init_pci_2_2,
pc_i440fx_2_2_machine_options);
-static void pc_i440fx_2_1_machine_options(QEMUMachine *m)
+static void pc_i440fx_2_1_machine_options(MachineClass *m)
{
pc_i440fx_2_2_machine_options(m);
m->default_display = NULL;
@@ -573,7 +573,7 @@ DEFINE_PC_MACHINE(v2_1, "pc-i440fx-2.1", pc_init_pci_2_1,
-static void pc_i440fx_2_0_machine_options(QEMUMachine *m)
+static void pc_i440fx_2_0_machine_options(MachineClass *m)
{
pc_i440fx_2_1_machine_options(m);
SET_MACHINE_COMPAT(m, PC_COMPAT_2_0);
@@ -583,7 +583,7 @@ DEFINE_PC_MACHINE(v2_0, "pc-i440fx-2.0", pc_init_pci_2_0,
pc_i440fx_2_0_machine_options);
-static void pc_i440fx_1_7_machine_options(QEMUMachine *m)
+static void pc_i440fx_1_7_machine_options(MachineClass *m)
{
pc_i440fx_2_0_machine_options(m);
m->default_machine_opts = NULL;
@@ -594,7 +594,7 @@ DEFINE_PC_MACHINE(v1_7, "pc-i440fx-1.7", pc_init_pci_1_7,
pc_i440fx_1_7_machine_options);
-static void pc_i440fx_1_6_machine_options(QEMUMachine *m)
+static void pc_i440fx_1_6_machine_options(MachineClass *m)
{
pc_i440fx_1_7_machine_options(m);
SET_MACHINE_COMPAT(m, PC_COMPAT_1_6);
@@ -604,7 +604,7 @@ DEFINE_PC_MACHINE(v1_6, "pc-i440fx-1.6", pc_init_pci_1_6,
pc_i440fx_1_6_machine_options);
-static void pc_i440fx_1_5_machine_options(QEMUMachine *m)
+static void pc_i440fx_1_5_machine_options(MachineClass *m)
{
pc_i440fx_1_6_machine_options(m);
SET_MACHINE_COMPAT(m, PC_COMPAT_1_5);
@@ -614,7 +614,7 @@ DEFINE_PC_MACHINE(v1_5, "pc-i440fx-1.5", pc_init_pci_1_5,
pc_i440fx_1_5_machine_options);
-static void pc_i440fx_1_4_machine_options(QEMUMachine *m)
+static void pc_i440fx_1_4_machine_options(MachineClass *m)
{
pc_i440fx_1_5_machine_options(m);
m->hot_add_cpu = NULL;
@@ -646,7 +646,7 @@ DEFINE_PC_MACHINE(v1_4, "pc-i440fx-1.4", pc_init_pci_1_4,
},
-static void pc_i440fx_1_3_machine_options(QEMUMachine *m)
+static void pc_i440fx_1_3_machine_options(MachineClass *m)
{
pc_i440fx_1_4_machine_options(m);
SET_MACHINE_COMPAT(m, PC_COMPAT_1_3);
@@ -684,7 +684,7 @@ DEFINE_PC_MACHINE(v1_3, "pc-1.3", pc_init_pci_1_3,
.value = "off",\
},
-static void pc_i440fx_1_2_machine_options(QEMUMachine *m)
+static void pc_i440fx_1_2_machine_options(MachineClass *m)
{
pc_i440fx_1_3_machine_options(m);
SET_MACHINE_COMPAT(m, PC_COMPAT_1_2);
@@ -726,7 +726,7 @@ DEFINE_PC_MACHINE(v1_2, "pc-1.2", pc_init_pci_1_2,
.value = "off",\
},
-static void pc_i440fx_1_1_machine_options(QEMUMachine *m)
+static void pc_i440fx_1_1_machine_options(MachineClass *m)
{
pc_i440fx_1_2_machine_options(m);
SET_MACHINE_COMPAT(m, PC_COMPAT_1_1);
@@ -756,7 +756,7 @@ DEFINE_PC_MACHINE(v1_1, "pc-1.1", pc_init_pci_1_2,
.value = "no",\
},
-static void pc_i440fx_1_0_machine_options(QEMUMachine *m)
+static void pc_i440fx_1_0_machine_options(MachineClass *m)
{
pc_i440fx_1_1_machine_options(m);
m->hw_version = "1.0";
@@ -770,7 +770,7 @@ DEFINE_PC_MACHINE(v1_0, "pc-1.0", pc_init_pci_1_2,
#define PC_COMPAT_0_15 \
PC_COMPAT_1_0
-static void pc_i440fx_0_15_machine_options(QEMUMachine *m)
+static void pc_i440fx_0_15_machine_options(MachineClass *m)
{
pc_i440fx_1_0_machine_options(m);
m->hw_version = "0.15";
@@ -809,7 +809,7 @@ DEFINE_PC_MACHINE(v0_15, "pc-0.15", pc_init_pci_1_2,
.value = stringify(2),\
},
-static void pc_i440fx_0_14_machine_options(QEMUMachine *m)
+static void pc_i440fx_0_14_machine_options(MachineClass *m)
{
pc_i440fx_0_15_machine_options(m);
m->hw_version = "0.14";
@@ -844,7 +844,7 @@ DEFINE_PC_MACHINE(v0_14, "pc-0.14", pc_init_pci_1_2,
.value = stringify(0),\
},
-static void pc_i440fx_0_13_machine_options(QEMUMachine *m)
+static void pc_i440fx_0_13_machine_options(MachineClass *m)
{
pc_i440fx_0_14_machine_options(m);
m->hw_version = "0.13";
@@ -879,7 +879,7 @@ DEFINE_PC_MACHINE(v0_13, "pc-0.13", pc_init_pci_no_kvmclock,
.value = "1",\
},
-static void pc_i440fx_0_12_machine_options(QEMUMachine *m)
+static void pc_i440fx_0_12_machine_options(MachineClass *m)
{
pc_i440fx_0_13_machine_options(m);
m->hw_version = "0.12";
@@ -910,7 +910,7 @@ DEFINE_PC_MACHINE(v0_12, "pc-0.12", pc_init_pci_no_kvmclock,
.value = "0.11",\
},
-static void pc_i440fx_0_11_machine_options(QEMUMachine *m)
+static void pc_i440fx_0_11_machine_options(MachineClass *m)
{
pc_i440fx_0_12_machine_options(m);
m->hw_version = "0.11";
@@ -945,7 +945,7 @@ DEFINE_PC_MACHINE(v0_11, "pc-0.11", pc_init_pci_no_kvmclock,
.value = "0.10",\
},
-static void pc_i440fx_0_10_machine_options(QEMUMachine *m)
+static void pc_i440fx_0_10_machine_options(MachineClass *m)
{
pc_i440fx_0_11_machine_options(m);
m->hw_version = "0.10";
@@ -956,7 +956,7 @@ DEFINE_PC_MACHINE(v0_10, "pc-0.10", pc_init_pci_no_kvmclock,
pc_i440fx_0_10_machine_options);
-static void isapc_machine_options(QEMUMachine *m)
+static void isapc_machine_options(MachineClass *m)
{
pc_common_machine_options(m);
m->desc = "ISA-only PC";
@@ -968,7 +968,7 @@ DEFINE_PC_MACHINE(isapc, "isapc", pc_init_isa,
#ifdef CONFIG_XEN
-static void xenfv_machine_options(QEMUMachine *m)
+static void xenfv_machine_options(MachineClass *m)
{
pc_common_machine_options(m);
m->desc = "Xen Fully-virtualized PC";
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index dcd728c..6a9fe58 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -414,7 +414,7 @@ static void pc_q35_init_1_4(MachineState *machine)
pc_q35_init(machine);
}
-static void pc_q35_machine_options(QEMUMachine *m)
+static void pc_q35_machine_options(MachineClass *m)
{
pc_default_machine_options(m);
m->family = "pc_q35";
@@ -423,7 +423,7 @@ static void pc_q35_machine_options(QEMUMachine *m)
m->units_per_default_bus = 1;
}
-static void pc_q35_2_4_machine_options(QEMUMachine *m)
+static void pc_q35_2_4_machine_options(MachineClass *m)
{
pc_q35_machine_options(m);
m->default_machine_opts = "firmware=bios-256k.bin";
@@ -435,7 +435,7 @@ DEFINE_PC_MACHINE(v2_4, "pc-q35-2.4", pc_q35_init,
pc_q35_2_4_machine_options);
-static void pc_q35_2_3_machine_options(QEMUMachine *m)
+static void pc_q35_2_3_machine_options(MachineClass *m)
{
pc_q35_2_4_machine_options(m);
m->alias = NULL;
@@ -446,7 +446,7 @@ DEFINE_PC_MACHINE(v2_3, "pc-q35-2.3", pc_q35_init_2_3,
pc_q35_2_3_machine_options);
-static void pc_q35_2_2_machine_options(QEMUMachine *m)
+static void pc_q35_2_2_machine_options(MachineClass *m)
{
pc_q35_2_3_machine_options(m);
SET_MACHINE_COMPAT(m, PC_COMPAT_2_2);
@@ -456,7 +456,7 @@ DEFINE_PC_MACHINE(v2_2, "pc-q35-2.2", pc_q35_init_2_2,
pc_q35_2_2_machine_options);
-static void pc_q35_2_1_machine_options(QEMUMachine *m)
+static void pc_q35_2_1_machine_options(MachineClass *m)
{
pc_q35_2_2_machine_options(m);
m->default_display = NULL;
@@ -467,7 +467,7 @@ DEFINE_PC_MACHINE(v2_1, "pc-q35-2.1", pc_q35_init_2_1,
pc_q35_2_1_machine_options);
-static void pc_q35_2_0_machine_options(QEMUMachine *m)
+static void pc_q35_2_0_machine_options(MachineClass *m)
{
pc_q35_2_1_machine_options(m);
SET_MACHINE_COMPAT(m, PC_COMPAT_2_0);
@@ -477,7 +477,7 @@ DEFINE_PC_MACHINE(v2_0, "pc-q35-2.0", pc_q35_init_2_0,
pc_q35_2_0_machine_options);
-static void pc_q35_1_7_machine_options(QEMUMachine *m)
+static void pc_q35_1_7_machine_options(MachineClass *m)
{
pc_q35_2_0_machine_options(m);
m->default_machine_opts = NULL;
@@ -488,7 +488,7 @@ DEFINE_PC_MACHINE(v1_7, "pc-q35-1.7", pc_q35_init_1_7,
pc_q35_1_7_machine_options);
-static void pc_q35_1_6_machine_options(QEMUMachine *m)
+static void pc_q35_1_6_machine_options(MachineClass *m)
{
pc_q35_machine_options(m);
SET_MACHINE_COMPAT(m, PC_COMPAT_1_6);
@@ -498,7 +498,7 @@ DEFINE_PC_MACHINE(v1_6, "pc-q35-1.6", pc_q35_init_1_6,
pc_q35_1_6_machine_options);
-static void pc_q35_1_5_machine_options(QEMUMachine *m)
+static void pc_q35_1_5_machine_options(MachineClass *m)
{
pc_q35_1_6_machine_options(m);
SET_MACHINE_COMPAT(m, PC_COMPAT_1_5);
@@ -508,7 +508,7 @@ DEFINE_PC_MACHINE(v1_5, "pc-q35-1.5", pc_q35_init_1_5,
pc_q35_1_5_machine_options);
-static void pc_q35_1_4_machine_options(QEMUMachine *m)
+static void pc_q35_1_4_machine_options(MachineClass *m)
{
pc_q35_1_5_machine_options(m);
m->hot_add_cpu = NULL;
--
MST
- [Qemu-devel] [PULL v2 11/60] spapr: define SPAPR_COMPAT_2_3, (continued)
- [Qemu-devel] [PULL v2 11/60] spapr: define SPAPR_COMPAT_2_3, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 13/60] piix: Move pc-0.11 drive version compat props to PC_COMPAT_0_11, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 12/60] piix: Move pc-0.14 qxl compat properties to PC_COMPAT_0_14, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 14/60] piix: Move pc-0.13 virtio-9p-pci compat to PC_COMPAT_0_13, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 16/60] piix: Define PC_COMPAT_0_10, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 15/60] piix: Move pc-0.1[23] rombar compat props to PC_COMPAT_0_13, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 17/60] pc: Define MACHINE_OPTIONS macros consistently for all machines, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 18/60] pc: Define machines using a DEFINE_PC_MACHINE macro, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 19/60] pc: Convert *_MACHINE_OPTIONS macros into functions, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 20/60] pc: Move compat_props setting inside *_machine_options() functions, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 21/60] pc: Don't use QEMUMachine anymore,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v2 22/60] pc: Remove qemu_register_pc_machine() function, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 23/60] machine: Remove unused fields from QEMUMachine, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 24/60] piix: Add kvmclock_enabled, pci_enabled globals, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 25/60] piix: Eliminate pc_init_pci(), Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 27/60] pc: acpi: fix pvpanic for buggy guests, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 26/60] pc: Generate init functions with a macro, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 28/60] virtio: move host_features, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 29/60] virtio-ccw: Don't advertise VIRTIO_F_BAD_FEATURE, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 30/60] virtio: move VIRTIO_F_NOTIFY_ON_EMPTY into core, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 31/60] virtio-net: adding all queues in .realize(), Michael S. Tsirkin, 2015/06/01