diff options
author | Akihiko Odaki <akihiko.odaki@daynix.com> | 2025-01-16 18:01:02 +0900 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2025-02-20 18:23:19 -0500 |
commit | f9efcd47110de43dd841ada5bd1a40ec169eabca (patch) | |
tree | c48b294b30ccdd1baca705d11951c18b115cded4 | |
parent | 5e7dd17e43486f41d4f88dbefd7219f0524f424c (diff) | |
download | qemu-f9efcd47110de43dd841ada5bd1a40ec169eabca.zip qemu-f9efcd47110de43dd841ada5bd1a40ec169eabca.tar.gz qemu-f9efcd47110de43dd841ada5bd1a40ec169eabca.tar.bz2 |
pcie_sriov: Register VFs after migration
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: <20250116-reuse-v20-11-7cb370606368@daynix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r-- | hw/pci/pci.c | 7 | ||||
-rw-r--r-- | hw/pci/pcie_sriov.c | 7 | ||||
-rw-r--r-- | include/hw/pci/pcie_sriov.h | 2 |
3 files changed, 16 insertions, 0 deletions
diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 3e29b30..69a1b8c 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 69609c1..1eb4358 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) diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h index 5148c5b..c5d2d31 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); |