From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SC9j2-0007BQ-VK for qemu-devel@nongnu.org; Mon, 26 Mar 2012 09:12:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SC9ix-0001df-Ba for qemu-devel@nongnu.org; Mon, 26 Mar 2012 09:12:44 -0400 Received: from cantor2.suse.de ([195.135.220.15]:36886 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SC9ix-0001dI-2F for qemu-devel@nongnu.org; Mon, 26 Mar 2012 09:12:39 -0400 Message-ID: <4F706B45.5000303@suse.de> Date: Mon, 26 Mar 2012 15:12:37 +0200 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <20120326094020.GA14437@redhat.com> In-Reply-To: <20120326094020.GA14437@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] pc: reduce duplication in compat machine types List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Anthony Liguori , Jan Kiszka , qemu-devel@nongnu.org, Alexander Graf , Avi Kivity , Anthony PERARD Am 26.03.2012 11:40, schrieb Michael S. Tsirkin: > Make it easier to add compat properties, by > adding macros for properties duplicated across > machine types. >=20 > Note: there could be bugs in compat properties, > this patch does not attempt to address them, > the code is bug for bug identical to the original. >=20 > Tested by: generated a preprocessed file, sorted and > compared to sorted original. > Lightly tested on x86_64. >=20 > Signed-off-by: Michael S. Tsirkin > --- >=20 > I've put the above on my branch as it's needed for > fixing balloon pci class. Let me know if there are > any objections. Better reusing code is certainly a good idea. I wonder though if we might ever get into a situation where things change back and forth. I'd hope that properties are processed top to bottom so that, e.g., PC_COMPAT_1_0, { ... } can overwrite 0_15 compat properties inherited through 1_0. Andreas >=20 > hw/pc_piix.c | 288 +++++++++++++++-----------------------------------= -------- > 1 files changed, 73 insertions(+), 215 deletions(-) >=20 > diff --git a/hw/pc_piix.c b/hw/pc_piix.c > index 3f99f9a..e39ef69 100644 > --- a/hw/pc_piix.c > +++ b/hw/pc_piix.c > @@ -372,50 +372,69 @@ static QEMUMachine pc_machine_v1_1 =3D { > .is_default =3D 1, > }; > =20 > +#define PC_COMPAT_1_0 \ > + {\ > + .driver =3D "pc-sysfw",\ > + .property =3D "rom_only",\ > + .value =3D stringify(1),\ > + }, {\ > + .driver =3D "isa-fdc",\ > + .property =3D "check_media_rate",\ > + .value =3D "off",\ > + } > + > static QEMUMachine pc_machine_v1_0 =3D { > .name =3D "pc-1.0", > .desc =3D "Standard PC", > .init =3D pc_init_pci, > .max_cpus =3D 255, > .compat_props =3D (GlobalProperty[]) { > - { > - .driver =3D "pc-sysfw", > - .property =3D "rom_only", > - .value =3D stringify(1), > - }, { > - .driver =3D "isa-fdc", > - .property =3D "check_media_rate", > - .value =3D "off", > - }, > + PC_COMPAT_1_0, > { /* end of list */ } > }, > }; [snip] --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg