From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:40523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWwaL-0008Vk-CW for qemu-devel@nongnu.org; Wed, 15 Jun 2011 16:21:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QWwaJ-00054z-OE for qemu-devel@nongnu.org; Wed, 15 Jun 2011 16:21:09 -0400 Received: from mail-qw0-f45.google.com ([209.85.216.45]:53883) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWwaJ-00054k-Dy for qemu-devel@nongnu.org; Wed, 15 Jun 2011 16:21:07 -0400 Received: by qwj8 with SMTP id 8so458132qwj.4 for ; Wed, 15 Jun 2011 13:21:06 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <4DF90F74.7090206@codemonkey.ws> References: <1307532813-27175-1-git-send-email-peter.maydell@linaro.org> <4DEF6B2B.7090305@siemens.com> <4DF0FCDA.5070804@siemens.com> <4DF21334.2070204@us.ibm.com> <4DF23BB7.9050606@us.ibm.com> <4DF4F371.90003@redhat.com> <4DF511B6.5000005@us.ibm.com> <4DF76041.1000007@codemonkey.ws> <4DF90F74.7090206@codemonkey.ws> From: Blue Swirl Date: Wed, 15 Jun 2011 23:20:45 +0300 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH RFC 0/3] basic support for composing sysbus devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Peter Maydell , =?UTF-8?Q?Juha_Riihim=C3=A4ki?= , "patches@linaro.org" , Jan Kiszka , "qemu-devel@nongnu.org" , Markus Armbruster , Avi Kivity , Paul Brook On Wed, Jun 15, 2011 at 11:00 PM, Anthony Liguori w= rote: > On 06/15/2011 01:56 PM, Blue Swirl wrote: >> >> On Tue, Jun 14, 2011 at 4:21 PM, Anthony Liguori >> =C2=A0wrote: >>> >>> Which suggests that we really need to move away from declarative device >>> definitions. =C2=A0It makes it hard to have variable numbers of propert= ies. >> >> I'd suppose the number of slots could be fixed. Then the declaration cou= ld >> be >> =C2=A0 =C2=A0 =C2=A0 DEFINE_PROP_SOCKETS(I440FXState, slot, 32), > > That's fine for something like a PCI controller, but for something like a > multiport network card, it's really desirable to be able to specify the > number of ports as part of the config. =C2=A0IOW: > > =C2=A0-device virtio-net-pci,ports=3D8,netdev[0]=3Dtap0,netdev[1]=3Dtap1,= ... In the PCI cases, I'd use the maximum allowed by PCI. >>> In this case, piix3 would be defined as: >>> >>> struct I440FXState { >>> =C2=A0 =C2=A0PIIX3 piix3; >>> =C2=A0 =C2=A0PCIDevice slots[32]; >>> }; >>> >>> Which suggests we need an initfn to do the following: >>> >>> void i440fx_initfn(...) { >>> =C2=A0 qdev_init_inplace(&dev->piix3, "PIIX3"); >>> =C2=A0 dev->slot[1] =3D&dev->piix3->bus; >>> } >>> >>> This gets hard to do well in C though. =C2=A0I'm not sure how we could = make >>> DEFINE_PROP_PLUG/SOCKET type safe. >> >> DEFINE_PROP_PCI_SOCKET()? > > Yeah, that's why I said, "hard to do well". =C2=A0It makes it very hard t= o add > new socket types. PCI, USB, IDE, SCSI, SBus, what else? APICBus? I2C? 8 socket types ought to be enough for anybody.