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:42 +0400
commit1c30044e1aba56066eb6a51a788ce6a15a8faa8f (patch)
tree8d92b9038337303da59207a8a582deec833dafc8
parent8995dd9009a4f0845393c102098dc94e14806c37 (diff)
downloadqemu-1c30044e1aba56066eb6a51a788ce6a15a8faa8f.zip
qemu-1c30044e1aba56066eb6a51a788ce6a15a8faa8f.tar.gz
qemu-1c30044e1aba56066eb6a51a788ce6a15a8faa8f.tar.bz2
compat: replace PC_COMPAT_2_2 & HW_COMPAT_2_2 macros
Use static arrays instead. I decided to rename the conflicting pc_compat_2_2() function with pc_compat_2_2_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.c3
-rw-r--r--hw/i386/pc.c95
-rw-r--r--hw/i386/pc_piix.c12
-rw-r--r--hw/ppc/spapr.c2
-rw-r--r--include/hw/boards.h3
-rw-r--r--include/hw/compat.h3
-rw-r--r--include/hw/i386/pc.h97
7 files changed, 110 insertions, 105 deletions
diff --git a/hw/core/machine.c b/hw/core/machine.c
index d37cdc3..cfa9a5d 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -306,6 +306,9 @@ GlobalProperty hw_compat_2_3[] = {
};
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);
+
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 1f6d780..b92d190 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -441,6 +441,101 @@ GlobalProperty pc_compat_2_3[] = {
};
const size_t pc_compat_2_3_len = G_N_ELEMENTS(pc_compat_2_3);
+GlobalProperty pc_compat_2_2[] = {
+ PC_CPU_MODEL_IDS("2.2.0")
+ {
+ .driver = "kvm64" "-" TYPE_X86_CPU,
+ .property = "vme",
+ .value = "off",
+ },
+ {
+ .driver = "kvm32" "-" TYPE_X86_CPU,
+ .property = "vme",
+ .value = "off",
+ },
+ {
+ .driver = "Conroe" "-" TYPE_X86_CPU,
+ .property = "vme",
+ .value = "off",
+ },
+ {
+ .driver = "Penryn" "-" TYPE_X86_CPU,
+ .property = "vme",
+ .value = "off",
+ },
+ {
+ .driver = "Nehalem" "-" TYPE_X86_CPU,
+ .property = "vme",
+ .value = "off",
+ },
+ {
+ .driver = "Westmere" "-" TYPE_X86_CPU,
+ .property = "vme",
+ .value = "off",
+ },
+ {
+ .driver = "SandyBridge" "-" TYPE_X86_CPU,
+ .property = "vme",
+ .value = "off",
+ },
+ {
+ .driver = "Haswell" "-" TYPE_X86_CPU,
+ .property = "vme",
+ .value = "off",
+ },
+ {
+ .driver = "Broadwell" "-" TYPE_X86_CPU,
+ .property = "vme",
+ .value = "off",
+ },
+ {
+ .driver = "Opteron_G1" "-" TYPE_X86_CPU,
+ .property = "vme",
+ .value = "off",
+ },
+ {
+ .driver = "Opteron_G2" "-" TYPE_X86_CPU,
+ .property = "vme",
+ .value = "off",
+ },
+ {
+ .driver = "Opteron_G3" "-" TYPE_X86_CPU,
+ .property = "vme",
+ .value = "off",
+ },
+ {
+ .driver = "Opteron_G4" "-" TYPE_X86_CPU,
+ .property = "vme",
+ .value = "off",
+ },
+ {
+ .driver = "Opteron_G5" "-" TYPE_X86_CPU,
+ .property = "vme",
+ .value = "off",
+ },
+ {
+ .driver = "Haswell" "-" TYPE_X86_CPU,
+ .property = "f16c",
+ .value = "off",
+ },
+ {
+ .driver = "Haswell" "-" TYPE_X86_CPU,
+ .property = "rdrand",
+ .value = "off",
+ },
+ {
+ .driver = "Broadwell" "-" TYPE_X86_CPU,
+ .property = "f16c",
+ .value = "off",
+ },
+ {
+ .driver = "Broadwell" "-" TYPE_X86_CPU,
+ .property = "rdrand",
+ .value = "off",
+ },
+};
+const size_t pc_compat_2_2_len = G_N_ELEMENTS(pc_compat_2_2);
+
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 5b03f9e..d2a2bac 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -318,14 +318,14 @@ static void pc_compat_2_3_fn(MachineState *machine)
}
}
-static void pc_compat_2_2(MachineState *machine)
+static void pc_compat_2_2_fn(MachineState *machine)
{
pc_compat_2_3_fn(machine);
}
static void pc_compat_2_1(MachineState *machine)
{
- pc_compat_2_2(machine);
+ pc_compat_2_2_fn(machine);
x86_cpu_change_kvm_default("svm", NULL);
}
@@ -578,18 +578,16 @@ DEFINE_I440FX_MACHINE(v2_3, "pc-i440fx-2.3", pc_compat_2_3_fn,
static void pc_i440fx_2_2_machine_options(MachineClass *m)
{
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
- static GlobalProperty compat[] = {
- PC_COMPAT_2_2
- };
pc_i440fx_2_3_machine_options(m);
m->hw_version = "2.2.0";
m->default_machine_opts = "firmware=bios-256k.bin,suppress-vmdesc=on";
- compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat));
+ compat_props_add(m->compat_props, hw_compat_2_2, hw_compat_2_2_len);
+ compat_props_add(m->compat_props, pc_compat_2_2, pc_compat_2_2_len);
pcmc->rsdp_in_ram = false;
}
-DEFINE_I440FX_MACHINE(v2_2, "pc-i440fx-2.2", pc_compat_2_2,
+DEFINE_I440FX_MACHINE(v2_2, "pc-i440fx-2.2", pc_compat_2_2_fn,
pc_i440fx_2_2_machine_options);
static void pc_i440fx_2_1_machine_options(MachineClass *m)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index b99ed19..449c5dd 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -4341,7 +4341,6 @@ DEFINE_SPAPR_MACHINE(2_3, "2.3", false);
static void spapr_machine_2_2_class_options(MachineClass *mc)
{
static GlobalProperty compat[] = {
- HW_COMPAT_2_2
{
.driver = TYPE_SPAPR_PCI_HOST_BRIDGE,
.property = "mem_win_size",
@@ -4350,6 +4349,7 @@ static void spapr_machine_2_2_class_options(MachineClass *mc)
};
spapr_machine_2_3_class_options(mc);
+ compat_props_add(mc->compat_props, hw_compat_2_2, hw_compat_2_2_len);
compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
mc->default_machine_opts = "modern-hotplug-events=off,suppress-vmdesc=on";
}
diff --git a/include/hw/boards.h b/include/hw/boards.h
index e7e3d2b..2d82d80 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -324,4 +324,7 @@ extern const size_t hw_compat_2_4_len;
extern GlobalProperty hw_compat_2_3[];
extern const size_t hw_compat_2_3_len;
+extern GlobalProperty hw_compat_2_2[];
+extern const size_t hw_compat_2_2_len;
+
#endif
diff --git a/include/hw/compat.h b/include/hw/compat.h
index fbe64d5..3bd91908 100644
--- a/include/hw/compat.h
+++ b/include/hw/compat.h
@@ -1,9 +1,6 @@
#ifndef HW_COMPAT_H
#define HW_COMPAT_H
-#define HW_COMPAT_2_2 \
- /* empty */
-
#define HW_COMPAT_2_1 \
{\
.driver = "intel-hda",\
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index def40cd..49b45bb 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -330,6 +330,9 @@ extern const size_t pc_compat_2_4_len;
extern GlobalProperty pc_compat_2_3[];
extern const size_t pc_compat_2_3_len;
+extern GlobalProperty pc_compat_2_2[];
+extern const size_t pc_compat_2_2_len;
+
/* Helper for setting model-id for CPU models that changed model-id
* depending on QEMU versions up to QEMU 2.4.
*/
@@ -350,100 +353,6 @@ extern const size_t pc_compat_2_3_len;
.value = "QEMU Virtual CPU version " v,\
},
-#define PC_COMPAT_2_2 \
- HW_COMPAT_2_2 \
- PC_CPU_MODEL_IDS("2.2.0") \
- {\
- .driver = "kvm64" "-" TYPE_X86_CPU,\
- .property = "vme",\
- .value = "off",\
- },\
- {\
- .driver = "kvm32" "-" TYPE_X86_CPU,\
- .property = "vme",\
- .value = "off",\
- },\
- {\
- .driver = "Conroe" "-" TYPE_X86_CPU,\
- .property = "vme",\
- .value = "off",\
- },\
- {\
- .driver = "Penryn" "-" TYPE_X86_CPU,\
- .property = "vme",\
- .value = "off",\
- },\
- {\
- .driver = "Nehalem" "-" TYPE_X86_CPU,\
- .property = "vme",\
- .value = "off",\
- },\
- {\
- .driver = "Westmere" "-" TYPE_X86_CPU,\
- .property = "vme",\
- .value = "off",\
- },\
- {\
- .driver = "SandyBridge" "-" TYPE_X86_CPU,\
- .property = "vme",\
- .value = "off",\
- },\
- {\
- .driver = "Haswell" "-" TYPE_X86_CPU,\
- .property = "vme",\
- .value = "off",\
- },\
- {\
- .driver = "Broadwell" "-" TYPE_X86_CPU,\
- .property = "vme",\
- .value = "off",\
- },\
- {\
- .driver = "Opteron_G1" "-" TYPE_X86_CPU,\
- .property = "vme",\
- .value = "off",\
- },\
- {\
- .driver = "Opteron_G2" "-" TYPE_X86_CPU,\
- .property = "vme",\
- .value = "off",\
- },\
- {\
- .driver = "Opteron_G3" "-" TYPE_X86_CPU,\
- .property = "vme",\
- .value = "off",\
- },\
- {\
- .driver = "Opteron_G4" "-" TYPE_X86_CPU,\
- .property = "vme",\
- .value = "off",\
- },\
- {\
- .driver = "Opteron_G5" "-" TYPE_X86_CPU,\
- .property = "vme",\
- .value = "off",\
- },\
- {\
- .driver = "Haswell" "-" TYPE_X86_CPU,\
- .property = "f16c",\
- .value = "off",\
- },\
- {\
- .driver = "Haswell" "-" TYPE_X86_CPU,\
- .property = "rdrand",\
- .value = "off",\
- },\
- {\
- .driver = "Broadwell" "-" TYPE_X86_CPU,\
- .property = "f16c",\
- .value = "off",\
- },\
- {\
- .driver = "Broadwell" "-" TYPE_X86_CPU,\
- .property = "rdrand",\
- .value = "off",\
- },
-
#define PC_COMPAT_2_1 \
HW_COMPAT_2_1 \
PC_CPU_MODEL_IDS("2.1.0") \