[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] pc: reduce duplication in compat machine types
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [PATCH] pc: reduce duplication in compat machine types |
Date: |
Mon, 26 Mar 2012 15:32:22 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon, Mar 26, 2012 at 02:51:38PM +0200, Avi Kivity wrote:
> On 03/26/2012 11:40 AM, Michael S. Tsirkin wrote:
> > Make it easier to add compat properties, by
> > adding macros for properties duplicated across
> > machine types.
> >
> > 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.
> >
> > Tested by: generated a preprocessed file, sorted and
> > compared to sorted original.
> > Lightly tested on x86_64.
> >
> >
> > +#define PC_COMPAT_1_0 \
> > + {\
> > + .driver = "pc-sysfw",\
> > + .property = "rom_only",\
> > + .value = stringify(1),\
> > + }, {\
> > + .driver = "isa-fdc",\
> > + .property = "check_media_rate",\
> > + .value = "off",\
> > + }
> > +
>
> Hmm. how about
>
> > static QEMUMachine pc_machine_v1_0 = {
> > .name = "pc-1.0",
> > .desc = "Standard PC",
> > .init = pc_init_pci,
> > .max_cpus = 255,
> > .compat_props = (GlobalProperty[]) {
> > - {
> > - .driver = "pc-sysfw",
> > - .property = "rom_only",
> > - .value = stringify(1),
> > - }, {
> > - .driver = "isa-fdc",
> > - .property = "check_media_rate",
> > - .value = "off",
> > - },
> > + PC_COMPAT_1_0,
>
> + .base_machine = &pc_machine_v1_1;
>
It's a lot of work, and the result won't be easier to
modify or debug than it already is, IMO.
> Then it would be easier to define machines differentially.
We add new 1 machine each release, so I'm not worried about
adding them easily, adding properies easily happens
between releases so I want to make is simpler.
> > { /* end of list */ }
> > },
>
> --
> error compiling committee.c: too many arguments to function