Received: from eggs.gnu.org ([140.186.70.92]:46691) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QV3BH-0007yp-QJ for qemu-devel@nongnu.org; Fri, 10 Jun 2011 10:59:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QV3BF-0005qZ-Nu for qemu-devel@nongnu.org; Fri, 10 Jun 2011 10:59:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29062) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QV3BF-0005qP-7I for qemu-devel@nongnu.org; Fri, 10 Jun 2011 10:59:25 -0400 From: Markus Armbruster References: <1307532813-27175-1-git-send-email-peter.maydell@linaro.org> <4DEF6B2B.7090305@siemens.com> <4DF0FCDA.5070804@siemens.com> <4DF21334.2070204@us.ibm.com> Date: Fri, 10 Jun 2011 16:59:08 +0200 In-Reply-To: <4DF21334.2070204@us.ibm.com> (Anthony Liguori's message of "Fri, 10 Jun 2011 07:51:00 -0500") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 , Juha =?utf-8?Q?Riihim=C3=A4?= =?utf-8?Q?ki?= , "patches@linaro.org" , Jan Kiszka , "qemu-devel@nongnu.org" , Paul Brook Anthony Liguori writes: > On 06/10/2011 03:13 AM, Markus Armbruster wrote: >> Jan Kiszka writes: >>> Resource management, e.g. IRQs. That will be useful for other types of >>> buses as well. >> >> A device should be able to say "I need to be connected to an IRQ line". >> Feels generic to me. > > More specifically, a device has input IRQs. A device has no idea what > number the IRQ is tied to. > > Devices may also have output IRQs. At the qdev layer, we should be > able to connect an arbitrary output IRQ to an arbitrary input IRQ. > > So the crux of the problem is that: > > -device isa-serial,id=serial,irq=3 > > Is very wrong. It ought to look something more like > > -device piix3,id=piix3 -device isa-serial,id=serial,irq=piix3.irq[3] As Jan pointed out, ISA is a counter-example: your "very wrong" claim is actually wrong there :) An ISA device is always connected to all the ISA bus's interrupt lines. Device configuration determines how the device uses these lines. The old (non-MSI) PCI interrupts are similar, I think. Of course, "ISA IRQ 4" can be anything, depending on how the device providing the ISA bus is wired up. > IRQ forwarding becomes very easy in this model because your composite > qdev device has a set of input IRQs and then routes the input IRQs to > the appropriate input IRQs of the sub devices. > > The trouble is that I don't think we have a reasonable way to refer to > properties of other devices and we don't have names for all devices. > I think if we fix the later problem, the former problem becomes > easier. We already connect devices to other resources, such as block, char and network host parts. The way we do it may not be "pure", but it works: we define the plug as property, and connect it to its socket by saying PROP-NAME=SOCK-NAME. Note that the connection is made by core qdev; device model code is oblivious of it. It just uses it. [...] >> I doubt all resources are as generic as IRQ lines, but that's okay. > > They pretty much are. We're really just talking about referring to > subcomponents of a device. That's what's lacking today. > >> Device component composition is not (yet?) covered by qdev. Of course >> we compose anyway, in various ad hoc ways. > > Busses need to die. Well, I wish I was as certain as you about about what is very wrong, what needs to die, and what needs to be done instead. > They can be replaced by having fixed "slots". > For instance, if you had a way of having a PCIDevice * property, the > I440FX could have 32 PCIDevice * properties. That's how you would add > to a bus (and notice that it conveniently solves bus addressing in a > robust fashion). Assumes that bus addresses are isomorphic to [0..N], doesn't it? Not really the case for USB: we use a string of the form %d(.%d)* there. Not my idea. A bus is just a standardized container for slots. A single device can provide multiple buses. Killing buses just unwraps the slots. You lose the grouping. What exactly is so very wrong about buses that they need to die? Honest, non-rhetorical question.