[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v19 12/14] pcie_sriov: Register VFs after migration
From: |
Akihiko Odaki |
Subject: |
[PATCH v19 12/14] pcie_sriov: Register VFs after migration |
Date: |
Thu, 09 Jan 2025 15:29:57 +0900 |
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>
---
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 5148c5b77dd1..c5d2d318d330 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 c02562e6063f..f7445aebadbb 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -803,10 +803,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 69609c112e31..1eb4358256de 100644
--- a/hw/pci/pcie_sriov.c
+++ b/hw/pci/pcie_sriov.c
@@ -248,6 +248,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)
--
2.47.1
- [PATCH v19 04/14] s390x/pci: Avoid creating zpci for VFs, (continued)
- [PATCH v19 04/14] s390x/pci: Avoid creating zpci for VFs, Akihiko Odaki, 2025/01/09
- [PATCH v19 05/14] s390x/pci: Allow plugging SR-IOV devices, Akihiko Odaki, 2025/01/09
- [PATCH v19 07/14] pcie_sriov: Do not manually unrealize, Akihiko Odaki, 2025/01/09
- [PATCH v19 06/14] s390x/pci: Check for multifunction after device realization, Akihiko Odaki, 2025/01/09
- [PATCH v19 09/14] pcie_sriov: Reuse SR-IOV VF device instances, Akihiko Odaki, 2025/01/09
- [PATCH v19 08/14] pcie_sriov: Ensure VF addr does not overflow, Akihiko Odaki, 2025/01/09
- [PATCH v19 10/14] pcie_sriov: Release VFs failed to realize, Akihiko Odaki, 2025/01/09
- [PATCH v19 11/14] pcie_sriov: Remove num_vfs from PCIESriovPF, Akihiko Odaki, 2025/01/09
- [PATCH v19 13/14] hw/pci: Use -1 as the default value for rombar, Akihiko Odaki, 2025/01/09
- [PATCH v19 12/14] pcie_sriov: Register VFs after migration,
Akihiko Odaki <=
- [PATCH v19 14/14] hw/qdev: Remove opts member, Akihiko Odaki, 2025/01/09
- Re: [PATCH v19 00/14] hw/pci: SR-IOV related fixes and improvements, Philippe Mathieu-Daudé, 2025/01/09