From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41764) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Te4YU-0000fj-8b for qemu-devel@nongnu.org; Thu, 29 Nov 2012 08:53:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Te4YO-000067-DK for qemu-devel@nongnu.org; Thu, 29 Nov 2012 08:53:30 -0500 Received: from mail-ie0-f173.google.com ([209.85.223.173]:64286) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Te4YO-000061-8h for qemu-devel@nongnu.org; Thu, 29 Nov 2012 08:53:24 -0500 Received: by mail-ie0-f173.google.com with SMTP id e13so11354933iej.4 for ; Thu, 29 Nov 2012 05:53:23 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <50B76758.70301@greensocs.com> 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> Date: Thu, 29 Nov 2012 13:53:22 +0000 Message-ID: From: Peter Maydell Content-Type: text/plain; charset=UTF-8 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: Anthony Liguori , e.voevodin@samsung.com, mark.burton@greensocs.com, qemu-devel@nongnu.org, stefanha@redhat.com, cornelia.huck@de.ibm.com, afaerber@suse.de On 29 November 2012 13:47, Konrad Frederic wrote: > On 29/11/2012 14:09, Peter Maydell wrote: >> 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) != 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 ? I don't understand what you're asking. qbus_find_recursive() looks for a bus which might be specified either by name or by bus type. At the moment it insists on an exact type match (so if you ask for a virtio-bus you have to provide a virtio-bus object, not a subclass of virtio-bus); it should do a dynamic cast, so anything which is a virtio-bus or a subclass of that will do. Yes, if you say "please find me any bus which is a bus of any kind" then you'll get something wrong back -- so don't do that. In particular, since VirtioDevice sets its bus_type to TYPE_VIRTIO_BUS then we will ask for that, and anything which isn't a virtio bus (or subclass) won't be found. -- PMM