qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Defaults for qdev properties inherited from bus


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] Defaults for qdev properties inherited from bus
Date: Mon, 07 Sep 2009 13:02:42 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Lightning/1.0pre Thunderbird/3.0b3

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 via email to

[Prev in Thread] Current Thread [Next in Thread]