All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Andreas Färber" <afaerber@suse.de>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	qemu-devel@nongnu.org, Alexander Graf <agraf@suse.de>,
	Avi Kivity <avi@redhat.com>,
	Anthony PERARD <anthony.perard@citrix.com>
Subject: Re: [Qemu-devel] [PATCH] pc: reduce duplication in compat machine types
Date: Mon, 26 Mar 2012 15:23:50 +0200	[thread overview]
Message-ID: <20120326132349.GA16511@redhat.com> (raw)
In-Reply-To: <4F706B45.5000303@suse.de>

On Mon, Mar 26, 2012 at 03:12:37PM +0200, Andreas Färber 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.
> > 
> > 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.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> > 
> > 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

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.

> > 
> >  hw/pc_piix.c |  288 +++++++++++++++-------------------------------------------
> >  1 files changed, 73 insertions(+), 215 deletions(-)
> > 
> > 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 = {
> >      .is_default = 1,
> >  };
> >  
> > +#define PC_COMPAT_1_0 \
> > +        {\
> > +            .driver   = "pc-sysfw",\
> > +            .property = "rom_only",\
> > +            .value    = stringify(1),\
> > +        }, {\
> > +            .driver   = "isa-fdc",\
> > +            .property = "check_media_rate",\
> > +            .value    = "off",\
> > +        }
> > +
> >  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,
> >          { /* end of list */ }
> >      },
> >  };
> [snip]
> 
> -- 
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

      reply	other threads:[~2012-03-26 13:23 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
2012-03-26 13:12 ` Andreas Färber
2012-03-26 13:23   ` Michael S. Tsirkin [this message]

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=20120326132349.GA16511@redhat.com \
    --to=mst@redhat.com \
    --cc=afaerber@suse.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.