[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 87/88] pcie_sriov: Register VFs after migration
From: |
Michael S. Tsirkin |
Subject: |
[PULL v2 87/88] pcie_sriov: Register VFs after migration |
Date: |
Tue, 2 Jul 2024 16:20:59 -0400 |
From: Akihiko Odaki <akihiko.odaki@daynix.com>
pcie_sriov doesn't have code to restore its state after migration, but
igb, which uses pcie_sriov, naively claimed its migration capability.
Add code to register VFs after migration and fix igb migration.
Fixes: 3a977deebe6b ("Intrdocue igb device emulation")
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20240627-reuse-v10-9-7ca0b8ed3d9f@daynix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/pci/pcie_sriov.h | 2 ++
hw/pci/pci.c | 7 +++++++
hw/pci/pcie_sriov.c | 7 +++++++
3 files changed, 16 insertions(+)
diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h
index 5148c5b77d..c5d2d318d3 100644
--- a/include/hw/pci/pcie_sriov.h
+++ b/include/hw/pci/pcie_sriov.h
@@ -57,6 +57,8 @@ void pcie_sriov_pf_add_sup_pgsize(PCIDevice *dev, uint16_t
opt_sup_pgsize);
void pcie_sriov_config_write(PCIDevice *dev, uint32_t address,
uint32_t val, int len);
+void pcie_sriov_pf_post_load(PCIDevice *dev);
+
/* Reset SR/IOV */
void pcie_sriov_pf_reset(PCIDevice *dev);
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index e32a69f3fa..fa85f87b1c 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -733,10 +733,17 @@ static bool migrate_is_not_pcie(void *opaque, int
version_id)
return !pci_is_express((PCIDevice *)opaque);
}
+static int pci_post_load(void *opaque, int version_id)
+{
+ pcie_sriov_pf_post_load(opaque);
+ return 0;
+}
+
const VMStateDescription vmstate_pci_device = {
.name = "PCIDevice",
.version_id = 2,
.minimum_version_id = 1,
+ .post_load = pci_post_load,
.fields = (const VMStateField[]) {
VMSTATE_INT32_POSITIVE_LE(version_id, PCIDevice),
VMSTATE_BUFFER_UNSAFE_INFO_TEST(config, PCIDevice,
diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c
index fae6acea4a..56523ab4e8 100644
--- a/hw/pci/pcie_sriov.c
+++ b/hw/pci/pcie_sriov.c
@@ -252,6 +252,13 @@ void pcie_sriov_config_write(PCIDevice *dev, uint32_t
address,
}
}
+void pcie_sriov_pf_post_load(PCIDevice *dev)
+{
+ if (dev->exp.sriov_cap) {
+ register_vfs(dev);
+ }
+}
+
/* Reset SR/IOV */
void pcie_sriov_pf_reset(PCIDevice *dev)
--
MST
- [PULL v2 76/88] hw/cxl/events: Mark cxl-add-dynamic-capacity and cxl-release-dynamic-capcity unstable, (continued)
- [PULL v2 76/88] hw/cxl/events: Mark cxl-add-dynamic-capacity and cxl-release-dynamic-capcity unstable, Michael S. Tsirkin, 2024/07/02
- [PULL v2 77/88] virtio: remove virtio_tswap16s() call in vring_packed_event_read(), Michael S. Tsirkin, 2024/07/02
- [PULL v2 75/88] hw/cxl/events: Improve QMP interfaces and documentation for add/release dynamic capacity., Michael S. Tsirkin, 2024/07/02
- [PULL v2 78/88] virtio-iommu: Clear IOMMUDevice when VFIO device is unplugged, Michael S. Tsirkin, 2024/07/02
- [PULL v2 80/88] hw/ppc/spapr_pci: Do not create DT for disabled PCI device, Michael S. Tsirkin, 2024/07/02
- [PULL v2 79/88] hw/pci: Rename has_power to enabled, Michael S. Tsirkin, 2024/07/02
- [PULL v2 85/88] pcie_sriov: Release VFs failed to realize, Michael S. Tsirkin, 2024/07/02
- [PULL v2 82/88] pcie_sriov: Do not manually unrealize, Michael S. Tsirkin, 2024/07/02
- [PULL v2 83/88] pcie_sriov: Ensure VF function number does not overflow, Michael S. Tsirkin, 2024/07/02
- [PULL v2 84/88] pcie_sriov: Reuse SR-IOV VF device instances, Michael S. Tsirkin, 2024/07/02
- [PULL v2 87/88] pcie_sriov: Register VFs after migration,
Michael S. Tsirkin <=
- [PULL v2 81/88] hw/ppc/spapr_pci: Do not reject VFs created after a PF, Michael S. Tsirkin, 2024/07/02
- [PULL v2 86/88] pcie_sriov: Remove num_vfs from PCIESriovPF, Michael S. Tsirkin, 2024/07/02
- [PULL v2 88/88] hw/pci: Replace -1 with UINT32_MAX for romsize, Michael S. Tsirkin, 2024/07/02
- Re: [PULL v2 00/88] virtio: features,fixes, Richard Henderson, 2024/07/03
- Re: [PULL v2 00/88] virtio: features,fixes, Michael S. Tsirkin, 2024/07/03
- Re: [PULL v2 00/88] virtio: features,fixes, Richard Henderson, 2024/07/03
- Re: [PULL v2 00/88] virtio: features,fixes, Thomas Huth, 2024/07/03
- Re: [PULL v2 00/88] virtio: features,fixes, Michael S. Tsirkin, 2024/07/03
- Re: [PULL v2 00/88] virtio: features,fixes, Michael S. Tsirkin, 2024/07/03
- Re: [PULL v2 00/88] virtio: features,fixes, Thomas Huth, 2024/07/04