Add v2.1 machine types and (empty) compat functions for v2.0, to both piix and q35. For now, the new machines will behave identically to their 2.0 counterparts.
Signed-off-by: Gabriel Somlo somlo@cmu.edu --- hw/i386/pc_piix.c | 27 ++++++++++++++++++++++++--- hw/i386/pc_q35.c | 25 +++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 7930a26..f13d0ac 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -262,8 +262,13 @@ static void pc_init_pci(QEMUMachineInitArgs *args) pc_init1(args, 1, 1); }
+static void pc_compat_2_0(QEMUMachineInitArgs *args) +{ +} + static void pc_compat_1_7(QEMUMachineInitArgs *args) { + pc_compat_2_0(args); smbios_type1_defaults = false; gigabyte_align = false; option_rom_has_mr = true; @@ -303,6 +308,12 @@ static void pc_compat_1_2(QEMUMachineInitArgs *args) x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI); }
+static void pc_init_pci_2_0(QEMUMachineInitArgs *args) +{ + pc_compat_2_0(args); + pc_init_pci(args); +} + static void pc_init_pci_1_7(QEMUMachineInitArgs *args) { pc_compat_1_7(args); @@ -387,14 +398,23 @@ static void pc_xen_hvm_init(QEMUMachineInitArgs *args) PC_I440FX_MACHINE_OPTIONS, \ .default_machine_opts = "firmware=bios-256k.bin"
-static QEMUMachine pc_i440fx_machine_v2_0 = { - PC_I440FX_2_0_MACHINE_OPTIONS, - .name = "pc-i440fx-2.0", +#define PC_I440FX_2_1_MACHINE_OPTIONS \ + PC_I440FX_2_0_MACHINE_OPTIONS + +static QEMUMachine pc_i440fx_machine_v2_1 = { + PC_I440FX_2_1_MACHINE_OPTIONS, + .name = "pc-i440fx-2.1", .alias = "pc", .init = pc_init_pci, .is_default = 1, };
+static QEMUMachine pc_i440fx_machine_v2_0 = { + PC_I440FX_2_0_MACHINE_OPTIONS, + .name = "pc-i440fx-2.0", + .init = pc_init_pci_2_0, +}; + #define PC_I440FX_1_7_MACHINE_OPTIONS PC_I440FX_MACHINE_OPTIONS
static QEMUMachine pc_i440fx_machine_v1_7 = { @@ -817,6 +837,7 @@ static QEMUMachine xenfv_machine = {
static void pc_machine_init(void) { + qemu_register_machine(&pc_i440fx_machine_v2_1); qemu_register_machine(&pc_i440fx_machine_v2_0); qemu_register_machine(&pc_i440fx_machine_v1_7); qemu_register_machine(&pc_i440fx_machine_v1_6); diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index c844dc2..1622700 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -240,8 +240,13 @@ static void pc_q35_init(QEMUMachineInitArgs *args) } }
+static void pc_compat_2_0(QEMUMachineInitArgs *args) +{ +} + static void pc_compat_1_7(QEMUMachineInitArgs *args) { + pc_compat_2_0(args); smbios_type1_defaults = false; gigabyte_align = false; option_rom_has_mr = true; @@ -268,6 +273,12 @@ static void pc_compat_1_4(QEMUMachineInitArgs *args) x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, CPUID_EXT_PCLMULQDQ); }
+static void pc_q35_init_2_0(QEMUMachineInitArgs *args) +{ + pc_compat_2_0(args); + pc_q35_init(args); +} + static void pc_q35_init_1_7(QEMUMachineInitArgs *args) { pc_compat_1_7(args); @@ -301,11 +312,20 @@ static void pc_q35_init_1_4(QEMUMachineInitArgs *args) PC_Q35_MACHINE_OPTIONS, \ .default_machine_opts = "firmware=bios-256k.bin"
+#define PC_Q35_2_1_MACHINE_OPTIONS \ + PC_Q35_2_0_MACHINE_OPTIONS + +static QEMUMachine pc_q35_machine_v2_1 = { + PC_Q35_2_1_MACHINE_OPTIONS, + .name = "pc-q35-2.1", + .alias = "q35", + .init = pc_q35_init, +}; + static QEMUMachine pc_q35_machine_v2_0 = { PC_Q35_2_0_MACHINE_OPTIONS, .name = "pc-q35-2.0", - .alias = "q35", - .init = pc_q35_init, + .init = pc_q35_init_2_0, };
#define PC_Q35_1_7_MACHINE_OPTIONS PC_Q35_MACHINE_OPTIONS @@ -358,6 +378,7 @@ static QEMUMachine pc_q35_machine_v1_4 = {
static void pc_q35_machine_init(void) { + qemu_register_machine(&pc_q35_machine_v2_1); qemu_register_machine(&pc_q35_machine_v2_0); qemu_register_machine(&pc_q35_machine_v1_7); qemu_register_machine(&pc_q35_machine_v1_6);