From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:47512) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Te55h-0008Kq-Ho for qemu-devel@nongnu.org; Thu, 29 Nov 2012 09:27:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Te55b-0004GT-Cw for qemu-devel@nongnu.org; Thu, 29 Nov 2012 09:27:49 -0500 Received: from greensocs.com ([87.106.252.221]:56801 helo=s15328186.onlinehome-server.info) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Te55b-0004FC-5Q for qemu-devel@nongnu.org; Thu, 29 Nov 2012 09:27:43 -0500 Message-ID: <50B770F8.4000702@greensocs.com> Date: Thu, 29 Nov 2012 15:28:08 +0100 From: Konrad Frederic 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> <50B7693E.2000902@suse.de> In-Reply-To: <50B7693E.2000902@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed 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: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= 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 On 29/11/2012 14:55, Andreas F=C3=A4rber wrote: > 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 >>> 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_BU= S >>> then we should permit plugging in even if the actual bus object happe= ns >>> 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 = we >> 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 i= s not > a virtio-bus. Yes, ok I got it! Thanks, Fred