qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC] Plan for moving forward with QOM


From: Anthony Liguori
Subject: Re: [Qemu-devel] [RFC] Plan for moving forward with QOM
Date: Wed, 14 Dec 2011 07:53:09 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.21) Gecko/20110831 Lightning/1.0b2 Thunderbird/3.1.13

On 12/13/2011 06:39 PM, Paul Brook wrote:
Composition == "etching to the same piece of silicon".  Nothing more,
nothing less.

That's a really crappy definition.  Most ARM systems are comprised of
approximately one piece of silicon.  There may be dozens of variants of a
particular chip, with the same device models stamped into the silicon
slightly different ways.

IMO it would be much better to split on logical device boundaries.
Especially when the functionality provided (pci to ISA bridge) works
perfectly well without the child device.

What I'm really after is to have a way to do "-device piix3" and get all of
the devices that would normally live on the piix3.  If it's desirable to
split out piix3 into piix3-isa-bridge which is part of piix3 and can be
used independently such that piix3 is just a thin container of
piix3-isa-bridge and everything behind it, that's fine by me.

Yes, that's what I was imagining.

We should do whatever makes sense for the machine/target.  For pc, I've
seen absolutely zero interest in someone creating a pc machine without an
i8042 or an RTC.

For a PC that actually is an interesting config - chipset manufacturers have
been threatening to do it for years, and I believe a good fraction is already
emulated via SMM.

For the PIIX3 specifically I'm not sure how many different variants there are
in terms of number of peripherals, USB ports, etc.  I'm pretty sure there are
several models, but I don't know whether the defferences are purely
electrical/packaging.

Now you could certainly remove the has-a logic and make it so something
had to instantiate a UART separately from the ISASerial device and
connect things up but that's overly complicated IMHO.

Why not ISASerial is-a UART?

That's actually how I implemented MMSerial just to show that it's possible.

I prefer has-a because if you had a real life ISA card with a UART16550A on
it, the ISA card would have an identifiable UART16650A on it.  I think
it's unlikely that you would have a single chip with an ISA-compatible
pin-out that happened to be compatible with a UART16550A.

Hmm, maybe. OTOH it's exactly the sort of corner that might beworth cutting if
you're knocking out ISA serial card clones by the million :-)

I guess because both are stateful, so not allowed
by our inheritance model?

Right, but ISADevice could very easily become an Interface as it has no
state today.

Maybe. I'm not entirely convinced that is viable solution going forward.

Do we have a user interface issue here?

I want to separate backwards compatibility from ABI compatibility. We should provide nice high level interfaces that are forever backwards compatible. But when it comes to hooking up IRQs between devices, that interface should just be ABI compatible, not necessarily backwards compatible.

To achieve ABI compatibility, we just have to be strict about renaming types if they change significantly and introducing new field names instead of changing the semantics of existing fields.

If at some later point we discover
that both bus and device need some state then we'll need to split the device.
I didn't follow the device naming thread in detail, so maybe this has already
been covered.

How is MCFSerial different?  Are we expecting MCFSerial to poke around in
private UART16550 rather than just feeding it cooked data?  If so isn't
it

mode likely to end up as:
Yes, it could go either way really but I would expect that MCFSerial would
override the ioport_read() and ioport_write functions and implement custom
functionality that way.

The fact that serial.c (which really should be called 16550.c) contains ISA
specific IO callback routines feels like ISASerial isn't doing its job
proberly to start with :-)

It's not really ISA specific callbacks but I need to think through interaction with the memory API.

In my qom-next branch, serial.c exposes a serial_ioport_read/serial_ioport_write function. isa-serial.c and mm-serial.c create MemoryRegions based on thin wrappers around that callback.

Ideally, serial.c would export a MemoryRegion directly for the registers it supported and isa-serial.c and mm-serial.c could bridge that to the appropriate address space.

I think the problem here ends up being itl_shift. I think Avi's trying to avoid having a non-flat dispatch space so you can't really create a MemoryRegion that dispatches to another MemoryRegion. We discussed it before and I believe he was planning on adding itl_shift as a MemoryRegion mutator.

Avi, did I understand that all correctly?

I don't see how this can work without a closure object.  We need a
central device that is capable of recieving signals from many client
devices.  Those client devices don't know where they are, they just
shout down a point-point link. I'd say this is a fairly common topology.

If the central device implements that point-point interface directly then
it has no idea which device is talking to it.  We need to create child
objects with a port ID property and implementing the p-p interface, then
bind each client device to one of these child objects.  The child
objects can't do anything useful on their own, so need to proxy the
signal to an interface on the main object, adding in their port id.

If you aren't using inheritance, yes, you need to pass closures to the
child objects.  I dislike that kind of proxy modeling.

How would you solve this using inheritance?

I can see how it works when the device knows its address, but it seems kinda
lame to tell a device "You have a dedicated communication channel.  But I'm
lazy and will smush them all together.  Please add this additional token to
every signal you send".

Yes, adding a token is how you would have to do it.

I wonder how common is it though to have this kind of scenario where the
bus protocol doesn't have any kind of identifier that identifies the
target bus.  I presume in most cases you're thinking about, there's a
single transport that can multiplex communications, no?

Not really.  Either individual transports, or multiplexing that is not visible
to client devices.

After further thought IRQs are the only concrete example I can come up with.
Others tend to have one [logical] host device per bus (various forms of
serial), be host driven (USB, mostly), or deliberately make the link-level
details software transparent (PCIe).

I suspect SMBus (sun4m) may be a candidate, though I could be wrong.

Yeah, I can't think of any real examples either so I'd prefer to avoid thinking too much about it until we run into something that actually requires it :-)

Regards,

Anthony Liguori

Paul





reply via email to

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