diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2013-08-27 09:48:06 +0300 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2013-09-01 10:43:25 +0300 |
commit | a0dba644c139907ccf6735c505fbd254010d6938 (patch) | |
tree | c4ab7e7ba79372ea9aaf3fcf7b31182be8b86b34 /hw/i386/pc_q35.c | |
parent | c16547326988cc321c9bff43ed91cbe753e52892 (diff) |
pc: reduce duplication, fix PIIX descriptions
We have a lot of code duplication between machine types,
this increases with each new machine type
and each new field.
This has already introduced a minor bug: description
for pc-1.3 says "Standard PC" while description for
pc-1.4 is "Standard PC (i440FX + PIIX, 1996)"
which makes you think 1.3 is somehow more standard,
or newer, while in fact it's a revision of the same PC.
This patch addresses this issue by using macros, along
the lines used by PC_COMPAT_X_X - only for
non-property options.
The approach can extend to non-PC machine types.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/i386/pc_q35.c')
-rw-r--r-- | hw/i386/pc_q35.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 291ad97c5f..d7b7c3bf9a 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -253,35 +253,38 @@ static void pc_q35_init_1_4(QEMUMachineInitArgs *args) pc_q35_init(args); } +#define PC_Q35_MACHINE_OPTIONS \ + PC_DEFAULT_MACHINE_OPTIONS, \ + .desc = "Standard PC (Q35 + ICH9, 2009)", \ + .hot_add_cpu = pc_hot_add_cpu + +#define PC_Q35_1_6_MACHINE_OPTIONS PC_Q35_MACHINE_OPTIONS + static QEMUMachine pc_q35_machine_v1_6 = { + PC_Q35_1_6_MACHINE_OPTIONS, .name = "pc-q35-1.6", .alias = "q35", - .desc = "Standard PC (Q35 + ICH9, 2009)", .init = pc_q35_init_1_6, - .hot_add_cpu = pc_hot_add_cpu, - .max_cpus = 255, - .default_boot_order = "cad", }; static QEMUMachine pc_q35_machine_v1_5 = { + PC_Q35_1_6_MACHINE_OPTIONS, .name = "pc-q35-1.5", - .desc = "Standard PC (Q35 + ICH9, 2009)", .init = pc_q35_init_1_5, - .hot_add_cpu = pc_hot_add_cpu, - .max_cpus = 255, - .default_boot_order = "cad", .compat_props = (GlobalProperty[]) { PC_COMPAT_1_5, { /* end of list */ } }, }; +#define PC_Q35_1_4_MACHINE_OPTIONS \ + PC_Q35_1_6_MACHINE_OPTIONS, \ + .hot_add_cpu = NULL + static QEMUMachine pc_q35_machine_v1_4 = { + PC_Q35_1_4_MACHINE_OPTIONS, .name = "pc-q35-1.4", - .desc = "Standard PC (Q35 + ICH9, 2009)", .init = pc_q35_init_1_4, - .max_cpus = 255, - .default_boot_order = "cad", .compat_props = (GlobalProperty[]) { PC_COMPAT_1_4, { /* end of list */ } |