aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2018-12-12 19:36:30 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2019-01-07 16:18:41 +0400
commit503224f4c8d1469ea9c00a2017334a455044d822 (patch)
treee15b626fc048eb9fedac41f248837b4a400e08d9
parent43df70a9ddfc40961188bf1c6f67fed3b899b8da (diff)
downloadqemu-503224f4c8d1469ea9c00a2017334a455044d822.zip
qemu-503224f4c8d1469ea9c00a2017334a455044d822.tar.gz
qemu-503224f4c8d1469ea9c00a2017334a455044d822.tar.bz2
compat: replace PC_COMPAT_2_10 & HW_COMPAT_2_10 macros
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>
-rw-r--r--hw/arm/virt.c6
-rw-r--r--hw/core/machine.c13
-rw-r--r--hw/i386/pc.c17
-rw-r--r--hw/i386/pc_piix.c7
-rw-r--r--hw/i386/pc_q35.c7
-rw-r--r--hw/ppc/spapr.c6
-rw-r--r--hw/s390x/s390-virtio-ccw.c6
-rw-r--r--include/hw/boards.h3
-rw-r--r--include/hw/compat.h11
-rw-r--r--include/hw/i386/pc.h17
10 files changed, 42 insertions, 51 deletions
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 548b6ef..75ab143 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1909,12 +1909,8 @@ DEFINE_VIRT_MACHINE(2, 11)
static void virt_machine_2_10_options(MachineClass *mc)
{
- static GlobalProperty compat[] = {
- HW_COMPAT_2_10
- };
-
virt_machine_2_11_options(mc);
- compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
+ compat_props_add(mc->compat_props, hw_compat_2_10, hw_compat_2_10_len);
/* before 2.11 we never faulted accesses to bad addresses */
mc->ignore_memory_transaction_failures = true;
}
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 41f37ee..7673454 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -88,6 +88,19 @@ GlobalProperty hw_compat_2_11[] = {
};
const size_t hw_compat_2_11_len = G_N_ELEMENTS(hw_compat_2_11);
+GlobalProperty hw_compat_2_10[] = {
+ {
+ .driver = "virtio-mouse-device",
+ .property = "wheel-axis",
+ .value = "false",
+ },{
+ .driver = "virtio-tablet-device",
+ .property = "wheel-axis",
+ .value = "false",
+ },
+};
+const size_t hw_compat_2_10_len = G_N_ELEMENTS(hw_compat_2_10);
+
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 563ba90..c0bb82c 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -169,6 +169,23 @@ GlobalProperty pc_compat_2_11[] = {
};
const size_t pc_compat_2_11_len = G_N_ELEMENTS(pc_compat_2_11);
+GlobalProperty pc_compat_2_10[] = {
+ {
+ .driver = TYPE_X86_CPU,
+ .property = "x-hv-max-vps",
+ .value = "0x40",
+ },{
+ .driver = "i440FX-pcihost",
+ .property = "x-pci-hole64-fix",
+ .value = "off",
+ },{
+ .driver = "q35-pcihost",
+ .property = "x-pci-hole64-fix",
+ .value = "off",
+ },
+};
+const size_t pc_compat_2_10_len = G_N_ELEMENTS(pc_compat_2_10);
+
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 aeb51a2..aea678d 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -482,12 +482,9 @@ DEFINE_I440FX_MACHINE(v2_11, "pc-i440fx-2.11", NULL,
static void pc_i440fx_2_10_machine_options(MachineClass *m)
{
- static GlobalProperty compat[] = {
- PC_COMPAT_2_10
- };
-
pc_i440fx_2_11_machine_options(m);
- compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat));
+ compat_props_add(m->compat_props, hw_compat_2_10, hw_compat_2_10_len);
+ compat_props_add(m->compat_props, pc_compat_2_10, pc_compat_2_10_len);
m->auto_enable_numa_with_memhp = false;
}
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index fd31870..a9c4fc2 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -368,12 +368,9 @@ DEFINE_Q35_MACHINE(v2_11, "pc-q35-2.11", NULL,
static void pc_q35_2_10_machine_options(MachineClass *m)
{
- static GlobalProperty compat[] = {
- PC_COMPAT_2_10
- };
-
pc_q35_2_11_machine_options(m);
- compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat));
+ compat_props_add(m->compat_props, hw_compat_2_10, hw_compat_2_10_len);
+ compat_props_add(m->compat_props, pc_compat_2_10, pc_compat_2_10_len);
m->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
m->auto_enable_numa_with_memhp = false;
}
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 9afa22f..483a137 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -4113,12 +4113,8 @@ DEFINE_SPAPR_MACHINE(2_11, "2.11", false);
static void spapr_machine_2_10_class_options(MachineClass *mc)
{
- static GlobalProperty compat[] = {
- HW_COMPAT_2_10
- };
-
spapr_machine_2_11_class_options(mc);
- compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
+ compat_props_add(mc->compat_props, hw_compat_2_10, hw_compat_2_10_len);
}
DEFINE_SPAPR_MACHINE(2_10, "2.10", false);
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 74623be..95ad7ba 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -733,12 +733,8 @@ static void ccw_machine_2_10_instance_options(MachineState *machine)
static void ccw_machine_2_10_class_options(MachineClass *mc)
{
- static GlobalProperty compat[] = {
- HW_COMPAT_2_10
- };
-
ccw_machine_2_11_class_options(mc);
- compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
+ compat_props_add(mc->compat_props, hw_compat_2_10, hw_compat_2_10_len);
}
DEFINE_CCW_MACHINE(2_10, "2.10", false);
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 67202b5..732eb7b 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -300,4 +300,7 @@ extern const size_t hw_compat_2_12_len;
extern GlobalProperty hw_compat_2_11[];
extern const size_t hw_compat_2_11_len;
+extern GlobalProperty hw_compat_2_10[];
+extern const size_t hw_compat_2_10_len;
+
#endif
diff --git a/include/hw/compat.h b/include/hw/compat.h
index cf389b4..f414786 100644
--- a/include/hw/compat.h
+++ b/include/hw/compat.h
@@ -1,17 +1,6 @@
#ifndef HW_COMPAT_H
#define HW_COMPAT_H
-#define HW_COMPAT_2_10 \
- {\
- .driver = "virtio-mouse-device",\
- .property = "wheel-axis",\
- .value = "false",\
- },{\
- .driver = "virtio-tablet-device",\
- .property = "wheel-axis",\
- .value = "false",\
- },
-
#define HW_COMPAT_2_9 \
{\
.driver = "pci-bridge",\
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index f0f7e76..d77843a 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -306,21 +306,8 @@ extern const size_t pc_compat_2_12_len;
extern GlobalProperty pc_compat_2_11[];
extern const size_t pc_compat_2_11_len;
-#define PC_COMPAT_2_10 \
- HW_COMPAT_2_10 \
- {\
- .driver = TYPE_X86_CPU,\
- .property = "x-hv-max-vps",\
- .value = "0x40",\
- },{\
- .driver = "i440FX-pcihost",\
- .property = "x-pci-hole64-fix",\
- .value = "off",\
- },{\
- .driver = "q35-pcihost",\
- .property = "x-pci-hole64-fix",\
- .value = "off",\
- },
+extern GlobalProperty pc_compat_2_10[];
+extern const size_t pc_compat_2_10_len;
#define PC_COMPAT_2_9 \
HW_COMPAT_2_9 \