qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 20/30] s390x: convert virtio-ccw to hotplug hand


From: Cornelia Huck
Subject: Re: [Qemu-devel] [PATCH 20/30] s390x: convert virtio-ccw to hotplug handler API
Date: Thu, 25 Sep 2014 13:08:38 +0200

On Wed, 24 Sep 2014 11:48:09 +0000
Igor Mammedov <address@hidden> wrote:

> Signed-off-by: Igor Mammedov <address@hidden>
> ---
>  hw/s390x/virtio-ccw.c | 24 ++++++++++++++++--------
>  1 file changed, 16 insertions(+), 8 deletions(-)

Well, I think I now see what's going on here. More below...


> @@ -1620,13 +1620,13 @@ static Property virtio_ccw_properties[] = {
>  static void virtio_ccw_device_class_init(ObjectClass *klass, void *data)
>  {
>      DeviceClass *dc = DEVICE_CLASS(klass);
> +    HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
> 
>      dc->props = virtio_ccw_properties;
>      dc->init = virtio_ccw_busdev_init;
>      dc->exit = virtio_ccw_busdev_exit;
> -    dc->unplug = virtio_ccw_busdev_unplug;

Before, this callback was invoked when a device of the virtio-ccw class
was unplugged.

>      dc->bus_type = TYPE_VIRTUAL_CSS_BUS;
> -
> +    hc->unplug = virtio_ccw_busdev_unplug;

Now, this callback is supposed to be invoked instead. However, the
unplugging code invokes the callback for the _parent bus_, which
means...

>  }
> 
>  static const TypeInfo virtio_ccw_device_info = {

>  static void virtual_css_bridge_class_init(ObjectClass *klass, void *data)
>  {
>      SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
> +    HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
> 
>      k->init = virtual_css_bridge_init;
> +    hc->unplug = qdev_simple_device_unplug_cb;

...we're invoking this one, as the parent bus for virtio-ccw devices is
the virtual-css bus.

If I change this callback to the virtio-ccw one, everything works as
expected.

>  }

So, to summarize, what happened before was

bridge device              <--- (simple unplug invoked for dev)
 -> virtual bus
  -> virtio proxy device   <--- virtio unplug invoked for dev
   -> virtio bus
    -> virtio device

which your patch changed to

bridge device
 -> virtual bus            <--- simple unplug invoked for virtio proxy dev
  -> virtio proxy device
   -> virtio bus           <--- (virtio unplug invoked for virtio dev)
    -> virtio device

Am I understanding this correctly?




reply via email to

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