qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Defaults for qdev properties inherited from bus
Date: Mon, 07 Sep 2009 13:02:42 +0200	[thread overview]
Message-ID: <4AA4E852.1090500@redhat.com> (raw)
In-Reply-To: <87zl9a623k.fsf@pike.pond.sub.org>

>> The second group has instance-dependent defaults (see ${device}_io
>> arrays in pc.c and elsewhere), i.e. first ne2k_isa at 0x300, second at
>> 0x320, etc.  Property defaults can cover instance #1 only.
>
> The instance-dependent defaults are occasionally convenient, but I'm not
> sure the functionality worth replicating for -device.

For -serial (and maybe -parallel) you probably want to have that because 
there are standard i/o port for serial lines 1 -> 4.  More than one 
serial line isn't that uncommon too, and even in a pci machine these are 
isa devices.

For sb16, ne2k_isa, ... we can probably simply go with default values 
(so -device $name just works for a single card) and expect the user to 
override iobase in case he wants to plug multiple cards into his isapc.

>> We can move the io properties from the bus to the devices which
>> actually need it.  Then this would probably become something like
>> this:
>>
>>        if (ne2k_isa->iobase == -1)
>>            ne2c_isa->iobase = default_base[instance];
>
> Not sure I get what you mean.  If your proposal has the above code in
> the init() callback, then it's not much of an improvement.

Only needed for devices which want to have different default values per 
instance (i.e. serial, see above).  Otherwise property defaults (or no 
iobase property at all) will do just fine.

> The cleanest way to implement defaults is to get the job done in
> qdev_create().  No second-guessing in init() whether the default has
> been overridden by the user.

Sure.  Might be overkill for just one or two use cases though.

cheers,
   Gerd

      reply	other threads:[~2009-09-07 11:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-03 21:49 [Qemu-devel] Defaults for qdev properties inherited from bus Markus Armbruster
2009-09-04  8:14 ` Gerd Hoffmann
2009-09-04 17:39   ` Markus Armbruster
2009-09-07 11:02     ` Gerd Hoffmann [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=4AA4E852.1090500@redhat.com \
    --to=kraxel@redhat.com \
    --cc=armbru@redhat.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).