qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH v2 1/3] virtio-bus : Introduce VirtioBus.


From: Konrad Frederic
Subject: Re: [Qemu-devel] [RFC PATCH v2 1/3] virtio-bus : Introduce VirtioBus.
Date: Fri, 23 Nov 2012 15:21:30 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.5) Gecko/20120623 Thunderbird/10.0.5

On 23/11/2012 13:23, Stefan Hajnoczi wrote:
On Thu, Nov 22, 2012 at 03:50:50PM +0100, address@hidden 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]