From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tbu89-00037r-M6 for qemu-devel@nongnu.org; Fri, 23 Nov 2012 09:21:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tbu83-0005hz-SZ for qemu-devel@nongnu.org; Fri, 23 Nov 2012 09:21:21 -0500 Received: from greensocs.com ([87.106.252.221]:60482 helo=s15328186.onlinehome-server.info) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tbu83-0005hv-ME for qemu-devel@nongnu.org; Fri, 23 Nov 2012 09:21:15 -0500 Message-ID: <50AF866A.2000709@greensocs.com> Date: Fri, 23 Nov 2012 15:21:30 +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> <20121123122339.GB29474@stefanha-thinkpad.redhat.com> In-Reply-To: <20121123122339.GB29474@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: Stefan Hajnoczi Cc: peter.maydell@linaro.org, aliguori@us.ibm.com, e.voevodin@samsung.com, mark.burton@greensocs.com, qemu-devel@nongnu.org, cornelia.huck@de.ibm.com, afaerber@suse.de On 23/11/2012 13:23, Stefan Hajnoczi wrote: > On Thu, Nov 22, 2012 at 03:50:50PM +0100, fred.konrad@greensocs.com wrote: >> +/* Bind the VirtIODevice to the VirtioBus. */ >> +void virtio_bus_bind_device(VirtioBus *bus) >> +{ >> + BusState *qbus = BUS(bus); >> + assert(bus != NULL); >> + assert(bus->vdev != NULL); >> + virtio_bind_device(bus->vdev,&(bus->info->virtio_bindings), qbus->parent); >> +} > Should plug and bind be together in a single function? Binding the > device seems like an internal step that the bus takes when you plug the > device. Maybe we can, but we must init the "transport" device before bind the device. > >> +struct VirtioBusInfo { > This is defining an ad-hoc interface. QOM has support for interfaces so > that a virtio-pci adapter brovides a VirtioBindingInterface which > VirtioBus can talk to intead of using VirtioBusInfo. Can you point me to example in the tree to see how this QOM interfaces work ? >> + void (*init_cb)(DeviceState *dev); >> + void (*exit_cb)(DeviceState *dev); > Can _cb be dropped from the name? Structs with function pointers always > provide "callbacks" so the _cb is unnecessary. For example, QOM methods > like BusClass->reset() don't include _cb either. Ok. >> + VirtIOBindings virtio_bindings; >> +}; >> + >> +struct VirtioBus { >> + BusState qbus; >> + bool bus_in_use; > Should bus_in_use basically be bus->vdev != NULL? Yes I can do that. :). Thanks, Fred