qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: Anthony PERARD <anthony.perard@citrix.com>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	qemu-devel@nongnu.org, Alexander Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH] pc: reduce duplication in compat machine types
Date: Mon, 26 Mar 2012 15:32:22 +0200	[thread overview]
Message-ID: <20120326133221.GB16511@redhat.com> (raw)
In-Reply-To: <4F70665A.9000809@redhat.com>

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

  reply	other threads:[~2012-03-26 13:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-26  9:40 [Qemu-devel] [PATCH] pc: reduce duplication in compat machine types Michael S. Tsirkin
2012-03-26 12:51 ` Avi Kivity
2012-03-26 13:32   ` Michael S. Tsirkin [this message]
2012-03-26 13:12 ` Andreas Färber
2012-03-26 13:23   ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120326133221.GB16511@redhat.com \
    --to=mst@redhat.com \
    --cc=agraf@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=anthony.perard@citrix.com \
    --cc=avi@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).