1 Commits

Author SHA1 Message Date
Chen Qun
54d6c83994 hw/pci/pcie: Move hot plug capability check to pre_plug callback
RH-Author: Julia Suvorova <jusual@redhat.com>
Message-id: <20200616122536.1027685-1-jusual@redhat.com>
Patchwork-id: 97548
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 1/1] hw/pci/pcie: Move hot plug capability check to pre_plug callback
Bugzilla: 1820531
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1820531
BRANCH: rhel-av-8.2.1
UPSTREAM: merged
BREW: 29422092

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>
(cherry picked from commit 0dabc0f6544f2c0310546f6d6cf3b68979580a9c)
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2021-07-22 21:28:33 +08:00