From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57073) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gcPMQ-0001rE-EM for qemu-devel@nongnu.org; Thu, 27 Dec 2018 01:41:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gcPMM-0003MO-Ho for qemu-devel@nongnu.org; Thu, 27 Dec 2018 01:41:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59960) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gcPMJ-0003Fb-RF for qemu-devel@nongnu.org; Thu, 27 Dec 2018 01:41:32 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 02FA940F06 for ; Thu, 27 Dec 2018 06:41:26 +0000 (UTC) Date: Thu, 27 Dec 2018 07:41:17 +0100 From: Igor Mammedov Message-ID: <20181227074117.01c5775d@Igors-MacBook-Pro.local> In-Reply-To: <20181221090410.27250-11-marcandre.lureau@redhat.com> References: <20181221090410.27250-1-marcandre.lureau@redhat.com> <20181221090410.27250-11-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v7 10/28] compat: replace PC_COMPAT_2_10 & HW_COMPAT_2_10 macros List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Marc-Andr=C3=A9?= Lureau Cc: qemu-devel@nongnu.org, ehabkost@redhat.com On Fri, 21 Dec 2018 13:03:52 +0400 Marc-Andr=C3=A9 Lureau wrote: > Use static arrays instead. >=20 > Suggested-by: Eduardo Habkost > Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Igor Mammedov > --- > include/hw/boards.h | 3 +++ > include/hw/compat.h | 11 ----------- > include/hw/i386/pc.h | 17 ++--------------- > hw/arm/virt.c | 6 +----- > hw/core/machine.c | 13 +++++++++++++ > hw/i386/pc.c | 17 +++++++++++++++++ > hw/i386/pc_piix.c | 7 ++----- > hw/i386/pc_q35.c | 7 ++----- > hw/ppc/spapr.c | 6 +----- > hw/s390x/s390-virtio-ccw.c | 6 +----- > 10 files changed, 42 insertions(+), 51 deletions(-) >=20 > diff --git a/include/hw/boards.h b/include/hw/boards.h > index 59c3c4b75e..f701b66183 100644 > --- a/include/hw/boards.h > +++ b/include/hw/boards.h > @@ -299,4 +299,7 @@ extern const size_t hw_compat_2_12_len; > extern GlobalProperty hw_compat_2_11[]; > extern const size_t hw_compat_2_11_len; > =20 > +extern GlobalProperty hw_compat_2_10[]; > +extern const size_t hw_compat_2_10_len; > + > #endif > diff --git a/include/hw/compat.h b/include/hw/compat.h > index cf389b4e85..f414786604 100644 > --- a/include/hw/compat.h > +++ b/include/hw/compat.h > @@ -1,17 +1,6 @@ > #ifndef HW_COMPAT_H > #define HW_COMPAT_H > =20 > -#define HW_COMPAT_2_10 \ > - {\ > - .driver =3D "virtio-mouse-device",\ > - .property =3D "wheel-axis",\ > - .value =3D "false",\ > - },{\ > - .driver =3D "virtio-tablet-device",\ > - .property =3D "wheel-axis",\ > - .value =3D "false",\ > - }, > - > #define HW_COMPAT_2_9 \ > {\ > .driver =3D "pci-bridge",\ > diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h > index f0f7e76a3e..d77843a711 100644 > --- a/include/hw/i386/pc.h > +++ b/include/hw/i386/pc.h > @@ -306,21 +306,8 @@ extern const size_t pc_compat_2_12_len; > extern GlobalProperty pc_compat_2_11[]; > extern const size_t pc_compat_2_11_len; > =20 > -#define PC_COMPAT_2_10 \ > - HW_COMPAT_2_10 \ > - {\ > - .driver =3D TYPE_X86_CPU,\ > - .property =3D "x-hv-max-vps",\ > - .value =3D "0x40",\ > - },{\ > - .driver =3D "i440FX-pcihost",\ > - .property =3D "x-pci-hole64-fix",\ > - .value =3D "off",\ > - },{\ > - .driver =3D "q35-pcihost",\ > - .property =3D "x-pci-hole64-fix",\ > - .value =3D "off",\ > - }, > +extern GlobalProperty pc_compat_2_10[]; > +extern const size_t pc_compat_2_10_len; > =20 > #define PC_COMPAT_2_9 \ > HW_COMPAT_2_9 \ > diff --git a/hw/arm/virt.c b/hw/arm/virt.c > index b7aabd4ac7..e382bdfd96 100644 > --- a/hw/arm/virt.c > +++ b/hw/arm/virt.c > @@ -1909,12 +1909,8 @@ DEFINE_VIRT_MACHINE(2, 11) > =20 > static void virt_machine_2_10_options(MachineClass *mc) > { > - static GlobalProperty compat[] =3D { > - HW_COMPAT_2_10 > - }; > - > virt_machine_2_11_options(mc); > - compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); > + compat_props_add(mc->compat_props, hw_compat_2_10, hw_compat_2_10_le= n); > /* before 2.11 we never faulted accesses to bad addresses */ > mc->ignore_memory_transaction_failures =3D true; > } > diff --git a/hw/core/machine.c b/hw/core/machine.c > index e8f715542a..7ab83bf4e2 100644 > --- a/hw/core/machine.c > +++ b/hw/core/machine.c > @@ -78,6 +78,19 @@ GlobalProperty hw_compat_2_11[] =3D { > }; > const size_t hw_compat_2_11_len =3D G_N_ELEMENTS(hw_compat_2_11); > =20 > +GlobalProperty hw_compat_2_10[] =3D { > + { > + .driver =3D "virtio-mouse-device", > + .property =3D "wheel-axis", > + .value =3D "false", > + },{ > + .driver =3D "virtio-tablet-device", > + .property =3D "wheel-axis", > + .value =3D "false", > + }, > +}; > +const size_t hw_compat_2_10_len =3D G_N_ELEMENTS(hw_compat_2_10); > + > static char *machine_get_accel(Object *obj, Error **errp) > { > MachineState *ms =3D MACHINE(obj); > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > index e42a1eae51..71b3b2e1d8 100644 > --- a/hw/i386/pc.c > +++ b/hw/i386/pc.c > @@ -163,6 +163,23 @@ GlobalProperty pc_compat_2_11[] =3D { > }; > const size_t pc_compat_2_11_len =3D G_N_ELEMENTS(pc_compat_2_11); > =20 > +GlobalProperty pc_compat_2_10[] =3D { > + { > + .driver =3D TYPE_X86_CPU, > + .property =3D "x-hv-max-vps", > + .value =3D "0x40", > + },{ > + .driver =3D "i440FX-pcihost", > + .property =3D "x-pci-hole64-fix", > + .value =3D "off", > + },{ > + .driver =3D "q35-pcihost", > + .property =3D "x-pci-hole64-fix", > + .value =3D "off", > + }, > +}; > +const size_t pc_compat_2_10_len =3D G_N_ELEMENTS(pc_compat_2_10); > + > void gsi_handler(void *opaque, int n, int level) > { > GSIState *s =3D opaque; > diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c > index 32daebc05e..d3e795de20 100644 > --- a/hw/i386/pc_piix.c > +++ b/hw/i386/pc_piix.c > @@ -482,12 +482,9 @@ DEFINE_I440FX_MACHINE(v2_11, "pc-i440fx-2.11", NULL, > =20 > static void pc_i440fx_2_10_machine_options(MachineClass *m) > { > - static GlobalProperty compat[] =3D { > - PC_COMPAT_2_10 > - }; > - > pc_i440fx_2_11_machine_options(m); > - compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat)); > + compat_props_add(m->compat_props, hw_compat_2_10, hw_compat_2_10_len= ); > + compat_props_add(m->compat_props, pc_compat_2_10, pc_compat_2_10_len= ); > m->auto_enable_numa_with_memhp =3D false; > } > =20 > diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c > index bc195b8c58..8d708cd163 100644 > --- a/hw/i386/pc_q35.c > +++ b/hw/i386/pc_q35.c > @@ -366,12 +366,9 @@ DEFINE_Q35_MACHINE(v2_11, "pc-q35-2.11", NULL, > =20 > static void pc_q35_2_10_machine_options(MachineClass *m) > { > - static GlobalProperty compat[] =3D { > - PC_COMPAT_2_10 > - }; > - > pc_q35_2_11_machine_options(m); > - compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat)); > + compat_props_add(m->compat_props, hw_compat_2_10, hw_compat_2_10_len= ); > + compat_props_add(m->compat_props, pc_compat_2_10, pc_compat_2_10_len= ); > m->numa_auto_assign_ram =3D numa_legacy_auto_assign_ram; > m->auto_enable_numa_with_memhp =3D false; > } > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 88e2c8df71..10e91d857c 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -4054,12 +4054,8 @@ DEFINE_SPAPR_MACHINE(2_11, "2.11", false); > =20 > static void spapr_machine_2_10_class_options(MachineClass *mc) > { > - static GlobalProperty compat[] =3D { > - HW_COMPAT_2_10 > - }; > - > spapr_machine_2_11_class_options(mc); > - compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); > + compat_props_add(mc->compat_props, hw_compat_2_10, hw_compat_2_10_le= n); > } > =20 > DEFINE_SPAPR_MACHINE(2_10, "2.10", false); > diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c > index 74623becaf..95ad7ba842 100644 > --- a/hw/s390x/s390-virtio-ccw.c > +++ b/hw/s390x/s390-virtio-ccw.c > @@ -733,12 +733,8 @@ static void ccw_machine_2_10_instance_options(Machin= eState *machine) > =20 > static void ccw_machine_2_10_class_options(MachineClass *mc) > { > - static GlobalProperty compat[] =3D { > - HW_COMPAT_2_10 > - }; > - > ccw_machine_2_11_class_options(mc); > - compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); > + compat_props_add(mc->compat_props, hw_compat_2_10, hw_compat_2_10_le= n); > } > DEFINE_CCW_MACHINE(2_10, "2.10", false); > =20