Commit bacc344c authored by Igor Mammedov's avatar Igor Mammedov Committed by Eduardo Habkost
Browse files

machine: add properties to compat_props incrementaly



Switch to adding compat properties incrementaly instead of
completly overwriting compat_props per machine type.
That removes data duplication which we have due to nested
[PC|SPAPR]_COMPAT_* macros.

It also allows to set default device properties from
default foo_machine_options() hook, which will be used
in following patch for putting VMGENID device as
a function if ISA bridge on pc/q35 machines.

Suggested-by: default avatarEduardo Habkost <ehabkost@redhat.com>
Signed-off-by: default avatarIgor Mammedov <imammedo@redhat.com>
Acked-by: default avatarCornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: default avatarEduardo Habkost <ehabkost@redhat.com>
[ehabkost: Fixed CCW_COMPAT_* and PC_COMPAT_0_* defines]
Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
parent 16714b16
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -1418,13 +1418,9 @@ static void virt_2_6_instance_init(Object *obj)
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->compat_props = compat_props;
}

static const TypeInfo machvirt_info = {
+10 −0
Original line number Diff line number Diff line
@@ -571,6 +571,15 @@ bool machine_mem_merge(MachineState *machine)
    return machine->mem_merge;
}

static void machine_class_finalize(ObjectClass *klass, void *data)
{
    MachineClass *mc = MACHINE_CLASS(klass);

    if (mc->compat_props) {
        g_array_free(mc->compat_props, true);
    }
}

static const TypeInfo machine_info = {
    .name = TYPE_MACHINE,
    .parent = TYPE_OBJECT,
@@ -578,6 +587,7 @@ static const TypeInfo machine_info = {
    .class_size = sizeof(MachineClass),
    .class_init    = machine_class_init,
    .class_base_init = machine_class_base_init,
    .class_finalize = machine_class_finalize,
    .instance_size = sizeof(MachineState),
    .instance_init = machine_initfn,
    .instance_finalize = machine_finalize,
+0 −13
Original line number Diff line number Diff line
@@ -582,7 +582,6 @@ DEFINE_I440FX_MACHINE(v1_4, "pc-i440fx-1.4", pc_compat_1_4,


#define PC_COMPAT_1_3 \
        PC_COMPAT_1_4 \
        {\
            .driver   = "usb-tablet",\
            .property = "usb_version",\
@@ -614,7 +613,6 @@ DEFINE_I440FX_MACHINE(v1_3, "pc-1.3", pc_compat_1_3,


#define PC_COMPAT_1_2 \
        PC_COMPAT_1_3 \
        {\
            .driver   = "nec-usb-xhci",\
            .property = "msi",\
@@ -653,7 +651,6 @@ DEFINE_I440FX_MACHINE(v1_2, "pc-1.2", pc_compat_1_2,


#define PC_COMPAT_1_1 \
        PC_COMPAT_1_2 \
        {\
            .driver   = "virtio-scsi-pci",\
            .property = "hotplug",\
@@ -696,7 +693,6 @@ DEFINE_I440FX_MACHINE(v1_1, "pc-1.1", pc_compat_1_2,


#define PC_COMPAT_1_0 \
        PC_COMPAT_1_1 \
        {\
            .driver   = TYPE_ISA_FDC,\
            .property = "check_media_rate",\
@@ -726,14 +722,10 @@ DEFINE_I440FX_MACHINE(v1_0, "pc-1.0", pc_compat_1_2,
                      pc_i440fx_1_0_machine_options);


#define PC_COMPAT_0_15 \
        PC_COMPAT_1_0

static void pc_i440fx_0_15_machine_options(MachineClass *m)
{
    pc_i440fx_1_0_machine_options(m);
    m->hw_version = "0.15";
    SET_MACHINE_COMPAT(m, PC_COMPAT_0_15);
}

DEFINE_I440FX_MACHINE(v0_15, "pc-0.15", pc_compat_1_2,
@@ -741,7 +733,6 @@ DEFINE_I440FX_MACHINE(v0_15, "pc-0.15", pc_compat_1_2,


#define PC_COMPAT_0_14 \
        PC_COMPAT_0_15 \
        {\
            .driver   = "virtio-blk-pci",\
            .property = "event_idx",\
@@ -780,7 +771,6 @@ DEFINE_I440FX_MACHINE(v0_14, "pc-0.14", pc_compat_1_2,


#define PC_COMPAT_0_13 \
        PC_COMPAT_0_14 \
        {\
            .driver   = TYPE_PCI_DEVICE,\
            .property = "command_serr_enable",\
@@ -817,7 +807,6 @@ DEFINE_I440FX_MACHINE(v0_13, "pc-0.13", pc_compat_0_13,


#define PC_COMPAT_0_12 \
        PC_COMPAT_0_13 \
        {\
            .driver   = "virtio-serial-pci",\
            .property = "max_ports",\
@@ -852,7 +841,6 @@ DEFINE_I440FX_MACHINE(v0_12, "pc-0.12", pc_compat_0_13,


#define PC_COMPAT_0_11 \
        PC_COMPAT_0_12 \
        {\
            .driver   = "virtio-blk-pci",\
            .property = "vectors",\
@@ -883,7 +871,6 @@ DEFINE_I440FX_MACHINE(v0_11, "pc-0.11", pc_compat_0_13,


#define PC_COMPAT_0_10 \
    PC_COMPAT_0_11 \
    {\
        .driver   = "virtio-blk-pci",\
        .property = "class",\
+0 −4
Original line number Diff line number Diff line
@@ -2387,7 +2387,6 @@ DEFINE_SPAPR_MACHINE(2_5, "2.5", false);
 * pseries-2.4
 */
#define SPAPR_COMPAT_2_4 \
        SPAPR_COMPAT_2_5 \
        HW_COMPAT_2_4

static void spapr_machine_2_4_instance_options(MachineState *machine)
@@ -2410,7 +2409,6 @@ DEFINE_SPAPR_MACHINE(2_4, "2.4", false);
 * pseries-2.3
 */
#define SPAPR_COMPAT_2_3 \
        SPAPR_COMPAT_2_4 \
        HW_COMPAT_2_3 \
        {\
            .driver   = "spapr-pci-host-bridge",\
@@ -2438,7 +2436,6 @@ DEFINE_SPAPR_MACHINE(2_3, "2.3", false);
 */

#define SPAPR_COMPAT_2_2 \
        SPAPR_COMPAT_2_3 \
        HW_COMPAT_2_2 \
        {\
            .driver   = TYPE_SPAPR_PCI_HOST_BRIDGE,\
@@ -2463,7 +2460,6 @@ DEFINE_SPAPR_MACHINE(2_2, "2.2", false);
 * pseries-2.1
 */
#define SPAPR_COMPAT_2_1 \
        SPAPR_COMPAT_2_2 \
        HW_COMPAT_2_1

static void spapr_machine_2_1_instance_options(MachineState *machine)
+0 −1
Original line number Diff line number Diff line
@@ -330,7 +330,6 @@ static const TypeInfo ccw_machine_info = {
        HW_COMPAT_2_5

#define CCW_COMPAT_2_4 \
        CCW_COMPAT_2_5 \
        HW_COMPAT_2_4 \
        {\
            .driver   = TYPE_S390_SKEYS,\
Loading