From: Anthony Liguori <anthony@codemonkey.ws>
To: Avi Kivity <avi@redhat.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
QEMU Developers <qemu-devel@nongnu.org>,
Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [Qemu-devel] modelling omap_gpmc with the hierarchical memory API
Date: Tue, 02 Aug 2011 21:33:35 -0500 [thread overview]
Message-ID: <4E38B37F.8010100@codemonkey.ws> (raw)
In-Reply-To: <4E386C44.607@redhat.com>
On 08/02/2011 04:29 PM, Avi Kivity wrote:
> On 08/03/2011 12:06 AM, Anthony Liguori wrote:
>>
>> The qdev level should be the common base that makes sense for *all*
>> qdev devices. IRQ management does not belong in DeviceState because
>> what you do for a simple LCD is not what you do for an MSI-X capable
>> PCI device.
>>
>> This is what QOM properties tries to address. It should be possible to
>> create a simple device, and register plugs/sockets for GPIO pins
>> without pushing GPIO knowledge into the base class.
>>
>> In a QDev world, the right approach is to have a GpioDevice base class
>> that implements this sort of logic for devices where it makes sense.
>> That's what SysBusDevice sort of wants to be but it somehow ended up
>> as yet another base class for everything.
>>
>
> Doesn't this end up requiring multiple inheritance, and a ton of
> boilerplate in addition?
I don't see a ton of boiler plate nor do I see multiple inheritance.
Either you have devices that live on a bus that interact with other
devices via the bus interface or you have devices that interact through
Pin interactions.
But pushing everything into qdev is wrong. This is a classic trap with
object oriented modelling. Inheritance is supposed to model is-a
relationships, not "may-implement in some subclasses". Not only does it
cause unnecessary bloat, it causes brittleness.
What in the world would DeviceState::num_gpio_out mean for a PCI device?
It doesn't make sense at all which means it doesn't belong in DeviceState.
Unless we're modelling the pin inputs and outputs for every device that
we possibly support.. But we're in for a world of hurt if that's what
our goals are. Connecting PCI devices to their busses will be,
interesting, to say the least :-)
Regards,
Anthony Liguori
>
> I'm in favour of throwing everything into qdev so it's easy to use. If a
> device doesn't have gpio, why, 0 is a valid integer.
>
>
next prev parent reply other threads:[~2011-08-03 2:33 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-02 15:47 [Qemu-devel] modelling omap_gpmc with the hierarchical memory API Peter Maydell
2011-08-02 15:58 ` Avi Kivity
2011-08-02 17:21 ` Peter Maydell
2011-08-02 18:05 ` Avi Kivity
2011-08-02 18:21 ` Peter Maydell
2011-08-02 19:11 ` Avi Kivity
2011-08-02 19:38 ` Peter Maydell
2011-08-02 21:00 ` Anthony Liguori
2011-08-02 21:25 ` Avi Kivity
2011-08-02 20:56 ` Anthony Liguori
2011-08-02 21:28 ` Peter Maydell
2011-08-02 21:48 ` Avi Kivity
2011-08-02 22:04 ` Peter Maydell
2011-08-03 2:26 ` Anthony Liguori
2011-08-03 6:50 ` Avi Kivity
2011-08-03 2:25 ` Anthony Liguori
2011-08-03 9:10 ` Peter Maydell
2011-08-03 9:23 ` Avi Kivity
2011-08-02 18:07 ` Jan Kiszka
2011-08-02 19:15 ` Avi Kivity
2011-08-02 21:06 ` Anthony Liguori
2011-08-02 21:29 ` Avi Kivity
2011-08-03 2:33 ` Anthony Liguori [this message]
2011-08-03 6:56 ` Avi Kivity
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=4E38B37F.8010100@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=avi@redhat.com \
--cc=jan.kiszka@siemens.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).