[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 25/30] usb-bot: drop not needed "allow_hotplug =
From: |
Igor Mammedov |
Subject: |
Re: [Qemu-devel] [PATCH 25/30] usb-bot: drop not needed "allow_hotplug = 0" |
Date: |
Wed, 24 Sep 2014 17:15:04 +0200 |
On Wed, 24 Sep 2014 14:27:07 +0200
Paolo Bonzini <address@hidden> wrote:
> Il 24/09/2014 13:48, Igor Mammedov ha scritto:
> > usb-bot creates SCSI bus and immediately makes it
> > non hotpluggable which makes not possible to add
> > anything to it after machine is created.
> >
> > Taking in account that ubs-bot doesn't implement
> > HOTPLUG_HANDLER interface, SCSI will be created as
> > non hotpluggable, so there is not need to reset
> > allow_hotplug field anymore.
> >
> > Signed-off-by: Igor Mammedov <address@hidden>
> > ---
> > hw/usb/dev-storage.c | 1 -
> > 1 file changed, 1 deletion(-)
> >
> > diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
> > index bd7cc53..bfa71c7 100644
> > --- a/hw/usb/dev-storage.c
> > +++ b/hw/usb/dev-storage.c
> > @@ -653,7 +653,6 @@ static void usb_msd_realize_bot(USBDevice *dev, Error
> > **errp)
> > usb_desc_init(dev);
> > scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(dev),
> > &usb_msd_scsi_info_bot, NULL);
> > - s->bus.qbus.allow_hotplug = 0;
> > usb_msd_handle_reset(dev);
> > }
> >
> >
>
> I guess the fate of this patch depends on the answer to the previous
> questions.
>
> The usb-bot hotplug handler should return an error on both plug and
> unplug. You will decide whether to do it explicitly, or in
> hw/core/hotplug.c with NULL callbacks in usb-bot.
BUS is not hotpluggable since usb-bot doesn't implement HotplugHandler inteface,
therefor DeviceClass.realize will error out before reaching
hotplug handler callback
device_set_realized()
if (dev->hotplugged && !dc->hotpluggable) {
error_set(errp, QERR_DEVICE_NO_HOTPLUG, object_get_typename(obj));
return;
}
But there is room for improvement here,
it it's possible to error out even earlier if usb-bot would be marked
as not hotpluggable device and add to qdev_device_add() check if
device is hotpluggable even before it's created.
>
> Paolo
[Qemu-devel] [PATCH 26/30] usb-storage: make its storage SCSI bus hotpluggable explicitly, Igor Mammedov, 2014/09/24