mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
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
5beb8ad503
.
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>.
This commit is contained in:
parent
7f5feab4dd
commit
e927d48722
4 changed files with 32 additions and 12 deletions
10
hw/pci.c
10
hw/pci.c
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue