diff mbox

[v2,1/4] pc: add 2.3 machine types

Message ID 1418209592-9373-2-git-send-email-pbonzini@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini Dec. 10, 2014, 11:06 a.m. UTC
The next patch will differentiate them.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/i386/pc_piix.c | 30 +++++++++++++++++++++++++++---
 hw/i386/pc_q35.c  | 26 +++++++++++++++++++++++---
 2 files changed, 50 insertions(+), 6 deletions(-)

Comments

Eduardo Habkost Dec. 10, 2014, 1:12 p.m. UTC | #1
On Wed, Dec 10, 2014 at 12:06:29PM +0100, Paolo Bonzini wrote:
[...]

pc_piix.c:
> +#define PC_I440FX_2_3_MACHINE_OPTIONS                           \
> +    PC_I440FX_MACHINE_OPTIONS,                                  \
> +    .default_machine_opts = "firmware=bios-256k.bin",           \
> +    .default_display = "std"
> +
[...]
>  #define PC_I440FX_2_2_MACHINE_OPTIONS                           \
>      PC_I440FX_MACHINE_OPTIONS,                                  \
>      .default_machine_opts = "firmware=bios-256k.bin",           \

pc_q35.c:
> -#define PC_Q35_2_2_MACHINE_OPTIONS                      \
> +#define PC_Q35_2_3_MACHINE_OPTIONS                      \
>      PC_Q35_MACHINE_OPTIONS,                             \
>      .default_machine_opts = "firmware=bios-256k.bin",   \
>      .default_display = "std"
[...]
> +#define PC_Q35_2_2_MACHINE_OPTIONS PC_Q35_2_3_MACHINE_OPTIONS

I don't know which approach I prefer (I would be happy with either), but
why the difference?

The patch is still correct either way, so:

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Paolo Bonzini Dec. 10, 2014, 3:08 p.m. UTC | #2
On 10/12/2014 14:12, Eduardo Habkost wrote:
>> > +#define PC_Q35_2_2_MACHINE_OPTIONS PC_Q35_2_3_MACHINE_OPTIONS
> I don't know which approach I prefer (I would be happy with either), but
> why the difference?

I'm just mimicking what's around:

#define PC_Q35_2_0_MACHINE_OPTIONS PC_Q35_2_1_MACHINE_OPTIONS

Paolo
Eduardo Habkost Dec. 10, 2014, 3:48 p.m. UTC | #3
On Wed, Dec 10, 2014 at 04:08:38PM +0100, Paolo Bonzini wrote:
> On 10/12/2014 14:12, Eduardo Habkost wrote:
> >> > +#define PC_Q35_2_2_MACHINE_OPTIONS PC_Q35_2_3_MACHINE_OPTIONS
> > I don't know which approach I prefer (I would be happy with either), but
> > why the difference?
> 
> I'm just mimicking what's around:
> 
> #define PC_Q35_2_0_MACHINE_OPTIONS PC_Q35_2_1_MACHINE_OPTIONS

Whatever you see on pc_q35.c, it is also present on pc_piix.c:

#define PC_I440FX_2_0_MACHINE_OPTIONS PC_I440FX_2_1_MACHINE_OPTIONS

Both approaches are OK to me, I just don't see why you decided to make
pc_piix.c and pc_q35.c different.
Paolo Bonzini Dec. 10, 2014, 4:45 p.m. UTC | #4
On 10/12/2014 16:48, Eduardo Habkost wrote:
> Whatever you see on pc_q35.c, it is also present on pc_piix.c:
> 
> #define PC_I440FX_2_0_MACHINE_OPTIONS PC_I440FX_2_1_MACHINE_OPTIONS
> 
> Both approaches are OK to me, I just don't see why you decided to make
> pc_piix.c and pc_q35.c different.

Because I didn't notice it in pc_piix.c.  I'll change to

#define PC_I440FX_2_2_MACHINE_OPTIONS PC_I440FX_2_3_MACHINE_OPTIONS

Thanks, and sorry for the confusion.

Paolo
diff mbox

Patch

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 741dffd..3a79c05 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -303,9 +303,15 @@  static void pc_init_pci(MachineState *machine)
     pc_init1(machine, 1, 1);
 }
 
+static void pc_compat_2_2(MachineState *machine)
+{
+}
+
 static void pc_compat_2_1(MachineState *machine)
 {
     PCMachineState *pcms = PC_MACHINE(machine);
+
+    pc_compat_2_2(machine);
     smbios_uuid_encoded = false;
     x86_cpu_compat_set_features("coreduo", FEAT_1_ECX, CPUID_EXT_VMX, 0);
     x86_cpu_compat_set_features("core2duo", FEAT_1_ECX, CPUID_EXT_VMX, 0);
@@ -380,6 +386,12 @@  static void pc_compat_1_2(MachineState *machine)
     x86_cpu_compat_kvm_no_autoenable(FEAT_KVM, KVM_FEATURE_PV_EOI);
 }
 
+static void pc_init_pci_2_2(MachineState *machine)
+{
+    pc_compat_2_2(machine);
+    pc_init_pci(machine);
+}
+
 static void pc_init_pci_2_1(MachineState *machine)
 {
     pc_compat_2_1(machine);
@@ -473,6 +485,19 @@  static void pc_xen_hvm_init(MachineState *machine)
     .desc = "Standard PC (i440FX + PIIX, 1996)", \
     .hot_add_cpu = pc_hot_add_cpu
 
+#define PC_I440FX_2_3_MACHINE_OPTIONS                           \
+    PC_I440FX_MACHINE_OPTIONS,                                  \
+    .default_machine_opts = "firmware=bios-256k.bin",           \
+    .default_display = "std"
+
+static QEMUMachine pc_i440fx_machine_v2_3 = {
+    PC_I440FX_2_3_MACHINE_OPTIONS,
+    .name = "pc-i440fx-2.3",
+    .alias = "pc",
+    .init = pc_init_pci,
+    .is_default = 1,
+};
+
 #define PC_I440FX_2_2_MACHINE_OPTIONS                           \
     PC_I440FX_MACHINE_OPTIONS,                                  \
     .default_machine_opts = "firmware=bios-256k.bin",           \
@@ -481,9 +506,7 @@  static void pc_xen_hvm_init(MachineState *machine)
 static QEMUMachine pc_i440fx_machine_v2_2 = {
     PC_I440FX_2_2_MACHINE_OPTIONS,
     .name = "pc-i440fx-2.2",
-    .alias = "pc",
-    .init = pc_init_pci,
-    .is_default = 1,
+    .init = pc_init_pci_2_2,
 };
 
 #define PC_I440FX_2_1_MACHINE_OPTIONS                           \
@@ -923,6 +946,7 @@  static QEMUMachine xenfv_machine = {
 
 static void pc_machine_init(void)
 {
+    qemu_register_pc_machine(&pc_i440fx_machine_v2_3);
     qemu_register_pc_machine(&pc_i440fx_machine_v2_2);
     qemu_register_pc_machine(&pc_i440fx_machine_v2_1);
     qemu_register_pc_machine(&pc_i440fx_machine_v2_0);
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index e9ba1a2..a40b939 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -282,10 +282,15 @@  static void pc_q35_init(MachineState *machine)
     }
 }
 
+static void pc_compat_2_2(MachineState *machine)
+{
+}
+
 static void pc_compat_2_1(MachineState *machine)
 {
     PCMachineState *pcms = PC_MACHINE(machine);
 
+    pc_compat_2_2(machine);
     pcms->enforce_aligned_dimm = false;
     smbios_uuid_encoded = false;
     x86_cpu_compat_set_features("coreduo", FEAT_1_ECX, CPUID_EXT_VMX, 0);
@@ -329,6 +334,12 @@  static void pc_compat_1_4(MachineState *machine)
     x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, CPUID_EXT_PCLMULQDQ);
 }
 
+static void pc_q35_init_2_2(MachineState *machine)
+{
+    pc_compat_2_2(machine);
+    pc_q35_init(machine);
+}
+
 static void pc_q35_init_2_1(MachineState *machine)
 {
     pc_compat_2_1(machine);
@@ -372,16 +383,24 @@  static void pc_q35_init_1_4(MachineState *machine)
     .hot_add_cpu = pc_hot_add_cpu, \
     .units_per_default_bus = 1
 
-#define PC_Q35_2_2_MACHINE_OPTIONS                      \
+#define PC_Q35_2_3_MACHINE_OPTIONS                      \
     PC_Q35_MACHINE_OPTIONS,                             \
     .default_machine_opts = "firmware=bios-256k.bin",   \
     .default_display = "std"
 
+static QEMUMachine pc_q35_machine_v2_3 = {
+    PC_Q35_2_3_MACHINE_OPTIONS,
+    .name = "pc-q35-2.3",
+    .alias = "q35",
+    .init = pc_q35_init,
+};
+
+#define PC_Q35_2_2_MACHINE_OPTIONS PC_Q35_2_3_MACHINE_OPTIONS
+
 static QEMUMachine pc_q35_machine_v2_2 = {
     PC_Q35_2_2_MACHINE_OPTIONS,
     .name = "pc-q35-2.2",
-    .alias = "q35",
-    .init = pc_q35_init,
+    .init = pc_q35_init_2_2,
 };
 
 #define PC_Q35_2_1_MACHINE_OPTIONS                      \
@@ -460,6 +479,7 @@  static QEMUMachine pc_q35_machine_v1_4 = {
 
 static void pc_q35_machine_init(void)
 {
+    qemu_register_pc_machine(&pc_q35_machine_v2_3);
     qemu_register_pc_machine(&pc_q35_machine_v2_2);
     qemu_register_pc_machine(&pc_q35_machine_v2_1);
     qemu_register_pc_machine(&pc_q35_machine_v2_0);