[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 7/7] hw/pci: convert PCI bus to use "hotplug-dev
From: |
Igor Mammedov |
Subject: |
Re: [Qemu-devel] [PATCH 7/7] hw/pci: convert PCI bus to use "hotplug-device" interface. |
Date: |
Mon, 9 Dec 2013 14:41:39 +0100 |
On Fri, 06 Dec 2013 18:29:58 +0100
Paolo Bonzini <address@hidden> wrote:
> Il 06/12/2013 18:03, Igor Mammedov ha scritto:
> > + hotplug_dev = DEVICE(object_property_get_link(OBJECT(bus),
> > "hotplug-device",
> > + &local_err));
> > + if (error_is_set(&local_err)) {
> > + goto error_exit;
> > + }
> > + if (hotplug_dev) {
> > + HotplugDeviceClass *hdc = HOTPLUG_DEVICE_GET_CLASS(hotplug_dev);
> > +
> > + /* handler can differentiate between hotplug and when device is
> > + * enabled during qemu machine creation by inspecting
> > + * dev->hotplugged field. */
> > + if (hdc->hotplug) {
> > + hdc->hotplug(hotplug_dev, qdev, &local_err);
> > + if (error_is_set(&local_err)) {
> > + int r = pci_unregister_device(&pci_dev->qdev);
> > + assert(!r);
> > + goto error_exit;
> > + }
> > }
> > }
>
> > +
> > + hotplug_dev = DEVICE(object_property_get_link(OBJECT(bus),
> > "hotplug-device",
> > + &local_err));
> > + if (error_is_set(&local_err)) {
> > + goto error_exit;
> > + }
> > + if (hotplug_dev) {
> > + HotplugDeviceClass *hdc = HOTPLUG_DEVICE_GET_CLASS(hotplug_dev);
> > +
> > + if (hdc->hot_unplug) {
> > + hdc->hot_unplug(hotplug_dev, qdev, &local_err);
> > + if (error_is_set(&local_err)) {
> > + goto error_exit;
> > + }
> > + }
> > + }
>
> Please move the parts under the "if" to hotplug.c (something like
> hotplug_handler_plug and hotplug_handler_unplug). Also, should this be
sure.
> moved up to generic code (e.g. bus_add_child/bus_remove_child)?
Current usage hints that it's more realize() related part. If handler
fails device might want to do same device specific failure handling
before returning from realize() with failure.
It will work in bus_add_child/bus_remove_child as well but it would
basically put handlers to nofail category.
>
> A NULL link can be a no-op for coldplugged devices, an error for
> hotplugged devices, and an assertion failure for hot-unplug.
>
> Paolo
>
- [Qemu-devel] [PATCH 0/7] Refactor PCI/SHPC/PCIE hotplug to use a more generic hotplug API, Igor Mammedov, 2013/12/06
- [Qemu-devel] [PATCH 3/7] hw/acpi: move typeinfo to the file end, Igor Mammedov, 2013/12/06
- [Qemu-devel] [PATCH 4/7] acpi/piix4pm: convert ACPI PCI hotplug to use hotplug-device interface, Igor Mammedov, 2013/12/06
- [Qemu-devel] [PATCH 5/7] pci/shpc: convert SHPC hotplug to use hotplug-device interface, Igor Mammedov, 2013/12/06
- [Qemu-devel] [PATCH 7/7] hw/pci: convert PCI bus to use "hotplug-device" interface., Igor Mammedov, 2013/12/06
- Re: [Qemu-devel] [PATCH 7/7] hw/pci: convert PCI bus to use "hotplug-device" interface., Paolo Bonzini, 2013/12/06
- Re: [Qemu-devel] [PATCH 7/7] hw/pci: convert PCI bus to use "hotplug-device" interface.,
Igor Mammedov <=
- Re: [Qemu-devel] [PATCH 7/7] hw/pci: convert PCI bus to use "hotplug-device" interface., Paolo Bonzini, 2013/12/09
- Re: [Qemu-devel] [PATCH 7/7] hw/pci: convert PCI bus to use "hotplug-device" interface., Igor Mammedov, 2013/12/09
- Re: [Qemu-devel] [PATCH 7/7] hw/pci: convert PCI bus to use "hotplug-device" interface., Paolo Bonzini, 2013/12/09
- Re: [Qemu-devel] [PATCH 7/7] hw/pci: convert PCI bus to use "hotplug-device" interface., Igor Mammedov, 2013/12/09
- Re: [Qemu-devel] [PATCH 7/7] hw/pci: convert PCI bus to use "hotplug-device" interface., Paolo Bonzini, 2013/12/09
- Re: [Qemu-devel] [PATCH 7/7] hw/pci: convert PCI bus to use "hotplug-device" interface., Igor Mammedov, 2013/12/09
- Re: [Qemu-devel] [PATCH 7/7] hw/pci: convert PCI bus to use "hotplug-device" interface., Paolo Bonzini, 2013/12/09
- Re: [Qemu-devel] [PATCH 7/7] hw/pci: convert PCI bus to use "hotplug-device" interface., Igor Mammedov, 2013/12/09
- Re: [Qemu-devel] [PATCH 7/7] hw/pci: convert PCI bus to use "hotplug-device" interface., Paolo Bonzini, 2013/12/09
Re: [Qemu-devel] [PATCH 7/7] hw/pci: convert PCI bus to use "hotplug-device" interface., Marcel Apfelbaum, 2013/12/09