diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2018-12-12 19:36:30 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2019-01-07 16:18:42 +0400 |
commit | c4fc5695b770b597dfbed9271c7d7080311e0097 (patch) | |
tree | 5fb79283b4e1bcab360934a0a8f547b652e8bfb7 | |
parent | 1c30044e1aba56066eb6a51a788ce6a15a8faa8f (diff) |
compat: replace PC_COMPAT_2_1 & HW_COMPAT_2_1 macros
Use static arrays instead. I decided to rename the conflicting
pc_compat_2_1() function with pc_compat_2_1_fn().
Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
-rw-r--r-- | hw/core/machine.c | 33 | ||||
-rw-r--r-- | hw/i386/pc.c | 15 | ||||
-rw-r--r-- | hw/i386/pc_piix.c | 12 | ||||
-rw-r--r-- | hw/ppc/spapr.c | 6 | ||||
-rw-r--r-- | include/hw/boards.h | 3 | ||||
-rw-r--r-- | include/hw/compat.h | 31 | ||||
-rw-r--r-- | include/hw/i386/pc.h | 17 |
7 files changed, 60 insertions, 57 deletions
diff --git a/hw/core/machine.c b/hw/core/machine.c index cfa9a5d95f..84a4c8cdc3 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -309,6 +309,39 @@ const size_t hw_compat_2_3_len = G_N_ELEMENTS(hw_compat_2_3); GlobalProperty hw_compat_2_2[] = {}; const size_t hw_compat_2_2_len = G_N_ELEMENTS(hw_compat_2_2); +GlobalProperty hw_compat_2_1[] = { + { + .driver = "intel-hda", + .property = "old_msi_addr", + .value = "on", + },{ + .driver = "VGA", + .property = "qemu-extended-regs", + .value = "off", + },{ + .driver = "secondary-vga", + .property = "qemu-extended-regs", + .value = "off", + },{ + .driver = "virtio-scsi-pci", + .property = "any_layout", + .value = "off", + },{ + .driver = "usb-mouse", + .property = "usb_version", + .value = stringify(1), + },{ + .driver = "usb-kbd", + .property = "usb_version", + .value = stringify(1), + },{ + .driver = "virtio-pci", + .property = "virtio-pci-bus-master-bug-migration", + .value = "on", + }, +}; +const size_t hw_compat_2_1_len = G_N_ELEMENTS(hw_compat_2_1); + static char *machine_get_accel(Object *obj, Error **errp) { MachineState *ms = MACHINE(obj); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index b92d1900da..731d2010c8 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -536,6 +536,21 @@ GlobalProperty pc_compat_2_2[] = { }; const size_t pc_compat_2_2_len = G_N_ELEMENTS(pc_compat_2_2); +GlobalProperty pc_compat_2_1[] = { + PC_CPU_MODEL_IDS("2.1.0") + { + .driver = "coreduo" "-" TYPE_X86_CPU, + .property = "vmx", + .value = "on", + }, + { + .driver = "core2duo" "-" TYPE_X86_CPU, + .property = "vmx", + .value = "on", + }, +}; +const size_t pc_compat_2_1_len = G_N_ELEMENTS(pc_compat_2_1); + void gsi_handler(void *opaque, int n, int level) { GSIState *s = opaque; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index d2a2bacba4..7b48b1c816 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -323,7 +323,7 @@ static void pc_compat_2_2_fn(MachineState *machine) pc_compat_2_3_fn(machine); } -static void pc_compat_2_1(MachineState *machine) +static void pc_compat_2_1_fn(MachineState *machine) { pc_compat_2_2_fn(machine); x86_cpu_change_kvm_default("svm", NULL); @@ -331,7 +331,7 @@ static void pc_compat_2_1(MachineState *machine) static void pc_compat_2_0(MachineState *machine) { - pc_compat_2_1(machine); + pc_compat_2_1_fn(machine); } static void pc_compat_1_7(MachineState *machine) @@ -593,19 +593,17 @@ DEFINE_I440FX_MACHINE(v2_2, "pc-i440fx-2.2", pc_compat_2_2_fn, static void pc_i440fx_2_1_machine_options(MachineClass *m) { PCMachineClass *pcmc = PC_MACHINE_CLASS(m); - static GlobalProperty compat[] = { - PC_COMPAT_2_1 - }; pc_i440fx_2_2_machine_options(m); m->hw_version = "2.1.0"; m->default_display = NULL; - compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat)); + compat_props_add(m->compat_props, hw_compat_2_1, hw_compat_2_1_len); + compat_props_add(m->compat_props, pc_compat_2_1, pc_compat_2_1_len); pcmc->smbios_uuid_encoded = false; pcmc->enforce_aligned_dimm = false; } -DEFINE_I440FX_MACHINE(v2_1, "pc-i440fx-2.1", pc_compat_2_1, +DEFINE_I440FX_MACHINE(v2_1, "pc-i440fx-2.1", pc_compat_2_1_fn, pc_i440fx_2_1_machine_options); static void pc_i440fx_2_0_machine_options(MachineClass *m) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 449c5dd58d..8aba66a32f 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4361,12 +4361,8 @@ DEFINE_SPAPR_MACHINE(2_2, "2.2", false); static void spapr_machine_2_1_class_options(MachineClass *mc) { - static GlobalProperty compat[] = { - HW_COMPAT_2_1 - }; - spapr_machine_2_2_class_options(mc); - compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); + compat_props_add(mc->compat_props, hw_compat_2_1, hw_compat_2_1_len); } DEFINE_SPAPR_MACHINE(2_1, "2.1", false); diff --git a/include/hw/boards.h b/include/hw/boards.h index 2d82d80107..02f114085f 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -327,4 +327,7 @@ extern const size_t hw_compat_2_3_len; extern GlobalProperty hw_compat_2_2[]; extern const size_t hw_compat_2_2_len; +extern GlobalProperty hw_compat_2_1[]; +extern const size_t hw_compat_2_1_len; + #endif diff --git a/include/hw/compat.h b/include/hw/compat.h index 3bd91908e4..b2d0bdd599 100644 --- a/include/hw/compat.h +++ b/include/hw/compat.h @@ -1,35 +1,4 @@ #ifndef HW_COMPAT_H #define HW_COMPAT_H -#define HW_COMPAT_2_1 \ - {\ - .driver = "intel-hda",\ - .property = "old_msi_addr",\ - .value = "on",\ - },{\ - .driver = "VGA",\ - .property = "qemu-extended-regs",\ - .value = "off",\ - },{\ - .driver = "secondary-vga",\ - .property = "qemu-extended-regs",\ - .value = "off",\ - },{\ - .driver = "virtio-scsi-pci",\ - .property = "any_layout",\ - .value = "off",\ - },{\ - .driver = "usb-mouse",\ - .property = "usb_version",\ - .value = stringify(1),\ - },{\ - .driver = "usb-kbd",\ - .property = "usb_version",\ - .value = stringify(1),\ - },{\ - .driver = "virtio-pci",\ - .property = "virtio-pci-bus-master-bug-migration",\ - .value = "on",\ - }, - #endif /* HW_COMPAT_H */ diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 49b45bb79d..784ea7a92c 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -333,6 +333,9 @@ extern const size_t pc_compat_2_3_len; extern GlobalProperty pc_compat_2_2[]; extern const size_t pc_compat_2_2_len; +extern GlobalProperty pc_compat_2_1[]; +extern const size_t pc_compat_2_1_len; + /* Helper for setting model-id for CPU models that changed model-id * depending on QEMU versions up to QEMU 2.4. */ @@ -353,20 +356,6 @@ extern const size_t pc_compat_2_2_len; .value = "QEMU Virtual CPU version " v,\ }, -#define PC_COMPAT_2_1 \ - HW_COMPAT_2_1 \ - PC_CPU_MODEL_IDS("2.1.0") \ - {\ - .driver = "coreduo" "-" TYPE_X86_CPU,\ - .property = "vmx",\ - .value = "on",\ - },\ - {\ - .driver = "core2duo" "-" TYPE_X86_CPU,\ - .property = "vmx",\ - .value = "on",\ - }, - #define PC_COMPAT_2_0 \ PC_CPU_MODEL_IDS("2.0.0") \ {\ |