From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51794) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Te4as-0002H7-0J for qemu-devel@nongnu.org; Thu, 29 Nov 2012 08:56:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Te4aq-00013O-53 for qemu-devel@nongnu.org; Thu, 29 Nov 2012 08:55:57 -0500 Received: from cantor2.suse.de ([195.135.220.15]:48314 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Te4ap-0000se-S6 for qemu-devel@nongnu.org; Thu, 29 Nov 2012 08:55:56 -0500 Message-ID: <50B7693E.2000902@suse.de> Date: Thu, 29 Nov 2012 14:55:10 +0100 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1353595852-30776-1-git-send-email-fred.konrad@greensocs.com> <1353595852-30776-2-git-send-email-fred.konrad@greensocs.com> <87k3t8qvrg.fsf@codemonkey.ws> <877gp8pafv.fsf@codemonkey.ws> <50B75716.6030308@greensocs.com> <50B76758.70301@greensocs.com> In-Reply-To: <50B76758.70301@greensocs.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC PATCH v2 1/3] virtio-bus : Introduce VirtioBus. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Konrad Frederic Cc: Peter Maydell , Anthony Liguori , e.voevodin@samsung.com, mark.burton@greensocs.com, qemu-devel@nongnu.org, stefanha@redhat.com, cornelia.huck@de.ibm.com Am 29.11.2012 14:47, schrieb Konrad Frederic: > On 29/11/2012 14:09, Peter Maydell wrote: >> On 29 November 2012 12:37, Konrad Frederic=20 >> wrote: >>> On 26/11/2012 17:59, Anthony Liguori wrote: >>>> virtio-pci-bus extends virtio-bus >>>> - is constructed with a pointer to a PCIDevice >>>> - implements the methods necessary to be a virtio bus >>> I still have trouble with that ^^. >>> The problem is that the virtio devices can't be connected to the >>> virtio-pci-bus even if it extends virtio-bus because TYPE_VIRTIO_BUS = !=3D >>> TYPE_VIRTIO_PCI_BUS. >> Conceptually it ought to work I think: if the bus is-a TYPE_VIRTIO_BUS >> then we should permit plugging in even if the actual bus object happen= s >> to be an instance of a subclass. > Yes, is my implementation doing the right thing ? > I mean is the virtio-pci-bus a virtio-bus ? In your v3 patchset no. In the inline code yes, via virtio_pci_bus_info's .parent. >> I suspect that qbus_find_recursive should be doing an >> object_class_dynamic_cast() to check that the bus is of a suitable >> type, rather than the >> (strcmp(object_get_typename(OBJECT(bus)), bus_typename) !=3D 0) >> which it does at the moment. > Yes, but we can cast VIRTIO_BUS in BUS no ? > So in this case we could plug VirtioDevice in BUS and that's not what w= e > want ? You would want to check whether object_class_dynamic_cast(OBJECT(bus), TYPE_VIRTIO_BUS) =3D=3D NULL. This should evaluate to true if the bus is = not a virtio-bus. Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg