[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC v2 06/20] qdev: Add 'accepted-device-types' proper
From: |
Eduardo Habkost |
Subject: |
Re: [Qemu-devel] [RFC v2 06/20] qdev: Add 'accepted-device-types' property to BusClass |
Date: |
Tue, 29 Nov 2016 12:18:19 -0200 |
User-agent: |
Mutt/1.7.1 (2016-10-04) |
On Tue, Nov 29, 2016 at 02:57:07PM +0100, Cornelia Huck wrote:
> On Fri, 25 Nov 2016 20:05:42 -0200
> Eduardo Habkost <address@hidden> wrote:
>
> > Each bus class will now be aware of the specific device types
> > that can be plugged on it. That will be useful for:
> >
> > * Runtime check for which devices types can be plugged to the
> > machine;
> > * Validation of query-machines output by automated tests.
> >
> > By default, a single type name is used on all bus instances (set
> > at BusClass::device_type), but bus instances can override it and
> > return a different type list.
> >
> > Signed-off-by: Eduardo Habkost <address@hidden>
>
> I've read (well, more skimmed through) the whole patchset and I think
> we have different cases of "multiple device types for one bus":
>
> - the q35 root bus case later in this patchset, where just a certain
> instance of the bus can accept multiple types
> - the case where every instance of a bus may accept multiple types
> (none currently; but this will be the case for e.g. virtual-css once we
> have other derivates of CCW_DEVICE than virtio-ccw)
Are all going to be subclasses of TYPE_CCW_DEVICE, and are all
TYPE_CCW_DEVICE subclasses going to be accepted by virtual-css?
In this case, you could just set BusClass::device_type to
TYPE_CCW_DEVICE on virtual-css-bus.
>
> For the second case, a static initializer for multiple types in the
> class makes sense;
If necessary, we can change BusClass::device_type to a
BusClass::device_types list. I didn't do that because it didn't
seem necessary (and I would like to encourage buses to encode
compatiblity using a single type/interface name whenever
possible).
> but the first case is a bit hackish. Should there be
> a generic way to pass a list of types to the individual bus instance's
> initializers (that could fall back to a static list in the class)?
Sound good, but I don't know how that generic mechanism could
look like. Would a:
void bus_add_accepted_device_type(BusState *bus, const char *devtype)
function be enough?
--
Eduardo
- [Qemu-devel] [RFC v2 00/20] qmp: Report bus information on 'query-machines', Eduardo Habkost, 2016/11/25
- [Qemu-devel] [RFC v2 01/20] qemu.py: Make logging optional, Eduardo Habkost, 2016/11/25
- [Qemu-devel] [RFC v2 02/20] qtest.py: Support QTEST_LOG environment variable, Eduardo Habkost, 2016/11/25
- [Qemu-devel] [RFC v2 03/20] qtest.py: make logging optional, Eduardo Habkost, 2016/11/25
- [Qemu-devel] [RFC v2 04/20] qtest.py: Make 'binary' parameter optional, Eduardo Habkost, 2016/11/25
- [Qemu-devel] [RFC v2 05/20] tests: Add rules to non-gtester qtest test cases, Eduardo Habkost, 2016/11/25
- [Qemu-devel] [RFC v2 06/20] qdev: Add 'accepted-device-types' property to BusClass, Eduardo Habkost, 2016/11/25
- [Qemu-devel] [RFC v2 08/20] virtio-pci: Set PCIDeviceClass::is_express=1, Eduardo Habkost, 2016/11/25
- [Qemu-devel] [RFC v2 07/20] qmp: Add 'always-available-buses' field to 'query-machines', Eduardo Habkost, 2016/11/25
- [Qemu-devel] [RFC v2 09/20] vmxnet3: Set PCIDeviceClass::is_express=1, Eduardo Habkost, 2016/11/25
- [Qemu-devel] [RFC v2 10/20] pvscsi: Set PCIDeviceClass::is_express=1, Eduardo Habkost, 2016/11/25
- [Qemu-devel] [RFC v2 11/20] pci: INTERFACE_LEGACY_PCI_DEVICE and INTERFACE_PCIE_DEVICE interfaces, Eduardo Habkost, 2016/11/25
- [Qemu-devel] [RFC v2 13/20] [trivial] edu: Move edu_info outside function, Eduardo Habkost, 2016/11/25
- [Qemu-devel] [RFC v2 12/20] pci: Replace is_express with INTERFACE_PCIE_DEVICE, Eduardo Habkost, 2016/11/25
- [Qemu-devel] [RFC v2 15/20] eepro100: Add INTERFACE_LEGACY_PCI_DEVICE, Eduardo Habkost, 2016/11/25
- [Qemu-devel] [RFC v2 16/20] [incomplete] remove INTERFACE_LEGACY_PCI_DEVICE from PCIe-only devices, Eduardo Habkost, 2016/11/25
- [Qemu-devel] [RFC v2 17/20] pci: Set device_type on bus classes, Eduardo Habkost, 2016/11/25