diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2010-11-12 16:21:35 +0900 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2010-11-16 14:55:23 +0200 |
commit | e927d48722fdcba50f82d653c5a1927752483054 (patch) | |
tree | c342621b76a1c244410b83c41fff0194f0f1c094 /hw/pci.c | |
parent | 7f5feab4dda39b39dce24113313587587aa2d0ab (diff) |
pci: allow hotplug removal of cold-plugged devices
This patch fixes hot unplug of cold plugged devices
(those present at system start), which got broken by
5beb8ad503c88a76f2b8106c3b74b4ce485a60e1 .
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Cam Macdonell <cam@cs.ualberta.ca>
Tested-by: Cam Macdonell <cam@cs.ualberta.ca>
Reported-by: Cam Macdonell <cam@cs.ualberta.ca>.
Diffstat (limited to 'hw/pci.c')
-rw-r--r-- | hw/pci.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -1558,8 +1558,11 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base) pci_add_option_rom(pci_dev); if (bus->hotplug) { - /* lower layer must check qdev->hotplugged */ - rc = bus->hotplug(bus->hotplug_qdev, pci_dev, 1); + /* Let buses differentiate between hotplug and when device is + * enabled during qemu machine creation. */ + rc = bus->hotplug(bus->hotplug_qdev, pci_dev, + qdev->hotplugged ? PCI_HOTPLUG_ENABLED: + PCI_COLDPLUG_ENABLED); if (rc != 0) { int r = pci_unregister_device(&pci_dev->qdev); assert(!r); @@ -1573,7 +1576,8 @@ static int pci_unplug_device(DeviceState *qdev) { PCIDevice *dev = DO_UPCAST(PCIDevice, qdev, qdev); - return dev->bus->hotplug(dev->bus->hotplug_qdev, dev, 0); + return dev->bus->hotplug(dev->bus->hotplug_qdev, dev, + PCI_HOTPLUG_DISABLED); } void pci_qdev_register(PCIDeviceInfo *info) |