[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 10/28] compat: replace PC_COMPAT_2_10 & HW_COMPAT
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v6 10/28] compat: replace PC_COMPAT_2_10 & HW_COMPAT_2_10 macros |
Date: |
Thu, 13 Dec 2018 01:48:32 +0400 |
Use static arrays instead.
Suggested-by: Eduardo Habkost <address@hidden>
Signed-off-by: Marc-André Lureau <address@hidden>
---
include/hw/boards.h | 3 +++
include/hw/compat.h | 11 -----------
include/hw/i386/pc.h | 17 ++---------------
hw/arm/virt.c | 6 +-----
hw/core/machine.c | 13 +++++++++++++
hw/i386/pc.c | 17 +++++++++++++++++
hw/i386/pc_piix.c | 7 ++-----
hw/i386/pc_q35.c | 7 ++-----
hw/ppc/spapr.c | 6 +-----
hw/s390x/s390-virtio-ccw.c | 6 +-----
10 files changed, 42 insertions(+), 51 deletions(-)
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 59c3c4b75e..f701b66183 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -299,4 +299,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 cf389b4e85..f414786604 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 f0f7e76a3e..d77843a711 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 \
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 13d9a3e4b7..f0c9929c18 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 e8f715542a..7ab83bf4e2 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -78,6 +78,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 72d718f2ea..34d3cf9b30 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -163,6 +163,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 32daebc05e..d3e795de20 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 bc195b8c58..8d708cd163 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -366,12 +366,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 88e2c8df71..10e91d857c 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -4054,12 +4054,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 385102c5d9..5c6e3ee165 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -721,12 +721,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);
--
2.20.0
- [Qemu-devel] [PATCH v6 00/28] Generalize machine compatibility properties, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 01/28] hw: apply accel compat properties without touching globals, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 02/28] machines: replace COMPAT define with a static array, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 05/28] hw: remove SET_MACHINE_COMPAT, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 03/28] hw: apply machine compat properties without touching globals, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 06/28] compat: replace PC_COMPAT_3_1 & HW_COMPAT_3_1 macros, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 04/28] machine: move compat properties out of globals, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 07/28] compat: replace PC_COMPAT_3_0 & HW_COMPAT_3_0 macros, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 08/28] compat: replace PC_COMPAT_2_12 & HW_COMPAT_2_12 macros, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 09/28] compat: replace PC_COMPAT_2_11 & HW_COMPAT_2_11 macros, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 10/28] compat: replace PC_COMPAT_2_10 & HW_COMPAT_2_10 macros,
Marc-André Lureau <=
- [Qemu-devel] [PATCH v6 11/28] compat: replace PC_COMPAT_2_9 & HW_COMPAT_2_9 macros, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 12/28] compat: replace PC_COMPAT_2_8 & HW_COMPAT_2_8 macros, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 13/28] compat: replace PC_COMPAT_2_7 & HW_COMPAT_2_7 macros, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 14/28] compat: replace PC_COMPAT_2_6 & HW_COMPAT_2_6 macros, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 15/28] compat: replace PC_COMPAT_2_5 & HW_COMPAT_2_5 macros, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 16/28] compat: replace PC_COMPAT_2_4 & HW_COMPAT_2_4 macros, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 18/28] compat: replace PC_COMPAT_2_2 & HW_COMPAT_2_2 macros, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 19/28] compat: replace PC_COMPAT_2_1 & HW_COMPAT_2_1 macros, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 17/28] compat: replace PC_COMPAT_2_3 & HW_COMPAT_2_3 macros, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 20/28] include: remove compat.h, Marc-André Lureau, 2018/12/12