diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2019-10-30 06:15:44 +0000 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2019-10-30 06:15:44 +0000 |
| commit | 63df86b26418baac9fe3a6ab09b3b7aa0807f11b (patch) | |
| tree | 7c90f01af096af4a5fe64d701343911df2cd7f3a /hw/pci/pci.c | |
| parent | 16884391c750d0c5e863f55ad7aaaa146fc5181e (diff) | |
| parent | b5f53d04a5a567ac70d33ec95628d35583eba600 (diff) | |
| download | focaccia-qemu-63df86b26418baac9fe3a6ab09b3b7aa0807f11b.tar.gz focaccia-qemu-63df86b26418baac9fe3a6ab09b3b7aa0807f11b.zip | |
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
virtio: features, cleanups virtio net failover rcu cleanup Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Tue 29 Oct 2019 22:58:14 GMT # gpg: using RSA key 281F0DB8D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full] # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" [full] # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * remotes/mst/tags/for_upstream: virtio: Use auto rcu_read macros virtio_net: use RCU_READ_LOCK_GUARD virtio/vhost: Use auto_rcu_read macros vfio: unplug failover primary device before migration net/virtio: add failover support libqos: tolerate wait-unplug migration state migration: add new migration state wait-unplug migration: allow unplug during migration for failover devices qapi: add failover negotiated event qapi: add unplug primary event pci: mark device having guest unplug request pending pci: mark devices partially unplugged pci: add option for net failover qdev/qbus: add hidden device support Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/pci/pci.c')
| -rw-r--r-- | hw/pci/pci.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/hw/pci/pci.c b/hw/pci/pci.c index aa05c2b9b2..c68498c0de 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -75,6 +75,8 @@ static Property pci_props[] = { QEMU_PCIE_LNKSTA_DLLLA_BITNR, true), DEFINE_PROP_BIT("x-pcie-extcap-init", PCIDevice, cap_present, QEMU_PCIE_EXTCAP_INIT_BITNR, true), + DEFINE_PROP_STRING("failover_pair_id", PCIDevice, + failover_pair_id), DEFINE_PROP_END_OF_LIST() }; @@ -2077,6 +2079,7 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp) ObjectClass *klass = OBJECT_CLASS(pc); Error *local_err = NULL; bool is_default_rom; + uint16_t class_id; /* initialize cap_present for pci_is_express() and pci_config_size(), * Note that hybrid PCIs are not set automatically and need to manage @@ -2101,6 +2104,35 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp) } } + if (pci_dev->failover_pair_id) { + if (!pci_bus_is_express(pci_get_bus(pci_dev))) { + error_setg(errp, "failover primary device must be on " + "PCIExpress bus"); + error_propagate(errp, local_err); + pci_qdev_unrealize(DEVICE(pci_dev), NULL); + return; + } + class_id = pci_get_word(pci_dev->config + PCI_CLASS_DEVICE); + if (class_id != PCI_CLASS_NETWORK_ETHERNET) { + error_setg(errp, "failover primary device is not an " + "Ethernet device"); + error_propagate(errp, local_err); + pci_qdev_unrealize(DEVICE(pci_dev), NULL); + return; + } + if (!(pci_dev->cap_present & QEMU_PCI_CAP_MULTIFUNCTION) + && (PCI_FUNC(pci_dev->devfn) == 0)) { + qdev->allow_unplug_during_migration = true; + } else { + error_setg(errp, "failover: primary device must be in its own " + "PCI slot"); + error_propagate(errp, local_err); + pci_qdev_unrealize(DEVICE(pci_dev), NULL); + return; + } + qdev->allow_unplug_during_migration = true; + } + /* rom loading */ is_default_rom = false; if (pci_dev->romfile == NULL && pc->romfile != NULL) { |