Received: from eggs.gnu.org ([2001:4830:134:3::10]:42549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlMUI-0003AF-1e for qemu-devel@nongnu.org; Thu, 23 Apr 2015 15:08:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YlMUD-000205-1R for qemu-devel@nongnu.org; Thu, 23 Apr 2015 15:08:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48453) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlMUC-0001ym-NL for qemu-devel@nongnu.org; Thu, 23 Apr 2015 15:08:32 -0400 Date: Thu, 23 Apr 2015 16:05:56 -0300 From: Eduardo Habkost Message-ID: <20150423190556.GB17796@thinpad.lan.raisama.net> References: <1429655891-198219-1-git-send-email-agraf@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1429655891-198219-1-git-send-email-agraf@suse.de> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/2] x86: Add 2.4 pc machine versions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: pbonzini@redhat.com, "Michael S. Tsirkin" , qemu-devel@nongnu.org, afaerber@suse.de, "Bernhard M. Wiedemann" (CCing the PC maintainer, Michael) On Wed, Apr 22, 2015 at 12:38:10AM +0200, Alexander Graf wrote: > This patch adds all the boilerplate required to handle a 2.4 machine ty= pe > and compatibility options required on older machines. >=20 > Signed-off-by: Alexander Graf > --- > hw/i386/pc_piix.c | 37 +++++++++++++++++++++++++++++++++---- > hw/i386/pc_q35.c | 34 +++++++++++++++++++++++++++++++--- > include/hw/i386/pc.h | 3 +++ > 3 files changed, 67 insertions(+), 7 deletions(-) >=20 This doesn't build: CC x86_64-softmmu/hw/i386/pc_piix.o /home/ehabkost/rh/proj/virt/qemu/hw/i386/pc_piix.c:546:9: error: expected= expression before =E2=80=98,=E2=80=99 token PC_COMPAT_2_3, ^ /home/ehabkost/rh/proj/virt/qemu/hw/i386/pc_piix.c:558:9: error: expected= expression before =E2=80=98,=E2=80=99 token PC_COMPAT_2_3, ^ > diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c > index 1fe7bfb..cf14b1f 100644 > --- a/hw/i386/pc_piix.c > +++ b/hw/i386/pc_piix.c > @@ -310,8 +310,13 @@ static void pc_init_pci(MachineState *machine) > pc_init1(machine, 1, 1); > } > =20 > +static void pc_compat_2_3(MachineState *machine) > +{ > +} > + > static void pc_compat_2_2(MachineState *machine) > { > + pc_compat_2_3(machine); > rsdp_in_ram =3D false; > x86_cpu_compat_set_features("kvm64", FEAT_1_EDX, 0, CPUID_VME); > x86_cpu_compat_set_features("kvm32", FEAT_1_EDX, 0, CPUID_VME); > @@ -413,6 +418,12 @@ static void pc_compat_1_2(MachineState *machine) > x86_cpu_compat_kvm_no_autoenable(FEAT_KVM, 1 << KVM_FEATURE_PV_EOI= ); > } > =20 > +static void pc_init_pci_2_3(MachineState *machine) > +{ > + pc_compat_2_3(machine); > + pc_init_pci(machine); > +} > + > static void pc_init_pci_2_2(MachineState *machine) > { > pc_compat_2_2(machine); > @@ -512,25 +523,41 @@ static void pc_xen_hvm_init(MachineState *machine= ) > .desc =3D "Standard PC (i440FX + PIIX, 1996)", \ > .hot_add_cpu =3D pc_hot_add_cpu > =20 > -#define PC_I440FX_2_3_MACHINE_OPTIONS \ > +#define PC_I440FX_2_4_MACHINE_OPTIONS \ > PC_I440FX_MACHINE_OPTIONS, \ > .default_machine_opts =3D "firmware=3Dbios-256k.bin", \ > .default_display =3D "std" > =20 > -static QEMUMachine pc_i440fx_machine_v2_3 =3D { > - PC_I440FX_2_3_MACHINE_OPTIONS, > - .name =3D "pc-i440fx-2.3", > +static QEMUMachine pc_i440fx_machine_v2_4 =3D { > + PC_I440FX_2_4_MACHINE_OPTIONS, > + .name =3D "pc-i440fx-2.4", > .alias =3D "pc", > .init =3D pc_init_pci, > .is_default =3D 1, > }; > =20 > +#define PC_I440FX_2_3_MACHINE_OPTIONS PC_I440FX_2_4_MACHINE_OPTIONS > + > +static QEMUMachine pc_i440fx_machine_v2_3 =3D { > + PC_I440FX_2_3_MACHINE_OPTIONS, > + .name =3D "pc-i440fx-2.3", > + .init =3D pc_init_pci_2_3, > + .compat_props =3D (GlobalProperty[]) { > + PC_COMPAT_2_3, > + { /* end of list */ } > + }, > +}; > + > #define PC_I440FX_2_2_MACHINE_OPTIONS PC_I440FX_2_3_MACHINE_OPTIONS > =20 > static QEMUMachine pc_i440fx_machine_v2_2 =3D { > PC_I440FX_2_2_MACHINE_OPTIONS, > .name =3D "pc-i440fx-2.2", > .init =3D pc_init_pci_2_2, > + .compat_props =3D (GlobalProperty[]) { > + PC_COMPAT_2_3, > + { /* end of list */ } > + }, > }; > =20 > #define PC_I440FX_2_1_MACHINE_OPTIONS \ > @@ -543,6 +570,7 @@ static QEMUMachine pc_i440fx_machine_v2_1 =3D { > .init =3D pc_init_pci_2_1, > .compat_props =3D (GlobalProperty[]) { > HW_COMPAT_2_1, > + PC_COMPAT_2_3, PC_COMPAT_2_3 must be in the beginning of the list, not in the end. To ma= ke QEMU 2.4 behave like QEMU 2.1, first we apply the properties that make QE= MU 2.4 behave as QEMU 2.3, then we apply the properties that made QEMU 2.3 behav= e as QEMU 2.2, then we apply the properties that made QEMU 2.2 behave as QEMU = 2.1. Also, why did you decide to define a PC_COMPAT_2_3 macro and not define a PC_COMPAT_2_2 macro? We could make it more consistent and always define the PC_* macros even i= f they are empty (like you already tried to do on PC_COMPAT_2_3), like this: #define PC_COMPAT_2_3 \ /* empty */ #define PC_COMPAT_2_2 \ PC_COMPAT_2_3 /* no extra elements */ #define PC_COMPAT_2_1 \ PC_COMPAT_2_2 HW_COMPAT_2_1 { /* item 1 */ }, { /* item 2 */ }, #define PC_COMPAT_2_0 \ PC_COMPAT_2_1 { /* item 1 */ }, { /* item 2 */ }, Note that I moved the final commas inside the macros, to allow us to defi= ne empty compat macros without compilation errors like the one introduced by= this patch. > { /* end of list */ } > }, > }; > @@ -970,6 +998,7 @@ static QEMUMachine xenfv_machine =3D { > =20 > static void pc_machine_init(void) > { > + qemu_register_pc_machine(&pc_i440fx_machine_v2_4); > 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); > diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c > index dcc17c0..8ef9e27 100644 > --- a/hw/i386/pc_q35.c > +++ b/hw/i386/pc_q35.c > @@ -289,6 +289,10 @@ static void pc_q35_init(MachineState *machine) > } > } > =20 > +static void pc_compat_2_3(MachineState *machine) > +{ > +} > + > static void pc_compat_2_2(MachineState *machine) > { > rsdp_in_ram =3D false; > @@ -361,6 +365,12 @@ static void pc_compat_1_4(MachineState *machine) > x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, CPUID_EXT_P= CLMULQDQ); > } > =20 > +static void pc_q35_init_2_3(MachineState *machine) > +{ > + pc_compat_2_3(machine); > + pc_q35_init(machine); > +} > + > static void pc_q35_init_2_2(MachineState *machine) > { > pc_compat_2_2(machine); > @@ -410,16 +420,28 @@ static void pc_q35_init_1_4(MachineState *machine= ) > .hot_add_cpu =3D pc_hot_add_cpu, \ > .units_per_default_bus =3D 1 > =20 > -#define PC_Q35_2_3_MACHINE_OPTIONS \ > +#define PC_Q35_2_4_MACHINE_OPTIONS \ > PC_Q35_MACHINE_OPTIONS, \ > .default_machine_opts =3D "firmware=3Dbios-256k.bin", \ > .default_display =3D "std" > =20 > +static QEMUMachine pc_q35_machine_v2_4 =3D { > + PC_Q35_2_4_MACHINE_OPTIONS, > + .name =3D "pc-q35-2.4", > + .alias =3D "q35", > + .init =3D pc_q35_init, > +}; > + > +#define PC_Q35_2_3_MACHINE_OPTIONS PC_Q35_2_4_MACHINE_OPTIONS > + > static QEMUMachine pc_q35_machine_v2_3 =3D { > PC_Q35_2_3_MACHINE_OPTIONS, > .name =3D "pc-q35-2.3", > - .alias =3D "q35", > - .init =3D pc_q35_init, > + .init =3D pc_q35_init_2_3, > + .compat_props =3D (GlobalProperty[]) { > + PC_COMPAT_2_3, > + { /* end of list */ } > + }, > }; > =20 > #define PC_Q35_2_2_MACHINE_OPTIONS PC_Q35_2_3_MACHINE_OPTIONS > @@ -428,6 +450,10 @@ static QEMUMachine pc_q35_machine_v2_2 =3D { > PC_Q35_2_2_MACHINE_OPTIONS, > .name =3D "pc-q35-2.2", > .init =3D pc_q35_init_2_2, > + .compat_props =3D (GlobalProperty[]) { > + PC_COMPAT_2_3, > + { /* end of list */ } > + }, > }; > =20 > #define PC_Q35_2_1_MACHINE_OPTIONS \ > @@ -440,6 +466,7 @@ static QEMUMachine pc_q35_machine_v2_1 =3D { > .init =3D pc_q35_init_2_1, > .compat_props =3D (GlobalProperty[]) { > HW_COMPAT_2_1, > + PC_COMPAT_2_3, > { /* end of list */ } > }, > }; > @@ -506,6 +533,7 @@ static QEMUMachine pc_q35_machine_v1_4 =3D { > =20 > static void pc_q35_machine_init(void) > { > + qemu_register_pc_machine(&pc_q35_machine_v2_4); > 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); > diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h > index 1b35168..05ac5f9 100644 > --- a/include/hw/i386/pc.h > +++ b/include/hw/i386/pc.h > @@ -295,7 +295,10 @@ int e820_add_entry(uint64_t, uint64_t, uint32_t); > int e820_get_num_entries(void); > bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > =20 > +#define PC_COMPAT_2_3 \ > + > #define PC_COMPAT_2_0 \ > + PC_COMPAT_2_3, \ > HW_COMPAT_2_1, \ > {\ > .driver =3D "virtio-scsi-pci",\ > --=20 > 1.7.12.4 >=20 >=20 --=20 Eduardo