compat: replace PC_COMPAT_2_3 & HW_COMPAT_2_3 macros

Use static arrays instead.  I decided to rename the conflicting
pc_compat_2_3() function with pc_compat_2_3_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>
This commit is contained in:
Marc-André Lureau 2018-12-12 19:36:30 +04:00
parent 2f99b9c273
commit 8995dd9009
7 changed files with 139 additions and 133 deletions

View File

@ -265,6 +265,47 @@ GlobalProperty hw_compat_2_4[] = {
};
const size_t hw_compat_2_4_len = G_N_ELEMENTS(hw_compat_2_4);
GlobalProperty hw_compat_2_3[] = {
{
.driver = "virtio-blk-pci",
.property = "any_layout",
.value = "off",
},{
.driver = "virtio-balloon-pci",
.property = "any_layout",
.value = "off",
},{
.driver = "virtio-serial-pci",
.property = "any_layout",
.value = "off",
},{
.driver = "virtio-9p-pci",
.property = "any_layout",
.value = "off",
},{
.driver = "virtio-rng-pci",
.property = "any_layout",
.value = "off",
},{
.driver = TYPE_PCI_DEVICE,
.property = "x-pcie-lnksta-dllla",
.value = "off",
},{
.driver = "migration",
.property = "send-configuration",
.value = "off",
},{
.driver = "migration",
.property = "send-section-footer",
.value = "off",
},{
.driver = "migration",
.property = "store-global-state",
.value = "off",
},
};
const size_t hw_compat_2_3_len = G_N_ELEMENTS(hw_compat_2_3);
static char *machine_get_accel(Object *obj, Error **errp)
{
MachineState *ms = MACHINE(obj);

View File

@ -355,6 +355,92 @@ GlobalProperty pc_compat_2_4[] = {
};
const size_t pc_compat_2_4_len = G_N_ELEMENTS(pc_compat_2_4);
GlobalProperty pc_compat_2_3[] = {
PC_CPU_MODEL_IDS("2.3.0")
{
.driver = TYPE_X86_CPU,
.property = "arat",
.value = "off",
},{
.driver = "qemu64" "-" TYPE_X86_CPU,
.property = "min-level",
.value = stringify(4),
},{
.driver = "kvm64" "-" TYPE_X86_CPU,
.property = "min-level",
.value = stringify(5),
},{
.driver = "pentium3" "-" TYPE_X86_CPU,
.property = "min-level",
.value = stringify(2),
},{
.driver = "n270" "-" TYPE_X86_CPU,
.property = "min-level",
.value = stringify(5),
},{
.driver = "Conroe" "-" TYPE_X86_CPU,
.property = "min-level",
.value = stringify(4),
},{
.driver = "Penryn" "-" TYPE_X86_CPU,
.property = "min-level",
.value = stringify(4),
},{
.driver = "Nehalem" "-" TYPE_X86_CPU,
.property = "min-level",
.value = stringify(4),
},{
.driver = "n270" "-" TYPE_X86_CPU,
.property = "min-xlevel",
.value = stringify(0x8000000a),
},{
.driver = "Penryn" "-" TYPE_X86_CPU,
.property = "min-xlevel",
.value = stringify(0x8000000a),
},{
.driver = "Conroe" "-" TYPE_X86_CPU,
.property = "min-xlevel",
.value = stringify(0x8000000a),
},{
.driver = "Nehalem" "-" TYPE_X86_CPU,
.property = "min-xlevel",
.value = stringify(0x8000000a),
},{
.driver = "Westmere" "-" TYPE_X86_CPU,
.property = "min-xlevel",
.value = stringify(0x8000000a),
},{
.driver = "SandyBridge" "-" TYPE_X86_CPU,
.property = "min-xlevel",
.value = stringify(0x8000000a),
},{
.driver = "IvyBridge" "-" TYPE_X86_CPU,
.property = "min-xlevel",
.value = stringify(0x8000000a),
},{
.driver = "Haswell" "-" TYPE_X86_CPU,
.property = "min-xlevel",
.value = stringify(0x8000000a),
},{
.driver = "Haswell-noTSX" "-" TYPE_X86_CPU,
.property = "min-xlevel",
.value = stringify(0x8000000a),
},{
.driver = "Broadwell" "-" TYPE_X86_CPU,
.property = "min-xlevel",
.value = stringify(0x8000000a),
},{
.driver = "Broadwell-noTSX" "-" TYPE_X86_CPU,
.property = "min-xlevel",
.value = stringify(0x8000000a),
},{
.driver = TYPE_X86_CPU,
.property = "kvm-no-smi-migration",
.value = "on",
},
};
const size_t pc_compat_2_3_len = G_N_ELEMENTS(pc_compat_2_3);
void gsi_handler(void *opaque, int n, int level)
{
GSIState *s = opaque;

View File

@ -310,7 +310,7 @@ static void pc_init1(MachineState *machine,
* HW_COMPAT_*, PC_COMPAT_*, or * pc_*_machine_options().
*/
static void pc_compat_2_3(MachineState *machine)
static void pc_compat_2_3_fn(MachineState *machine)
{
PCMachineState *pcms = PC_MACHINE(machine);
if (kvm_enabled()) {
@ -320,7 +320,7 @@ static void pc_compat_2_3(MachineState *machine)
static void pc_compat_2_2(MachineState *machine)
{
pc_compat_2_3(machine);
pc_compat_2_3_fn(machine);
}
static void pc_compat_2_1(MachineState *machine)
@ -566,16 +566,13 @@ DEFINE_I440FX_MACHINE(v2_4, "pc-i440fx-2.4", NULL,
static void pc_i440fx_2_3_machine_options(MachineClass *m)
{
static GlobalProperty compat[] = {
PC_COMPAT_2_3
};
pc_i440fx_2_4_machine_options(m);
m->hw_version = "2.3.0";
compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat));
compat_props_add(m->compat_props, hw_compat_2_3, hw_compat_2_3_len);
compat_props_add(m->compat_props, pc_compat_2_3, pc_compat_2_3_len);
}
DEFINE_I440FX_MACHINE(v2_3, "pc-i440fx-2.3", pc_compat_2_3,
DEFINE_I440FX_MACHINE(v2_3, "pc-i440fx-2.3", pc_compat_2_3_fn,
pc_i440fx_2_3_machine_options);
static void pc_i440fx_2_2_machine_options(MachineClass *m)

View File

@ -4322,7 +4322,6 @@ DEFINE_SPAPR_MACHINE(2_4, "2.4", false);
static void spapr_machine_2_3_class_options(MachineClass *mc)
{
static GlobalProperty compat[] = {
HW_COMPAT_2_3
{
.driver = "spapr-pci-host-bridge",
.property = "dynamic-reconfiguration",
@ -4330,6 +4329,7 @@ static void spapr_machine_2_3_class_options(MachineClass *mc)
},
};
spapr_machine_2_4_class_options(mc);
compat_props_add(mc->compat_props, hw_compat_2_3, hw_compat_2_3_len);
compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
}
DEFINE_SPAPR_MACHINE(2_3, "2.3", false);

View File

@ -321,4 +321,7 @@ extern const size_t hw_compat_2_5_len;
extern GlobalProperty hw_compat_2_4[];
extern const size_t hw_compat_2_4_len;
extern GlobalProperty hw_compat_2_3[];
extern const size_t hw_compat_2_3_len;
#endif

View File

@ -1,45 +1,6 @@
#ifndef HW_COMPAT_H
#define HW_COMPAT_H
#define HW_COMPAT_2_3 \
{\
.driver = "virtio-blk-pci",\
.property = "any_layout",\
.value = "off",\
},{\
.driver = "virtio-balloon-pci",\
.property = "any_layout",\
.value = "off",\
},{\
.driver = "virtio-serial-pci",\
.property = "any_layout",\
.value = "off",\
},{\
.driver = "virtio-9p-pci",\
.property = "any_layout",\
.value = "off",\
},{\
.driver = "virtio-rng-pci",\
.property = "any_layout",\
.value = "off",\
},{\
.driver = TYPE_PCI_DEVICE,\
.property = "x-pcie-lnksta-dllla",\
.value = "off",\
},{\
.driver = "migration",\
.property = "send-configuration",\
.value = "off",\
},{\
.driver = "migration",\
.property = "send-section-footer",\
.value = "off",\
},{\
.driver = "migration",\
.property = "store-global-state",\
.value = "off",\
},
#define HW_COMPAT_2_2 \
/* empty */

View File

@ -327,6 +327,9 @@ extern const size_t pc_compat_2_5_len;
extern GlobalProperty pc_compat_2_4[];
extern const size_t pc_compat_2_4_len;
extern GlobalProperty pc_compat_2_3[];
extern const size_t pc_compat_2_3_len;
/* Helper for setting model-id for CPU models that changed model-id
* depending on QEMU versions up to QEMU 2.4.
*/
@ -347,91 +350,6 @@ extern const size_t pc_compat_2_4_len;
.value = "QEMU Virtual CPU version " v,\
},
#define PC_COMPAT_2_3 \
HW_COMPAT_2_3 \
PC_CPU_MODEL_IDS("2.3.0") \
{\
.driver = TYPE_X86_CPU,\
.property = "arat",\
.value = "off",\
},{\
.driver = "qemu64" "-" TYPE_X86_CPU,\
.property = "min-level",\
.value = stringify(4),\
},{\
.driver = "kvm64" "-" TYPE_X86_CPU,\
.property = "min-level",\
.value = stringify(5),\
},{\
.driver = "pentium3" "-" TYPE_X86_CPU,\
.property = "min-level",\
.value = stringify(2),\
},{\
.driver = "n270" "-" TYPE_X86_CPU,\
.property = "min-level",\
.value = stringify(5),\
},{\
.driver = "Conroe" "-" TYPE_X86_CPU,\
.property = "min-level",\
.value = stringify(4),\
},{\
.driver = "Penryn" "-" TYPE_X86_CPU,\
.property = "min-level",\
.value = stringify(4),\
},{\
.driver = "Nehalem" "-" TYPE_X86_CPU,\
.property = "min-level",\
.value = stringify(4),\
},{\
.driver = "n270" "-" TYPE_X86_CPU,\
.property = "min-xlevel",\
.value = stringify(0x8000000a),\
},{\
.driver = "Penryn" "-" TYPE_X86_CPU,\
.property = "min-xlevel",\
.value = stringify(0x8000000a),\
},{\
.driver = "Conroe" "-" TYPE_X86_CPU,\
.property = "min-xlevel",\
.value = stringify(0x8000000a),\
},{\
.driver = "Nehalem" "-" TYPE_X86_CPU,\
.property = "min-xlevel",\
.value = stringify(0x8000000a),\
},{\
.driver = "Westmere" "-" TYPE_X86_CPU,\
.property = "min-xlevel",\
.value = stringify(0x8000000a),\
},{\
.driver = "SandyBridge" "-" TYPE_X86_CPU,\
.property = "min-xlevel",\
.value = stringify(0x8000000a),\
},{\
.driver = "IvyBridge" "-" TYPE_X86_CPU,\
.property = "min-xlevel",\
.value = stringify(0x8000000a),\
},{\
.driver = "Haswell" "-" TYPE_X86_CPU,\
.property = "min-xlevel",\
.value = stringify(0x8000000a),\
},{\
.driver = "Haswell-noTSX" "-" TYPE_X86_CPU,\
.property = "min-xlevel",\
.value = stringify(0x8000000a),\
},{\
.driver = "Broadwell" "-" TYPE_X86_CPU,\
.property = "min-xlevel",\
.value = stringify(0x8000000a),\
},{\
.driver = "Broadwell-noTSX" "-" TYPE_X86_CPU,\
.property = "min-xlevel",\
.value = stringify(0x8000000a),\
},{\
.driver = TYPE_X86_CPU,\
.property = "kvm-no-smi-migration",\
.value = "on",\
},
#define PC_COMPAT_2_2 \
HW_COMPAT_2_2 \
PC_CPU_MODEL_IDS("2.2.0") \