]> git.proxmox.com Git - mirror_qemu.git/commit
hw/pci/pcie: Move hot plug capability check to pre_plug callback
authorJulia Suvorova <jusual@redhat.com>
Thu, 4 Jun 2020 12:59:46 +0000 (14:59 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 9 Jun 2020 18:18:04 +0000 (14:18 -0400)
commit0dabc0f6544f2c0310546f6d6cf3b68979580a9c
tree1e0d7c3c2e3325e4a10d1b519aae62ef7829fbbd
parentb963ea19f896e34e21275ff69fa4565948f703c8
hw/pci/pcie: Move hot plug capability check to pre_plug callback

Check for hot plug capability earlier to avoid removing devices attached
during the initialization process.

Run qemu with an unattached drive:
  -drive file=$FILE,if=none,id=drive0 \
  -device pcie-root-port,id=rp0,slot=3,bus=pcie.0,hotplug=off
Hotplug a block device:
  device_add virtio-blk-pci,id=blk0,drive=drive0,bus=rp0
If hotplug fails on plug_cb, drive0 will be deleted.

Fixes: 0501e1aa1d32a6 ("hw/pci/pcie: Forbid hot-plug if it's disabled on the slot")
Acked-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Julia Suvorova <jusual@redhat.com>
Message-Id: <20200604125947.881210-1-jusual@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/pci/pcie.c