Use static arrays instead.
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>
static void virt_machine_2_9_options(MachineClass *mc)
{
- static GlobalProperty compat[] = {
- HW_COMPAT_2_9
- };
-
virt_machine_2_10_options(mc);
- compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
+ compat_props_add(mc->compat_props, hw_compat_2_9, hw_compat_2_9_len);
}
DEFINE_VIRT_MACHINE(2, 9)
};
const size_t hw_compat_2_10_len = G_N_ELEMENTS(hw_compat_2_10);
+GlobalProperty hw_compat_2_9[] = {
+ {
+ .driver = "pci-bridge",
+ .property = "shpc",
+ .value = "off",
+ },{
+ .driver = "intel-iommu",
+ .property = "pt",
+ .value = "off",
+ },{
+ .driver = "virtio-net-device",
+ .property = "x-mtu-bypass-backend",
+ .value = "off",
+ },{
+ .driver = "pcie-root-port",
+ .property = "x-migrate-msix",
+ .value = "false",
+ },
+};
+const size_t hw_compat_2_9_len = G_N_ELEMENTS(hw_compat_2_9);
+
static char *machine_get_accel(Object *obj, Error **errp)
{
MachineState *ms = MACHINE(obj);
};
const size_t pc_compat_2_10_len = G_N_ELEMENTS(pc_compat_2_10);
+GlobalProperty pc_compat_2_9[] = {
+ {
+ .driver = "mch",
+ .property = "extended-tseg-mbytes",
+ .value = stringify(0),
+ },
+};
+const size_t pc_compat_2_9_len = G_N_ELEMENTS(pc_compat_2_9);
+
void gsi_handler(void *opaque, int n, int level)
{
GSIState *s = opaque;
static void pc_i440fx_2_9_machine_options(MachineClass *m)
{
- static GlobalProperty compat[] = {
- PC_COMPAT_2_9
- };
-
pc_i440fx_2_10_machine_options(m);
- compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat));
+ compat_props_add(m->compat_props, hw_compat_2_9, hw_compat_2_9_len);
+ compat_props_add(m->compat_props, pc_compat_2_9, pc_compat_2_9_len);
m->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
}
static void pc_q35_2_9_machine_options(MachineClass *m)
{
- static GlobalProperty compat[] = {
- PC_COMPAT_2_9
- };
-
pc_q35_2_10_machine_options(m);
- compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat));
+ compat_props_add(m->compat_props, hw_compat_2_9, hw_compat_2_9_len);
+ compat_props_add(m->compat_props, pc_compat_2_9, pc_compat_2_9_len);
}
DEFINE_Q35_MACHINE(v2_9, "pc-q35-2.9", NULL,
{
sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
static GlobalProperty compat[] = {
- HW_COMPAT_2_9
{
.driver = TYPE_POWERPC_CPU,
.property = "pre-2.10-migration",
};
spapr_machine_2_10_class_options(mc);
+ compat_props_add(mc->compat_props, hw_compat_2_9, hw_compat_2_9_len);
compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
mc->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
smc->pre_2_10_has_unused_icps = true;
{
S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc);
static GlobalProperty compat[] = {
- HW_COMPAT_2_9
{
.driver = TYPE_S390_STATTRIB,
.property = "migration-enabled",
};
ccw_machine_2_10_class_options(mc);
+ compat_props_add(mc->compat_props, hw_compat_2_9, hw_compat_2_9_len);
compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
s390mc->css_migration_enabled = false;
}
extern GlobalProperty hw_compat_2_10[];
extern const size_t hw_compat_2_10_len;
+extern GlobalProperty hw_compat_2_9[];
+extern const size_t hw_compat_2_9_len;
+
#endif
#ifndef HW_COMPAT_H
#define HW_COMPAT_H
-#define HW_COMPAT_2_9 \
- {\
- .driver = "pci-bridge",\
- .property = "shpc",\
- .value = "off",\
- },{\
- .driver = "intel-iommu",\
- .property = "pt",\
- .value = "off",\
- },{\
- .driver = "virtio-net-device",\
- .property = "x-mtu-bypass-backend",\
- .value = "off",\
- },{\
- .driver = "pcie-root-port",\
- .property = "x-migrate-msix",\
- .value = "false",\
- },
-
#define HW_COMPAT_2_8 \
{\
.driver = "fw_cfg_mem",\
extern GlobalProperty pc_compat_2_10[];
extern const size_t pc_compat_2_10_len;
-#define PC_COMPAT_2_9 \
- HW_COMPAT_2_9 \
- {\
- .driver = "mch",\
- .property = "extended-tseg-mbytes",\
- .value = stringify(0),\
- },\
+extern GlobalProperty pc_compat_2_9[];
+extern const size_t pc_compat_2_9_len;
#define PC_COMPAT_2_8 \
HW_COMPAT_2_8 \