From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54921) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWljq-0006RC-3u for qemu-devel@nongnu.org; Wed, 24 Sep 2014 08:32:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XWlji-0001CU-OA for qemu-devel@nongnu.org; Wed, 24 Sep 2014 08:32:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52675) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWlji-00014a-FE for qemu-devel@nongnu.org; Wed, 24 Sep 2014 08:31:58 -0400 Message-ID: <5422B7BD.9010109@redhat.com> Date: Wed, 24 Sep 2014 14:23:25 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1411559299-19042-1-git-send-email-imammedo@redhat.com> <1411559299-19042-16-git-send-email-imammedo@redhat.com> In-Reply-To: <1411559299-19042-16-git-send-email-imammedo@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 15/30] virtio-pci: replace BusState.allow_hotplug with hotplug_handler List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov , qemu-devel@nongnu.org Cc: dmitry@daynix.com, borntraeger@de.ibm.com, mst@redhat.com, agraf@suse.de, cornelia.huck@de.ibm.com, kraxel@redhat.com, amit.shah@redhat.com, rth@twiddle.net Il 24/09/2014 13:48, Igor Mammedov ha scritto: > Although virtio-pci-bus is internal object of composite > virtio-pci device and it doesn't participate in > -device/device_add hotplug flow, it's required by > bus_add_child() that bus must be hotpluggable to > be able to add child at runtime. > Set parent of virtio-pci-bus as NOP hotplug controller, > so that bus_add_child() would allow to add child > device during hotplug time when BusState.allow_hotplug > is dropped. > > Signed-off-by: Igor Mammedov > --- > hw/virtio/virtio-pci.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c > index f560814..0486b25 100644 > --- a/hw/virtio/virtio-pci.c > +++ b/hw/virtio/virtio-pci.c > @@ -1070,6 +1070,10 @@ static const TypeInfo virtio_pci_info = { > .class_init = virtio_pci_class_init, > .class_size = sizeof(VirtioPCIClass), > .abstract = true, > + .interfaces = (InterfaceInfo[]) { > + { TYPE_HOTPLUG_HANDLER }, > + { } > + } > }; > > /* virtio-blk-pci */ > @@ -1543,13 +1547,11 @@ static void virtio_pci_bus_new(VirtioBusState *bus, size_t bus_size, > VirtIOPCIProxy *dev) > { > DeviceState *qdev = DEVICE(dev); > - BusState *qbus; > char virtio_bus_name[] = "virtio-bus"; > > qbus_create_inplace(bus, bus_size, TYPE_VIRTIO_PCI_BUS, qdev, > virtio_bus_name); > - qbus = BUS(bus); > - qbus->allow_hotplug = 1; > + qbus_set_hotplug_handler(BUS(bus), qdev, &error_abort); > } > > static void virtio_pci_bus_class_init(ObjectClass *klass, void *data) > So this is the opposite of icc-bus; here you need to call the simple hot-unplug callback in the hotplug handler, right? Paolo