[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC][PATCH 0/21] QEMU Object Model
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [RFC][PATCH 0/21] QEMU Object Model |
Date: |
Thu, 28 Jul 2011 17:47:14 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110707 Thunderbird/5.0 |
On 07/28/2011 05:04 PM, Anthony Liguori wrote:
The only way I can see is to teach each device about this interface and
then have a common bus. That implies that you have:
class GoldfishEnumerator : public Device {
GoldfishDevice *slots[N];
FWIW, there's no hardcoded limit in the interface, and the list of
devices is unordered. But that only means you should attach it with
plug-set goldfish_tty::enumerator goldfish_enum
rather than
plug-set goldfish_enum::slots[12] goldfish_tty
If you can confirm that, that's fine.
};
interface GoldfishDevice {
const char *get_name();
uint64_t get_mmio_base();
...
};
class GoldfishNic : public Device, implements GoldfishDevice
{
const char *get_name(void) {
return "nic";
}
uint64_t mmio_base;
uint64_t get_mmio_base() { return mmio_base; }
uint64_t set_mmio_base(uint64_t addr) { mmio_base = addr; }
};
And that's exactly my point. It's a "stupid" interface full of
getters/setters, which is what you get if you use only interface
inheritance instead of, where appropriate, data containment.
Interfaces should be reserved for what really depends on the
_implementation_ of the GoldfishNic, not for accessing a bunch of
numbers. There is no implementation-dependent detail of that kind in
the GoldfishDevice (unlike other buses, even simple ones like I2C).
The PIC's view is more complicated than a Pin, and more similar to ISA.
ISA is just a pin. The ISA bus extender literally has five pins
corresponding to the ISA IRQs 7, 6, 5, 4, 3.
ISA is many pins. :) Goldfish looks similar (32 pins).
Paolo
- Re: [Qemu-devel] [RFC][PATCH 0/21] QEMU Object Model, (continued)
- Re: [Qemu-devel] [RFC][PATCH 0/21] QEMU Object Model, Anthony Liguori, 2011/07/27
- Re: [Qemu-devel] [RFC][PATCH 0/21] QEMU Object Model, Anthony Liguori, 2011/07/27
- Re: [Qemu-devel] [RFC][PATCH 0/21] QEMU Object Model, Paolo Bonzini, 2011/07/27
- Re: [Qemu-devel] [RFC][PATCH 0/21] QEMU Object Model, Anthony Liguori, 2011/07/27
- Re: [Qemu-devel] [RFC][PATCH 0/21] QEMU Object Model, Paolo Bonzini, 2011/07/28
- Re: [Qemu-devel] [RFC][PATCH 0/21] QEMU Object Model, Anthony Liguori, 2011/07/28
- Re: [Qemu-devel] [RFC][PATCH 0/21] QEMU Object Model, Paolo Bonzini, 2011/07/28
- Re: [Qemu-devel] [RFC][PATCH 0/21] QEMU Object Model, Anthony Liguori, 2011/07/28
- Re: [Qemu-devel] [RFC][PATCH 0/21] QEMU Object Model, Paolo Bonzini, 2011/07/28
- Re: [Qemu-devel] [RFC][PATCH 0/21] QEMU Object Model, Anthony Liguori, 2011/07/28
- Re: [Qemu-devel] [RFC][PATCH 0/21] QEMU Object Model,
Paolo Bonzini <=
- Re: [Qemu-devel] [RFC][PATCH 0/21] QEMU Object Model, Anthony Liguori, 2011/07/28
- Re: [Qemu-devel] [RFC][PATCH 0/21] QEMU Object Model, Paolo Bonzini, 2011/07/29
- Re: [Qemu-devel] [RFC][PATCH 0/21] QEMU Object Model, Peter Maydell, 2011/07/27
- Re: [Qemu-devel] [RFC][PATCH 0/21] QEMU Object Model, Anthony Liguori, 2011/07/27