From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9xCJ-0003he-7U for qemu-devel@nongnu.org; Thu, 24 Nov 2016 11:48:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c9xCG-00077k-1b for qemu-devel@nongnu.org; Thu, 24 Nov 2016 11:48:31 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:43378 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c9xCF-00076w-Rl for qemu-devel@nongnu.org; Thu, 24 Nov 2016 11:48:27 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uAOGjGfr058416 for ; Thu, 24 Nov 2016 11:48:26 -0500 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 26wynpuf2p-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 24 Nov 2016 11:48:26 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 24 Nov 2016 16:48:25 -0000 Date: Thu, 24 Nov 2016 17:48:20 +0100 From: Cornelia Huck In-Reply-To: <1479777133-23567-7-git-send-email-ehabkost@redhat.com> References: <1479777133-23567-1-git-send-email-ehabkost@redhat.com> <1479777133-23567-7-git-send-email-ehabkost@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20161124174820.015135cb.cornelia.huck@de.ibm.com> Subject: Re: [Qemu-devel] [RFC 06/15] qdev: Add device_type field to BusClass List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: qemu-devel@nongnu.org, Markus Armbruster , Marcel Apfelbaum , "Michael S. Tsirkin" On Mon, 21 Nov 2016 23:12:04 -0200 Eduardo Habkost wrote: > diff --git a/hw/pci/pci.c b/hw/pci/pci.c > index 24fae16..74b8fef 100644 > --- a/hw/pci/pci.c > +++ b/hw/pci/pci.c > @@ -152,6 +152,7 @@ static void pci_bus_class_init(ObjectClass *klass, void *data) > k->realize = pci_bus_realize; > k->unrealize = pci_bus_unrealize; > k->reset = pcibus_reset; > + k->device_type = TYPE_PCI_DEVICE; This covers pci-per-se... > > pbc->is_root = pcibus_is_root; > pbc->bus_num = pcibus_num; > diff --git a/hw/s390x/css-bridge.c b/hw/s390x/css-bridge.c > index 9a7f7ee..8a6c1ae 100644 > --- a/hw/s390x/css-bridge.c > +++ b/hw/s390x/css-bridge.c > @@ -17,6 +17,7 @@ > #include "hw/s390x/css.h" > #include "ccw-device.h" > #include "hw/s390x/css-bridge.h" > +#include "hw/s390x/virtio-ccw.h" > > /* > * Invoke device-specific unplug handler, disable the subchannel > @@ -81,6 +82,7 @@ static void virtual_css_bus_class_init(ObjectClass *klass, void *data) > > k->reset = virtual_css_bus_reset; > k->get_dev_path = virtual_css_bus_get_dev_path; > + k->device_type = TYPE_VIRTIO_CCW_DEVICE; ...this covers virtio-ccw... (notably _not_ generic css) > } > > static const TypeInfo virtual_css_bus_info = { > diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c > index 63f6248..7470fdd 100644 > --- a/hw/s390x/s390-pci-bus.c > +++ b/hw/s390x/s390-pci-bus.c > @@ -783,10 +783,17 @@ static const TypeInfo s390_pcihost_info = { > } > }; > > +static void s390_pcibus_class_init(ObjectClass *oc, void *opaque) > +{ > + BusClass *bc = BUS_CLASS(oc); > + bc->device_type = TYPE_S390_PCI_DEVICE; ...this covers zpci, which is needed _in addition to_ normal pci to make pci work on s390... > +} > + > static const TypeInfo s390_pcibus_info = { > .name = TYPE_S390_PCI_BUS, > .parent = TYPE_BUS, > .instance_size = sizeof(S390PCIBus), > + .class_init = s390_pcibus_class_init, > }; > > static uint16_t s390_pci_generate_uid(void) > diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c > index d6c0c72..815f3dd 100644 > --- a/hw/virtio/virtio-bus.c > +++ b/hw/virtio/virtio-bus.c > @@ -293,6 +293,7 @@ static void virtio_bus_class_init(ObjectClass *klass, void *data) > BusClass *bus_class = BUS_CLASS(klass); > bus_class->get_dev_path = virtio_bus_get_dev_path; > bus_class->get_fw_dev_path = virtio_bus_get_fw_dev_path; > + bus_class->device_type = TYPE_VIRTIO_DEVICE; > } > > static const TypeInfo virtio_bus_info = { ...and this covers virtio, which is kind of a glue bus. So on s390, we have the following: - to get virtio-ccw, we need virtio-ccw _and_ virtio - to get virtio-pci, we need pci _and_ zpci _and_ virtio - to get virtio-per-se, we need one of the combinations above Please stop me if I'm babbling, but there seem to be some interdependencies which are different on different architectures and I'm not sure how these should be modelled.