From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49273) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SC9tn-0001XK-FK for qemu-devel@nongnu.org; Mon, 26 Mar 2012 09:23:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SC9th-0004su-3G for qemu-devel@nongnu.org; Mon, 26 Mar 2012 09:23:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:62963) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SC9tg-0004sd-RE for qemu-devel@nongnu.org; Mon, 26 Mar 2012 09:23:45 -0400 Date: Mon, 26 Mar 2012 15:23:50 +0200 From: "Michael S. Tsirkin" Message-ID: <20120326132349.GA16511@redhat.com> References: <20120326094020.GA14437@redhat.com> <4F706B45.5000303@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <4F706B45.5000303@suse.de> 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: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: Anthony Liguori , Jan Kiszka , qemu-devel@nongnu.org, Alexander Graf , Avi Kivity , Anthony PERARD On Mon, Mar 26, 2012 at 03:12:37PM +0200, Andreas F=E4rber wrote: > 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. >=20 > 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. >=20 > Andreas There are some properties like that currently. For example, see ide-drive "ver" property or VGA rombar property. I'm not sure that's intentional but I kept it as is. In that case we can simply keep it out of the common macros, that's what I did. There's no rule that says we must have everything in there. > >=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 > --=20 > SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany > GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrn= berg