qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Avi Kivity <avi@redhat.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Juha Riihimäki" <juha.riihimaki@nokia.com>,
	"patches@linaro.org" <patches@linaro.org>,
	"Jan Kiszka" <jan.kiszka@siemens.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Paul Brook" <paul@codesourcery.com>
Subject: Re: [Qemu-devel] [PATCH RFC 0/3] basic support for composing sysbus devices
Date: Sun, 12 Jun 2011 14:21:26 -0500	[thread overview]
Message-ID: <4DF511B6.5000005@us.ibm.com> (raw)
In-Reply-To: <4DF4F371.90003@redhat.com>

On 06/12/2011 12:12 PM, Avi Kivity wrote:
> On 06/10/2011 06:43 PM, Anthony Liguori wrote:
>>
>>> What exactly is so very wrong about buses that they need to die?
>>
>> They force a device tree. The device model shouldn't be a tree, but a
>> directed graph.
>
> Right. As an example, you configure PCI interrupt routing and the memory
> controller by writing to a PCI device, which logically doesn't have
> access to any of this stuff if it's behind the PCI bus.
>
> However, I don't think buses should die. They should be available as an
> easy way to model the devices that do follow the rules. But we should
> also expose everything else for the exceptional cases.
>
>> It's perfectly fine to have a type called PCIBus that I440FX extends,
>> but qdev shouldn't have explicit knowledge of something called a "bus"
>> IMHO. Doing this forces a limited mechanism of connecting devices
>> because it creates an artificial tree (by implying a parent/child
>> relationship). It makes composition difficult if not impossible.
>
> I think qdev buses are useful as long as they don't enforce their
> interfaces. That is, a qdev that is a child of a qbus has access to the
> qbus's interfaces, but also access to other stuff.

I see two independent data structures.  The first is the "instantiation 
tree".

The instantiation tree may look like this:

+-- i440fx
|  |
|  +-- PIIX3
|  |  |
|  |  +-- mc146818a
|  |  +-- uart
|  |  +-- DMA
|  |  +-- keyboard controller
|  |  +-- (remaining platform ISA devices
|  |
|  +-- UHCI USB controller
|  +-- IDE controller
|
+-- e1000
+-- cirrus-vga
+-- virtio-balloon-pci
+-- IDE disk0

Instantiating i440fx makes a bunch of default stuff.  This is 
composition.  Everything else requires explicit instantiation.  This is, 
strictly speaking, the parent/child relationships.  If you destroy 
i440fx, all of it's children have to also go away (by definition). 
Nothing about bus relationship is implied here.  Even if i440fx exposes 
a PCI bus, the PIIX3 is a child of i440fx even though e1000 is not (even 
if they're both PCI devices).

That said, there absolutely should be the following paths:

/i440fx/IDE controller/primary/master -> IDE disk0
/i440fx/slot3 -> cirrus-vga

The expression of bus should just be a bidirectional path (when that 
makes sense).  IOW:

/i440fx/slot3 -> cirrus-vga
/cirrus-vga/bus -> i440fx

There, of course, can be all sorts of crazy paths through the graph. 
The following should be valid:

/i440fx/slot2 -> IDE controller
/cirrus-vga/bus/slot2/primary/master

But separating out hw paths from instantiation tree has some nice 
characteristics.  The instantiation tree is the obvious place to 
implement live migration whereas reset would probably walk device paths.

Regards,

Anthony Liguori

  reply	other threads:[~2011-06-12 19:21 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-08 11:33 [Qemu-devel] [PATCH RFC 0/3] basic support for composing sysbus devices Peter Maydell
2011-06-08 11:33 ` [Qemu-devel] [PATCH RFC 1/3] sysbus: Add support for resizing and unmapping MMIOs Peter Maydell
2011-06-08 11:33 ` [Qemu-devel] [PATCH RFC 2/3] sysbus: Allow sysbus MMIO passthrough Peter Maydell
2011-06-08 11:33 ` [Qemu-devel] [PATCH RFC 3/3] sysbus: Allow passthrough of single IRQ Peter Maydell
2011-06-08 12:29 ` [Qemu-devel] [PATCH RFC 0/3] basic support for composing sysbus devices Jan Kiszka
2011-06-09 16:40   ` Markus Armbruster
2011-06-09 17:03     ` Jan Kiszka
2011-06-10  8:13       ` Markus Armbruster
2011-06-10 12:51         ` Anthony Liguori
2011-06-10 13:10           ` Peter Maydell
2011-06-10 13:43             ` Jan Kiszka
2011-06-10 13:50               ` Peter Maydell
2011-06-10 14:22                 ` Markus Armbruster
2011-06-10 14:45                   ` Anthony Liguori
2011-06-10 14:34                 ` Anthony Liguori
2011-06-10 14:12               ` Anthony Liguori
2011-06-10 14:18                 ` Jan Kiszka
2011-06-10 14:31                   ` Anthony Liguori
2011-06-10 14:07             ` Anthony Liguori
2011-06-10 14:59           ` Markus Armbruster
2011-06-10 15:43             ` Anthony Liguori
2011-06-12 17:12               ` Avi Kivity
2011-06-12 19:21                 ` Anthony Liguori [this message]
2011-06-13  8:05                   ` Avi Kivity
2011-06-13 17:53                     ` Anthony Liguori
2011-06-13 20:59                   ` Blue Swirl
2011-06-14 13:21                     ` Anthony Liguori
2011-06-15 18:56                       ` Blue Swirl
2011-06-15 20:00                         ` Anthony Liguori
2011-06-15 20:20                           ` Blue Swirl
2011-06-20 15:23                             ` Paul Brook
2011-06-20 21:32                               ` Blue Swirl
2011-06-21  8:16                                 ` Avi Kivity
2011-06-27  2:26                                 ` Paul Brook
2011-06-13  9:57             ` Gleb Natapov
2011-06-10 16:28           ` Andreas Färber

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=4DF511B6.5000005@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=armbru@redhat.com \
    --cc=avi@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=juha.riihimaki@nokia.com \
    --cc=patches@linaro.org \
    --cc=paul@codesourcery.com \
    --cc=peter.maydell@linaro.org \
    --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).