igb: Add experimental VF live migration support
v3 cover igb: Add experimental VF live migration support
Hello,
Live migration of VFIO-passthrough devices, SR-IOV VFs, vGPUs, is a growing requirement, but real hardware with migration support is scarce and hard to debug. An emulated device provides a fully controlled testbed for developing and validating the entire software stack, vfio-pci variant drivers, VFIO core migration v2 framework, QEMU, libvirt, and for tuning complex migration policies such as downtime convergence. It also serves as an educational reference for understanding VFIO migration end-to-end, from device state serialization to dirty page tracking.
This series adds an experimental VF live migration interface to the emulated igb (82576) device. It enables a vfio-pci variant driver (igb-vfio-pci) to migrate VFs using the standard VFIO migration v2 protocol with stop-copy and pre-copy support.
The target scenario is nested virtualization:
L0 QEMU (these patches)
igb PF with x-vf-migration=on
└── VFs with migration DVSEC
L1 kernel
igb-vfio-pci variant driver [1]
translates VFIO migration v2 ioctls → DVSEC config writes
L1 QEMU (stock, unmodified)
vfio-pci device model, standard migration fd
L2 guest
standard igbvf driver, unaware of migration
The L1 QEMU is completely unmodified. It sees a standard VFIO migratable device and uses the normal migration fd path.
* Design
The migration interface is exposed through a DVSEC (Designated Vendor-Specific Extended Capability, PCIe cap id 0x23) at offset 0x160 in VF extended config space. The DVSEC uses a command doorbell model; all commands are synchronous via PCI config space writes.
Device state is serialized as a versioned blob of per-VF register (offset, value) pairs covering control, interrupt, RX/TX queue, receive address (RA/RA2), etc. plus TX context descriptors and VFRE/VFTE enable bits. The buffer address is a guest physical address (GPA) written by the driver via virt_to_phys; the device accesses guest RAM directly through the system address space.
Dirty page tracking is implemented with per-range bitmaps maintained in IGBCore. All VF DMA paths in igb_core.c (TX data, RX data, descriptor writeback) are instrumented to record touched pages. The variant driver registers tracked IOVA ranges and queries dirty bitmaps through a shared buffer. Buffer structures include len, flags, and reserved fields for future extensibility.
* Caveats
The x-vf-migration property is experimental (x- prefix, default off).
The current implementation maintains dirty bitmaps inside the device, which is not realistic for discrete NICs without on-chip DRAM.
On load, MTA/UTA fixup merges missing source entries into the destination but is not durable: the L1 PF driver zeroes and reprograms these tables on any multicast update, and has no record of the migrated VF's hashes. A proper fix requires QEMU to track per-VF multicast hashes and restore them on load, either through a new DVSEC command consumed by the variant driver or by injecting a VF mailbox message to the L1 PF driver.
* Testing
The target scenario is nested virtualization: L0 runs QEMU with an igb PF (x-vf-migration=on), L1 runs the igb-vfio-pci variant driver and an unmodified QEMU, and L2 runs a standard igbvf driver.
Migration under iperf3 load works correctly: dirty page tracking converges (from ~2000 pages per PRE_COPY iteration down to ~280 at STOP_COPY), and STOP_COPY stays under 250ms.
* Todo
1. Add VMState support for L0 migration (dirty bitmaps, tracking engines, DVSEC registers, stats)
2. Add PRE_COPY state transfer to validate device INIT data (magic, version, etc.)
* Ideas
1. RX bandwidth throttle (x-mig-rx-limit, uint32, default 0)
Return false from can_receive when the per-VF packet count in the current tracking interval exceeds the limit. Reduces DMA writes and dirty pages realistically.
2. Migration phase timing (GET_STATS extension)
Add per-VF timestamps: precopy_start_ns, stopcopy_start_ns, precopy_duration_ns, stopcopy_duration_ns, state_transition_count. Expose via GET_STATS.
3. Hot page simulation (x-mig-hot-pages, uint32, default 0)
Re-set the first N bitmap bits after each DIRTY_QUERY, simulating workloads with hot pages that prevent convergence.
4. Error injection (x-mig-inject-error, uint32, default 0)
One-shot error code injection before command dispatch. A separate x-mig-inject-dma-fail (bool) for persistent DMA failure testing.
* Credits
Alex Williamson suggested the overall approach of a variant driver with the "x-vf-migration" device property to gate the feature. Thanks for the ever ongoing support and valuable discussions throughout these years.
* AI disclaimer
The lack of a migration-capable device has been a recurring pain point for VFIO development over the years, and we hope this proposal demonstrates the value of having one.
Claude was used to analyze the IGB PF and VF internal state and identify the pain points of a working live migration of such devices. The generated code served as a starting point but *significant* time was then spent cleaning up, reworking, and shaping it into a clear, reviewable IGB model extension.
Thanks,
C.
[1] https://github.com/legoater/vfio-pci-extras
* Changes since rfc-v2
- DVSEC vendor ID: PCI_VENDOR_ID_INTEL -> PCI_VENDOR_ID_REDHAT_QUMRANET
- Added migration blocker when VF migration is enabled
- Changed Initial VF state: RUNNING -> ERROR (driver must activate via SET_STATE)
- Dropped igbvf_mig_state_reset(), handled by driver
- Extended and renumbered error codes
- Split monolithic VF state serialization into :
. registers: dynamic register list, validated on load
. TX context descriptors
. RA entries: pool-bit-aware, clear/restore, dry-run validation . VLVF filters: pool-bit-aware clear/restore, dry-run validation,
VFTA bit set on load
. MTA/UTA hash tables: save and fixup on load (merge missing
entries into destination with warning)
- Save and restore effective VF interrupt masks (capture from PF aggregates EIMS/EIAC/EIAM, not PVT shadows)
- Re-raise pending VF interrupt causes on unquiesce
- Dropped VF number relocation support
- LOAD: data size from CTRL arg field, validated before buffer read
- Clear VFLRE before state restore on destination
- Added trace events
- Added igb VF migration tests (DVSEC discovery, state machine, save/load roundtrip, blob validation, error codes, dirty tracking)
* Changes since rfc-v1
- Migration BAR replaced with DVSEC at offset 0x160 (no BAR needed)
- Wire-format structs (IgbMigBlob, IgbMigRegPair, IgbMigTxCtx) replace raw pointer arithmetic and memcpy
- RA entries separated from fixed regs, scanned by pool bit
- VFN relocation support (offset remapping + RA pool bit swap)
- GPA buffer (address_space_read/write) replaces PCI DMA through PF
- State blob validation on load (magic, version, error codes)
- NEED_WORDS macro and igb_vf_offset_valid removed
- Error codes renumbered: removed BAD_VFN, added UNK_CMD (1-11)
Reported by Akihiko Odaki:
- propagate_irqs: clear VF bits before OR (EIMS/EIAC/EIAM)
- propagate_ivar: clear IVAR entry when source VTIVAR is invalid
- rearm_irqs: restore actual PVTEICR causes, not all three
- Dirty bitmap allocation uses BITS_TO_LONGS (heap corruption fix)
- Dirty query validates range before g_malloc0 (memory exhaustion)
- Dirty bits cleared only after successful bitmap DMA write
- Dirty query buffer uses struct offsets (layout mismatch fix)
- Load path: register offsets validated against VF whitelist
- VMBMEM (mailbox payload) documented as transient, not serialized
- dma_writes counter: consistently uint64_t
- Dirty range_size: consistently uint64_t (was truncated to 32 bits)
- ERROR->STOP: quiesce VF (clear VFRE/VFTE) on transition
- rearm_irqs: runs on re || te, not just re (TX-only VF fix)
- Stats DMA-written atomically via GET_STATS (no split MMIO tear)
- Bisectability: DVSEC + state machine introduced together
- Removed NAPI reference and "===" comment decoration
Cédric Le Goater (17):
igb: Add x-vf-migration property and DVSEC extended capability
igb: Add migration blocker when VF migration is enabled
igb: Add migration state machine via extended config space
igb: Add VF state serialization for live migration
igb: Add VF register state serialization
igb: Add VF post-load fixups for live migration
igb: Add VF TX context state serialization
igb: Add VF RA entries state serialization
igb: Add VF VLAN filters (VLVF) serialization
igb: Save MTA/UTA hash tables and fixup on VF migration load
igb: Add dirty page tracking for IGBVF migration
igb: Quiesce VFs on STOP and include PF enable state in migration
igb: Save and restore effective VF interrupt masks for migration
igb: Re-raise pending VF interrupt causes on unquiesce
igb: Add dirty page tracking statistics
docs: Add igb VF migration testing setup guide tests/qtest: Add igb VF migration tests
MAINTAINERS | 7 + docs/system/device-emulation.rst | 1 + docs/system/devices/igb-migration.rst | 410 +++++++ docs/system/devices/igb.rst | 6 + hw/net/igb_common.h | 17 + hw/net/igb_core.h | 10 + hw/net/igb_migration.h | 193 +++ hw/net/igb.c | 7 + hw/net/igb_core.c | 93 +- hw/net/igb_migration.c | 1602 +++++++++++++++++++++++++ hw/net/igbvf.c | 56 +- tests/qtest/igb-migration-test.c | 921 ++++++++++++++ hw/net/meson.build | 2 +- hw/net/trace-events | 16 + tests/qtest/meson.build | 1 + 15 files changed, 3318 insertions(+), 24 deletions(-) create mode 100644 docs/system/devices/igb-migration.rst create mode 100644 hw/net/igb_migration.h create mode 100644 hw/net/igb_migration.c create mode 100644 tests/qtest/igb-migration-test.c
Signature · 1 line
2.56.0
RFC PATCH v3 1/17 igb: Add x-vf-migration property and DVSEC extended capability
Add an "x-vf-migration" property to the IGB PF device and expose a DVSEC (Designated Vendor-Specific Extended Capability) at offset 0x160 in VF extended config space when migration is enabled.
The DVSEC provides the register interface for VF live migration:
- CAPS: supported features (state migration) - CTRL: command doorbell - STATUS: state and error reporting - BUF_ADDR: shared DMA buffer address (GPA)
Move IgbVfState from igbvf.c to igb_common.h so it can be shared with the migration module, and add the migration state field.
The DVSEC vendor ID field identifies who defined the DVSEC layout, not the device vendor. Use PCI_VENDOR_ID_REDHAT_QUMRANET (0x1AF4), the same vendor ID used by virtio devices, to attribute the DVSEC format and QEMU-defined migration protocol interface to QEMU/Red Hat, not Intel.
AI-used-for: code (prototype)
--- MAINTAINERS | 5 +++ hw/net/igb_common.h | 16 ++++++++ hw/net/igb_migration.h | 71 ++++++++++++++++++++++++++++++++++ hw/net/igb.c | 2 + hw/net/igb_migration.c | 86 ++++++++++++++++++++++++++++++++++++++++++ hw/net/igbvf.c | 47 ++++++++++++++++++----- hw/net/meson.build | 2 +- 7 files changed, 219 insertions(+), 10 deletions(-) create mode 100644 hw/net/igb_migration.h create mode 100644 hw/net/igb_migration.c
MAINTAINERS +5 -0
@@ -2822,6 +2822,11 @@ F: tests/functional/x86_64/test_netdev_ethtool.py F: tests/qtest/igb-test.c F: tests/qtest/libqos/igb.c +igb VF migration +M: Cédric Le Goater <[email protected]> +S: Maintained +F: hw/net/igb_migration.* + eepro100 M: Stefan Weil <[email protected]> S: Maintained
hw/net/igb_common.h +16 -0
@@ -26,7 +26,9 @@#ifndef HW_NET_IGB_COMMON_H #define HW_NET_IGB_COMMON_H +#include "hw/pci/pci_device.h" #include "igb_regs.h" +#include "igb_migration.h" #define TYPE_IGBVF "igbvf"
@@ -154,4 +156,18 @@ uint64_t igb_mmio_read(void *opaque, hwaddr addr, unsigned size);void igb_mmio_write (void *opaque,hwaddr addr,uint64_t val,unsigned size);void igb_vf_reset (void *opaque,uint16_t vfn); +OBJECT_DECLARE_SIMPLE_TYPE(IgbVfState, IGBVF) + +struct IgbVfState { +PCIDevice parent_obj; + +uint16_t vfn; +bool migration_enabled; + +MemoryRegion mmio; +MemoryRegion msix; + +IgbVfMigState mig; +}; +#endif
hw/net/igb_migration.h new file +71 -0
71 lines not on this page · raw message
hw/net/igb.c +2 -0
@@ -79,6 +79,7 @@ struct IGBState {IGBCore core;bool has_flr; +bool vf_migration; };#define IGB_CAP_SRIOV_OFFSET (0x160)
@@ -597,6 +598,7 @@ static const VMStateDescription igb_vmstate = {static const Property igb_properties[] = {DEFINE_NIC_PROPERTIES (IGBState, conf),DEFINE_PROP_BOOL ("x-pcie-flr-init" , IGBState, has_flr, true), +DEFINE_PROP_BOOL ("x-vf-migration" , IGBState, vf_migration, false), };static void igb_class_init (ObjectClass *class,const void *data)
hw/net/igb_migration.c new file +86 -0
86 lines not on this page · raw message
hw/net/igbvf.c +38 -9
87 lines not on this page · raw message
hw/net/meson.build +1 -1
@@ -11,7 +11,7 @@ system_ss.add(when: 'CONFIG_E1000_PCI', if_true: files('e1000.c', 'e1000x_common system_ss.add(when: 'CONFIG_E1000E_PCI_EXPRESS', if_true: files('net_tx_pkt.c', 'net_rx_pkt.c')) system_ss.add(when: 'CONFIG_E1000E_PCI_EXPRESS', if_true: files('e1000e.c', 'e1000e_core.c', 'e1000x_common.c')) system_ss.add(when: 'CONFIG_IGB_PCI_EXPRESS', if_true: files('net_tx_pkt.c', 'net_rx_pkt.c')) -system_ss.add(when: 'CONFIG_IGB_PCI_EXPRESS', if_true: files('igb.c', 'igbvf.c', 'igb_core.c')) +system_ss.add(when: 'CONFIG_IGB_PCI_EXPRESS', if_true: files('igb.c', 'igbvf.c', 'igb_core.c', 'igb_migration.c')) system_ss.add(when: 'CONFIG_RTL8139_PCI', if_true: files('rtl8139.c')) system_ss.add(when: 'CONFIG_TULIP', if_true: files('tulip.c')) system_ss.add(when: 'CONFIG_VMXNET3_PCI', if_true: files('net_tx_pkt.c', 'net_rx_pkt.c'))
Signature · 1 line
2.56.0
RFC PATCH v3 2/17 igb: Add migration blocker when VF migration is enabled
In reply to Cédric Le GoaterWhen x-vf-migration=on, the VF exposes a DVSEC-based migration interface to the L1 guest. If the L0 hypervisor were to migrate the QEMU instance itself, the in-flight VF migration state would be silently lost or corrupted.
Register a migration blocker during realize so that any L0 migration attempt is rejected with a clear error message.
--- hw/net/igb_common.h | 1 + hw/net/igbvf.c | 9 +++++++++ 2 files changed, 10 insertions(+)
hw/net/igb_common.h +1 -0
@@ -163,6 +163,7 @@ struct IgbVfState {uint16_t vfn;bool migration_enabled; +Error *migration_blocker;MemoryRegion mmio;MemoryRegion msix;
hw/net/igbvf.c +9 -0
@@ -50,6 +50,7 @@#include "igb_common.h" #include "igb_core.h" #include "igb_migration.h" +#include "migration/blocker.h" #include "trace.h" #include "qapi/error.h"
@@ -309,6 +310,13 @@ static void igbvf_pci_realize(PCIDevice *dev, Error **errp)if (!igbvf_add_migration_dvsec (s, errp)) {return ; } + +error_setg (&s->migration_blocker, +"igbvf: VF migration via DVSEC is enabled (x-vf-migration);" +" L0 migration is not supported" ); +if (migrate_add_blocker (&s->migration_blocker, errp) <0 ) { +return ; + } } }
@@ -323,6 +331,7 @@ static void igbvf_pci_uninit(PCIDevice *dev) {IgbVfState *s =IGBVF (dev); +migrate_del_blocker (&s->migration_blocker);pcie_aer_exit (dev);pcie_cap_exit (dev);msix_unuse_all_vectors (dev);
Signature · 1 line
2.56.0
RFC PATCH v3 3/17 igb: Add migration state machine via extended config space
In reply to Cédric Le GoaterImplement the VFIO migration v2 state machine and command dispatch through the CTRL doorbell register in the DVSEC capability.
Add three CTRL commands:
- SET_STATE: transitions follow the VFIO migration protocol
RUNNING <-> STOP
STOP <-> STOP_COPY
STOP <-> RESUMING
ERROR -> STOP - SAVE: DMA-writes the device state to a guest buffer
- LOAD: DMA-reads it back
Add a DATA_SIZE register to report the state blob size. The save/load stubs are filled in by the next patch.
AI-used-for: code (prototype)
--- hw/net/igb_migration.h | 25 ++++- hw/net/igb_migration.c | 237 ++++++++++++++++++++++++++++++++++++++++- hw/net/trace-events | 8 ++ 3 files changed, 268 insertions(+), 2 deletions(-)
hw/net/igb_migration.h +24 -1
@@ -26,10 +26,11 @@* +0x14 STATUS (RO: state[7:0], error_code[15:8]) * +0x18 BUF_ADDR_LO (RW: shared buffer GPA low) * +0x1C BUF_ADDR_HI (RW: shared buffer GPA high) +* +0x20 DATA_SIZE (RO: state blob size in bytes) */ #define IGB_MIG_DVSEC_OFFSET 0x160 -#define IGB_MIG_DVSEC_SIZE 0x20 +#define IGB_MIG_DVSEC_SIZE 0x24#define IGB_MIG_DVSEC_VER 1#define IGB_MIG_DVSEC_ID 1
@@ -39,10 +40,20 @@#define IGB_MIG_STATUS 0x14#define IGB_MIG_BUF_ADDR_LO 0x18#define IGB_MIG_BUF_ADDR_HI 0x1C +#define IGB_MIG_DATA_SIZE 0x20/* CAPS register layout */ #define IGB_MIG_CAP_F_STATE (1u << 0) +/* CTRL register: command in [7:0] */ +#define IGB_MIG_CTRL_CMD_MASK 0xFF +#define IGB_MIG_CTRL_ARG_SHIFT 8 + +/* CTRL commands */ +#define IGB_MIG_CMD_SET_STATE 1 +#define IGB_MIG_CMD_SAVE 2 +#define IGB_MIG_CMD_LOAD 3 +/* STATUS register: state in [7:0], error code [15:8] */ #define IGB_MIG_STATUS_STATE_MASK 0xFF#define IGB_MIG_STATUS_ERROR_CODE_SHIFT 8
@@ -56,8 +67,20 @@#define IGB_MIG_STATE_STOP_COPY 3#define IGB_MIG_STATE_RESUMING 4 +/* Error codes */ +#define IGB_MIG_ERR_UNK_CMD 1 +#define IGB_MIG_ERR_BAD_STATE 2 +#define IGB_MIG_ERR_NO_BUFFER 3 +#define IGB_MIG_ERR_DMA_FAILED 4 +#define IGB_MIG_ERR_BAD_SIZE 5 + +/* Shared buffer constants */ +#define IGB_VF_STATE_MAX_SIZE 4096 +typedef struct IgbVfMigState {uint32_t mig_state; +uint32_t mig_data[IGB_VF_STATE_MAX_SIZE /sizeof (uint32_t )]; +uint32_t mig_data_size;uint64_t mig_data_buf_addr; }IgbVfMigState ;
hw/net/igb_migration.c +236 -1
265 lines not on this page · raw message
hw/net/trace-events +8 -0
@@ -295,6 +295,14 @@ igb_wrn_rx_desc_modes_not_supp(int desc_type) "Not supported descriptor type: %d # igbvf.c igbvf_wrn_io_addr_unknown(uint64_t addr) "IO unknown register 0x%"PRIx64 +# igb_migration.c +igbvf_mig_cmd(uint16_t vfn, uint32_t cmd, uint32_t arg, uint32_t state) "VF%u: cmd %u arg %u (mig_state=%u)" +igbvf_mig_status(uint16_t vfn, uint32_t status) "VF%u: status 0x%x" +igbvf_mig_set_state(uint16_t vfn, uint32_t old_state, uint32_t new_state) "VF%u: state %u -> %u" +igbvf_mig_save_state(uint16_t vfn, uint32_t size) "VF%u: saved %u bytes of device state" +igbvf_mig_load_state(uint16_t vfn, uint32_t size) "VF%u: loaded %u bytes of device state" +igbvf_mig_reset(uint16_t vfn) "VF%u: migration state reset" + # spapr_llan.c spapr_vlan_get_rx_bd_from_pool_found(int pool, int32_t count, uint32_t rx_bufs) "pool=%d count=%"PRId32" rxbufs=%"PRIu32 spapr_vlan_get_rx_bd_from_page(int buf_ptr, uint64_t bd) "use_buf_ptr=%d bd=0x%016"PRIx64
Signature · 1 line
2.56.0
RFC PATCH v3 4/17 igb: Add VF state serialization for live migration
In reply to Cédric Le GoaterAdd the migration blob format and the SAVE/LOAD command plumbing. Define IgbMigBlob with a header (magic, version, VF number) and add error codes for blob validation (BAD_MAGIC, BAD_VERSION, BAD_VFN, BAD_DATA).
On save, fill the header and report the blob size via DATA_SIZE. On load, validate the header fields before touching any device state. Subsequent patches extend the blob with register, TX context, RA, and VLVF substates.
AI-used-for: code (prototype)
--- hw/net/igb_migration.h | 4 +++ hw/net/igb_migration.c | 55 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 57 insertions(+), 2 deletions(-)
hw/net/igb_migration.h +4 -0
@@ -73,6 +73,10 @@#define IGB_MIG_ERR_NO_BUFFER 3#define IGB_MIG_ERR_DMA_FAILED 4#define IGB_MIG_ERR_BAD_SIZE 5 +#define IGB_MIG_ERR_BAD_MAGIC 6 +#define IGB_MIG_ERR_BAD_VERSION 7 +#define IGB_MIG_ERR_BAD_VFN 8 +#define IGB_MIG_ERR_BAD_DATA 9/* Shared buffer constants */ #define IGB_VF_STATE_MAX_SIZE 4096
hw/net/igb_migration.c +53 -2
73 lines not on this page · raw message
Signature · 1 line
2.56.0
RFC PATCH v3 5/17 igb: Add VF register state serialization
In reply to Cédric Le GoaterAdd save/load support for the per-VF register slice: control, interrupt (PVT), statistics, mailbox control, per-VF config (VMOLR/VMVIR/PSRTYPE), interrupt routing (VTIVAR), throttle registers (EITR), and the two RX/TX queue register sets.
The register list is built dynamically by igb_vf_reg_list() so the load path can validate that the blob contains exactly the expected offsets, rejecting corrupted or version-mismatched blobs before any state is modified.
Expose igb_pf_get_core() so the migration code in igbvf can reach the PF's IGBCore.
AI-used-for: analysis, code (prototype)
--- hw/net/igb_core.h | 2 + hw/net/igb.c | 5 ++ hw/net/igb_migration.c | 170 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 176 insertions(+), 1 deletion(-)
hw/net/igb_core.h +2 -0
@@ -143,4 +143,6 @@ igb_receive_iov(IGBCore *core, const struct iovec *iov, int iovcnt);void igb_start_recv (IGBCore *core); +IGBCore *igb_pf_get_core (void *pf); +#endif
hw/net/igb.c +5 -0
@@ -133,6 +133,11 @@ void igb_vf_reset(void *opaque, uint16_t vfn)igb_core_vf_reset (&s->core, vfn); } +IGBCore *igb_pf_get_core (void *pf) +{ +return &IGB (pf)->core; +} +static bool igb_io_get_reg_index (IGBState *s,uint32_t *idx) {
hw/net/igb_migration.c +169 -1
223 lines not on this page · raw message
Signature · 1 line
2.56.0
RFC PATCH v3 6/17 igb: Add VF post-load fixups for live migration
In reply to Cédric Le GoaterAfter restoring per-VF register state, propagate the VTIVAR interrupt vector routing to the shared IVAR0 register, which controls the actual hardware interrupt routing for VF queues.
igb_core_vf_propagate_ivar() clears the IVAR0 entry before writing, unlike igb_set_vtivar() which only OR-s. The existing write handler could be refactored to use this helper in a follow-up.
AI-used-for: analysis, code (prototype)
--- hw/net/igb_core.h | 2 ++ hw/net/igb_core.c | 37 +++++++++++++++++++++++++++++++++++++ hw/net/igb_migration.c | 3 +++ 3 files changed, 42 insertions(+)
hw/net/igb_core.h +2 -0
@@ -145,4 +145,6 @@ igb_start_recv(IGBCore *core);IGBCore *igb_pf_get_core (void *pf); +void igb_core_vf_propagate_ivar (IGBCore *core,uint16_t vfn); +#endif
hw/net/igb_core.c +37 -0
@@ -4552,3 +4552,40 @@ igb_core_post_load(IGBCore *core)return 0 ; } + +/* +* Propagate VTIVAR to IVAR0, which controls the actual hardware +* interrupt routing for VF queues. +*/ +void igb_core_vf_propagate_ivar (IGBCore *core,uint16_t vfn) +{ +uint32_t vtivar = core->mac[VTIVAR + vfn]; +int n; +uint8_t ent; +uint32_t mask; + + n =igb_ivar_entry_rx (vfn); + mask =0xffU << (8 * (n %4 )); +if (vtivar &E1000_IVAR_VALID ) { + ent =E1000_IVAR_VALID | + (24 - vfn *IGBVF_MSIX_VEC_NUM - (2 - (vtivar &0x7 ))); + core->mac[IVAR0 + n /4 ] = + (core->mac[IVAR0 + n /4 ] & ~mask) | + ((uint32_t )ent << (8 * (n %4 ))); + }else { + core->mac[IVAR0 + n /4 ] &= ~mask; + } + + n =igb_ivar_entry_tx (vfn); + mask =0xffU << (8 * (n %4 )); + ent = vtivar >>8 ; +if (ent &E1000_IVAR_VALID ) { + ent =E1000_IVAR_VALID | + (24 - vfn *IGBVF_MSIX_VEC_NUM - (2 - (ent &0x7 ))); + core->mac[IVAR0 + n /4 ] = + (core->mac[IVAR0 + n /4 ] & ~mask) | + ((uint32_t )ent << (8 * (n %4 ))); + }else { + core->mac[IVAR0 + n /4 ] &= ~mask; + } +}
hw/net/igb_migration.c +3 -0
@@ -253,6 +253,9 @@ static int igb_core_vf_load_state(IgbVfState *s, const void *buf, size_t size) } } +/* Propagate VTIVAR to IVAR0, skipped by direct core->mac[] write */ +igb_core_vf_propagate_ivar (core, s->vfn); +trace_igbvf_mig_load_state (s->vfn, (uint32_t )size);return 0 ; }
Signature · 1 line
2.56.0
RFC PATCH v3 7/17 igb: Add VF TX context state serialization
In reply to Cédric Le GoaterSave and restore the per-queue TX context descriptors and in-flight packet state for each of the VF's two TX queues. Without this, a partially described packet would be malformed or dropped on the destination after migration.
AI-used-for: analysis, code (prototype)
--- hw/net/igb_migration.c | 64 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+)
hw/net/igb_migration.c +64 -0
@@ -37,12 +37,22 @@ typedef struct IgbMigRegPair {#define IGB_VF_MAX_FIXED_REGS 64 +typedef struct IgbMigTxCtx { +uint32_t ctx_desc[8 ];/* 2 * adv_tx_context_desc (4 dwords each) */ +uint32_t first_cmd_type_len; +uint32_t first_olinfo_status; +uint32_t first; +uint32_t skip_cp; +}IgbMigTxCtx ; +typedef struct IgbMigBlob {uint32_t magic;uint32_t version;uint32_t vfn;uint32_t num_regs;IgbMigRegPair regs[IGB_VF_MAX_FIXED_REGS ]; +uint32_t num_tx_ctx; +IgbMigTxCtx tx_ctx[2 ]; }IgbMigBlob ;#define IGB_MIG_BLOB_SIZE sizeof(IgbMigBlob)
@@ -140,6 +150,23 @@ static int igb_vf_reg_list(uint16_t vfn, uint32_t *offsets)return n; } +static void igb_core_vf_save_tx_ctx (IGBCore *core,int queue, +IgbMigTxCtx *tx) +{ +struct igb_tx *src = &core->tx[queue]; + +for (int i =0 ; i <2 ; i++) { + tx->ctx_desc[i *4 +0 ] =cpu_to_le32 (src->ctx[i].vlan_macip_lens); + tx->ctx_desc[i *4 +1 ] =cpu_to_le32 (src->ctx[i].seqnum_seed); + tx->ctx_desc[i *4 +2 ] =cpu_to_le32 (src->ctx[i].type_tucmd_mlhl); + tx->ctx_desc[i *4 +3 ] =cpu_to_le32 (src->ctx[i].mss_l4len_idx); + } + tx->first_cmd_type_len =cpu_to_le32 (src->first_cmd_type_len); + tx->first_olinfo_status =cpu_to_le32 (src->first_olinfo_status); + tx->first =cpu_to_le32 (src->first); + tx->skip_cp =cpu_to_le32 (src->skip_cp); +} +static int igb_core_vf_save_state (IgbVfState *s,void *buf,size_t buf_size) {int size =IGB_MIG_BLOB_SIZE ;
@@ -147,6 +174,8 @@ static int igb_core_vf_save_state(IgbVfState *s, void *buf, size_t buf_size)IgbMigBlob *blob = buf;uint32_t offsets[IGB_VF_MAX_FIXED_REGS ];int num_regs; +int q0 = s->vfn; +int q1 = s->vfn +IGB_NUM_VM_POOLS ; num_regs =igb_vf_reg_list (s->vfn, offsets);
@@ -168,6 +197,10 @@ static int igb_core_vf_save_state(IgbVfState *s, void *buf, size_t buf_size) blob->regs[i].value =cpu_to_le32 (core->mac[offsets[i]]); } + blob->num_tx_ctx =cpu_to_le32 (2 ); +igb_core_vf_save_tx_ctx (core, q0, &blob->tx_ctx[0 ]); +igb_core_vf_save_tx_ctx (core, q1, &blob->tx_ctx[1 ]); +trace_igbvf_mig_save_state (s->vfn, size);return size; }
@@ -203,9 +236,32 @@ static bool igb_core_vf_validate_regs(uint16_t vfn,return true; } +static void igb_core_vf_load_tx_ctx (IGBCore *core,int queue, +const IgbMigTxCtx *tx) +{ +struct igb_tx *dst = &core->tx[queue]; + +/* +* Preserve the destination's tx_pkt - it's a host-side object, +* not guest state +*/ +for (int i =0 ; i <2 ; i++) { + dst->ctx[i].vlan_macip_lens =le32_to_cpu (tx->ctx_desc[i *4 +0 ]); + dst->ctx[i].seqnum_seed =le32_to_cpu (tx->ctx_desc[i *4 +1 ]); + dst->ctx[i].type_tucmd_mlhl =le32_to_cpu (tx->ctx_desc[i *4 +2 ]); + dst->ctx[i].mss_l4len_idx =le32_to_cpu (tx->ctx_desc[i *4 +3 ]); + } + dst->first_cmd_type_len =le32_to_cpu (tx->first_cmd_type_len); + dst->first_olinfo_status =le32_to_cpu (tx->first_olinfo_status); + dst->first =le32_to_cpu (tx->first); + dst->skip_cp =le32_to_cpu (tx->skip_cp); +} +static int igb_core_vf_load_state (IgbVfState *s,const void *buf,size_t size) {IGBCore *core =igbvf_get_core (s); +int q0 = s->vfn; +int q1 = s->vfn +IGB_NUM_VM_POOLS ;const IgbMigBlob *blob = buf;uint32_t magic, version, saved_vfn, num_regs;
@@ -236,6 +292,11 @@ static int igb_core_vf_load_state(IgbVfState *s, const void *buf, size_t size)return -IGB_MIG_ERR_BAD_DATA ; } +uint32_t num_tx =le32_to_cpu (blob->num_tx_ctx); +if (num_tx !=2 ) { +return -IGB_MIG_ERR_BAD_DATA ; + } +/* * Phase 2: Apply state. All offsets and placements are * validated; writes cannot fail.
@@ -253,6 +314,9 @@ static int igb_core_vf_load_state(IgbVfState *s, const void *buf, size_t size) } } +igb_core_vf_load_tx_ctx (core, q0, &blob->tx_ctx[0 ]); +igb_core_vf_load_tx_ctx (core, q1, &blob->tx_ctx[1 ]); +/* Propagate VTIVAR to IVAR0, skipped by direct core->mac[] write */ igb_core_vf_propagate_ivar (core, s->vfn);
Signature · 1 line
2.56.0
RFC PATCH v3 8/17 igb: Add VF RA entries state serialization
In reply to Cédric Le GoaterThe receive address (RA) table is scanned linearly by the hardware during RX filtering, so slot indices are irrelevant to the VF. The PF driver picks the slot when the VF requests a MAC address via the mailbox.
On save, scan the RA/RA2 banks for entries whose pool bits include this VF. On load, clear this VF's stale RA entries from the destination (removing only this VF's pool bit, keeping entries shared with other VFs). Then place each saved entry by MAC address match or free slot.
Add dry-run validation that simulates the post-clear table state and verifies every saved entry can be placed before any state is modified.
AI-used-for: analysis, code (prototype)
--- hw/net/igb_migration.h | 1 + hw/net/igb_migration.c | 222 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 223 insertions(+)
hw/net/igb_migration.h +1 -0
@@ -77,6 +77,7 @@#define IGB_MIG_ERR_BAD_VERSION 7#define IGB_MIG_ERR_BAD_VFN 8#define IGB_MIG_ERR_BAD_DATA 9 +#define IGB_MIG_ERR_UNSUPPORTED 10/* Shared buffer constants */ #define IGB_VF_STATE_MAX_SIZE 4096
hw/net/igb_migration.c +222 -0
264 lines not on this page · raw message
Signature · 1 line
2.56.0
RFC PATCH v3 9/17 igb: Add VF VLAN filters (VLVF) serialization
In reply to Cédric Le GoaterVF VLAN filters are stored in the shared VLVF[0..31] table with per-VF pool bits in the POOLSEL field.
On save, scan the 32 VLVF entries for this VF's pool bit and record the VLVF register value in the migration blob. On load, clear this VF's stale VLVF entries from the destination (removing only this VF's pool bit, keeping entries shared with other VFs). Then place each saved entry by VLAN ID match or free slot. Set the corresponding VFTA bit so the global VLAN filter accepts frames for the restored VLANs.
Add dry-run validation that simulates the post-clear table state and verifies every saved entry can be placed before any state is modified.
AI-used-for: analysis, code (prototype)
--- hw/net/igb_migration.c | 166 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+)
hw/net/igb_migration.c +166 -0
@@ -38,6 +38,7 @@ typedef struct IgbMigRegPair {#define IGB_VF_MAX_FIXED_REGS 64#define IGB_VF_MAX_RA_REGS 48/* (16 + 8) RA entries * 2 (RAL+RAH) */ +#define IGB_VF_MAX_VLVF_REGS E1000_VLVF_ARRAY_SIZE typedef struct IgbMigTxCtx { uint32_t ctx_desc[8]; /* 2 * adv_tx_context_desc (4 dwords each) */
@@ -57,6 +58,8 @@ typedef struct IgbMigBlob {IgbMigRegPair ra[IGB_VF_MAX_RA_REGS ];uint32_t num_tx_ctx;IgbMigTxCtx tx_ctx[2 ]; +uint32_t num_vlvf; +uint32_t vlvf[IGB_VF_MAX_VLVF_REGS ]; } IgbMigBlob;#define IGB_MIG_BLOB_SIZE sizeof(IgbMigBlob)
@@ -283,6 +286,93 @@ static int igb_core_vf_load_ra(IGBCore *core, uint16_t vfn,return 0 ; } +/* +* Scan VLVF entries for VLAN memberships assigned to this VF. +* Each VLVF entry has a per-pool bitmask (POOLSEL); save entries +* where this VF's pool bit is set. +*/ +static int igb_core_vf_save_vlvf (IGBCore *core,uint16_t vfn, +uint32_t *vlvf_out) +{ +uint32_t vf_pool_bit =BIT (vfn) <<E1000_VLVF_POOLSEL_SHIFT ; +int n =0 ; + +for (int i =0 ; i <E1000_VLVF_ARRAY_SIZE ; i++) { +uint32_t vlvf = core->mac[VLVF0 + i]; + +if ((vlvf &E1000_VLVF_VLANID_ENABLE ) && (vlvf & vf_pool_bit)) { + vlvf_out[n++] =cpu_to_le32 (vlvf); + } + } +return n; +} + +/* +* Clear this VF's pool bit from all destination VLVF entries. +* If no pools remain after clearing, disable the entry entirely. +*/ +static void igb_core_vf_clear_vlvf (IGBCore *core,uint16_t vfn) +{ +uint32_t vf_pool_bit =BIT (vfn) <<E1000_VLVF_POOLSEL_SHIFT ; + +for (int i =0 ; i <E1000_VLVF_ARRAY_SIZE ; i++) { +uint32_t vlvf = core->mac[VLVF0 + i]; + +if (!(vlvf &E1000_VLVF_VLANID_ENABLE )) { +continue ; + } + + vlvf &= ~vf_pool_bit; +if (!(vlvf &E1000_VLVF_POOLSEL_MASK )) { + vlvf &= ~E1000_VLVF_VLANID_ENABLE ; + } + core->mac[VLVF0 + i] = vlvf; + } +} + +/* +* Restore VLVF entries by matching VLAN ID on the destination. +* Preserves other VFs' memberships and sets the VFTA bit so the +* global VLAN filter accepts frames for this VLAN. +*/ +static int igb_core_vf_load_vlvf (IGBCore *core,uint16_t vfn, +const uint32_t *vlvf_in,uint32_t num) +{ +uint32_t vf_pool_bit =BIT (vfn) <<E1000_VLVF_POOLSEL_SHIFT ; + +for (uint32_t i =0 ; i < num; i++) { +uint32_t saved =le32_to_cpu (vlvf_in[i]); +uint16_t vlan_id = saved &E1000_VLVF_VLANID_MASK ; +int match =-1 ; +int free_slot =-1 ; + +for (int j =0 ; j <E1000_VLVF_ARRAY_SIZE ; j++) { +uint32_t vlvf = core->mac[VLVF0 + j]; + +if (vlvf &E1000_VLVF_VLANID_ENABLE ) { +if ((vlvf &E1000_VLVF_VLANID_MASK ) == vlan_id) { + match = j; +break ; + } + }else if (free_slot <0 ) { + free_slot = j; + } + } + +if (match >=0 ) { + core->mac[VLVF0 + match] |= vf_pool_bit; + }else if (free_slot >=0 ) { + core->mac[VLVF0 + free_slot] = +E1000_VLVF_VLANID_ENABLE | vf_pool_bit | vlan_id; + }else { +return -IGB_MIG_ERR_BAD_DATA ; + } + + core->mac[VFTA + (vlan_id >>5 )] |=BIT (vlan_id &0x1f ); + } +return 0 ; +} +/* * Dry-run check: can all saved RA entries be placed after clearing * this VF's pool bits? Simulates the clear+load without writing.
@@ -349,6 +439,57 @@ static int igb_core_vf_can_load_ra(IGBCore *core, uint16_t vfn,return 0 ; } +/* +* Dry-run check: can all saved VLVF entries be placed after clearing +* this VF's pool bits? Same logic as RA: sole-owner entries become +* free, shared entries keep their VLAN ID. +*/ +static int igb_core_vf_can_load_vlvf (IGBCore *core,uint16_t vfn, +const uint32_t *vlvf_in,uint32_t num) +{ +uint32_t vf_pool_bit =BIT (vfn) <<E1000_VLVF_POOLSEL_SHIFT ; +int free_slots =0 ; + +for (int j =0 ; j <E1000_VLVF_ARRAY_SIZE ; j++) { +uint32_t vlvf = core->mac[VLVF0 + j]; + +if (!(vlvf &E1000_VLVF_VLANID_ENABLE )) { + free_slots++; + }else if ((vlvf & vf_pool_bit) && + !(vlvf & ~vf_pool_bit &E1000_VLVF_POOLSEL_MASK )) { + free_slots++; + } + } + +for (uint32_t i =0 ; i < num; i++) { +uint16_t vlan_id =le32_to_cpu (vlvf_in[i]) &E1000_VLVF_VLANID_MASK ; +bool found = false; + +for (int j =0 ; j <E1000_VLVF_ARRAY_SIZE ; j++) { +uint32_t vlvf = core->mac[VLVF0 + j]; + +if (!(vlvf &E1000_VLVF_VLANID_ENABLE )) { +continue ; + } +if ((vlvf & vf_pool_bit) && + !(vlvf & ~vf_pool_bit &E1000_VLVF_POOLSEL_MASK )) { +continue ; + } +if ((vlvf &E1000_VLVF_VLANID_MASK ) == vlan_id) { + found = true; +break ; + } + } + +if (!found) { +if (--free_slots <0 ) { +return -IGB_MIG_ERR_UNSUPPORTED ; + } + } + } +return 0 ; +} +static void igb_core_vf_save_tx_ctx (IGBCore *core,int queue,IgbMigTxCtx *tx) {
@@ -402,6 +543,9 @@ static int igb_core_vf_save_state(IgbVfState *s, void *buf, size_t buf_size) blob->num_ra =cpu_to_le32 (igb_core_vf_save_ra (core, s->vfn, blob->ra)); + blob->num_vlvf =cpu_to_le32 (igb_core_vf_save_vlvf (core, s->vfn, + blob->vlvf)); +trace_igbvf_mig_save_state (s->vfn, size);return size; }
@@ -509,6 +653,18 @@ static int igb_core_vf_load_state(IgbVfState *s, const void *buf, size_t size) } } +uint32_t num_vlvf =le32_to_cpu (blob->num_vlvf); +if (num_vlvf >IGB_VF_MAX_VLVF_REGS ) { +return -IGB_MIG_ERR_BAD_DATA ; + } +if (num_vlvf >0 ) { +int ret =igb_core_vf_can_load_vlvf (core, s->vfn, + blob->vlvf, num_vlvf); +if (ret <0 ) { +return ret; + } + } +/* * Phase 2: Apply state. All offsets and placements are * validated; writes cannot fail.
@@ -539,6 +695,16 @@ static int igb_core_vf_load_state(IgbVfState *s, const void *buf, size_t size) } } +igb_core_vf_clear_vlvf (core, s->vfn); +if (num_vlvf >0 ) { +int ret =igb_core_vf_load_vlvf (core, s->vfn, blob->vlvf, num_vlvf); +if (ret <0 ) { +error_report ("igb: VF%u: VLVF load failed after pre-validation" , + s->vfn); +return ret; + } + } +/* Propagate VTIVAR to IVAR0, skipped by direct core->mac[] write */ igb_core_vf_propagate_ivar (core, s->vfn);
Signature · 1 line
2.56.0
RFC PATCH v3 10/17 igb: Save MTA/UTA hash tables and fixup on VF migration load
In reply to Cédric Le GoaterThe MTA and UTA are PF-wide shared hash tables with no per-VF ownership bits. A VF using multicast (VMOLR.ROMPE) or unicast (VMOLR.ROPE) hash filtering relies on entries that may differ between source and destination PFs.
Save both tables in the migration blob and compare them on load. If the destination PF is missing entries that were present on the source, warn and OR them into the destination, to prevent silent multicast or unicast packet loss. Stale source entries may persist on the destination until the L1 driver reprograms the tables.
AI-used-for: analysis, code (prototype)
--- hw/net/igb_migration.c | 77 ++++++++++++++++++++++++++++++++++++++++++ hw/net/trace-events | 1 + 2 files changed, 78 insertions(+)
hw/net/igb_migration.c +77 -0
@@ -60,6 +60,8 @@ typedef struct IgbMigBlob {IgbMigTxCtx tx_ctx[2 ];uint32_t num_vlvf;uint32_t vlvf[IGB_VF_MAX_VLVF_REGS ]; +uint32_t mta[E1000_MC_TBL_SIZE ]; +uint32_t uta[E1000_MC_TBL_SIZE ]; } IgbMigBlob;#define IGB_MIG_BLOB_SIZE sizeof(IgbMigBlob)
@@ -490,6 +492,22 @@ static int igb_core_vf_can_load_vlvf(IGBCore *core, uint16_t vfn,return 0 ; } +static void igb_core_vf_save_hash_tables (IGBCore *core,uint16_t vfn, +IgbMigBlob *blob) +{ +for (int i =0 ; i <E1000_MC_TBL_SIZE ; i++) { + blob->mta[i] =cpu_to_le32 (core->mac[MTA + i]); + blob->uta[i] =cpu_to_le32 (core->mac[UTA + i]); + +if (core->mac[MTA + i]) { +trace_igbvf_mig_save_hash_tables (vfn,"MTA" , i, core->mac[MTA + i]); + } +if (core->mac[UTA + i]) { +trace_igbvf_mig_save_hash_tables (vfn,"UTA" , i, core->mac[UTA + i]); + } + } +} +static void igb_core_vf_save_tx_ctx (IGBCore *core,int queue,IgbMigTxCtx *tx) {
@@ -546,6 +564,8 @@ static int igb_core_vf_save_state(IgbVfState *s, void *buf, size_t buf_size) blob->num_vlvf =cpu_to_le32 (igb_core_vf_save_vlvf (core, s->vfn, blob->vlvf)); +igb_core_vf_save_hash_tables (core, s->vfn, blob); +trace_igbvf_mig_save_state (s->vfn, size);return size; }
@@ -581,6 +601,61 @@ static bool igb_core_vf_validate_regs(uint16_t vfn,return true; } +/* +* Extract a register from the incoming blob. Used in Phase 1 +* validation where core->mac[] still holds the destination's state, +* not the source's. +*/ +static uint32_t igb_core_vf_blob_get_reg (const IgbMigBlob *blob, +uint32_t offset) +{ +uint32_t num_regs =le32_to_cpu (blob->num_regs); + +for (int i =0 ; i < num_regs; i++) { +if (le32_to_cpu (blob->regs[i].offset) == offset) { +return le32_to_cpu (blob->regs[i].value); + } + } +return 0 ; +} + +/* +* OR missing hash table entries from the source into the destination. +* MTA/UTA are PF-wide shared tables with no per-VF ownership, so +* entries present on the source may be absent on the destination. +*/ +static bool igb_core_vf_fixup_hash_tables (IGBCore *core,uint16_t vfn, +const IgbMigBlob *blob) +{ +uint32_t vmolr =igb_core_vf_blob_get_reg (blob,VMOLR0 + vfn); +bool check_mta = vmolr &E1000_VMOLR_ROMPE ; +bool check_uta = vmolr &E1000_VMOLR_ROPE ; +bool fixed_up = false; + +for (int i =0 ; i <E1000_MC_TBL_SIZE ; i++) { +uint32_t src_mta =le32_to_cpu (blob->mta[i]); +uint32_t src_uta =le32_to_cpu (blob->uta[i]); +uint32_t missing_mta = src_mta & ~core->mac[MTA + i]; +uint32_t missing_uta = src_uta & ~core->mac[UTA + i]; + +if (missing_mta && check_mta) { +warn_report ("igb: VF%u: MTA[%d] source 0x%x destination 0x%x" +" (missing 0x%x, merged)" , + vfn, i, src_mta, core->mac[MTA + i], missing_mta); + core->mac[MTA + i] |= missing_mta; + fixed_up = true; + } +if (missing_uta && check_uta) { +warn_report ("igb: VF%u: UTA[%d] source 0x%x destination 0x%x" +" (missing 0x%x, merged)" , + vfn, i, src_uta, core->mac[UTA + i], missing_uta); + core->mac[UTA + i] |= missing_uta; + fixed_up = true; + } + } +return fixed_up; +} +static void igb_core_vf_load_tx_ctx (IGBCore *core,int queue,const IgbMigTxCtx *tx) {
@@ -705,6 +780,8 @@ static int igb_core_vf_load_state(IgbVfState *s, const void *buf, size_t size) } } +igb_core_vf_fixup_hash_tables (core, s->vfn, blob); +/* Propagate VTIVAR to IVAR0, skipped by direct core->mac[] write */ igb_core_vf_propagate_ivar (core, s->vfn);
hw/net/trace-events +1 -0
@@ -301,6 +301,7 @@ igbvf_mig_status(uint16_t vfn, uint32_t status) "VF%u: status 0x%x" igbvf_mig_set_state(uint16_t vfn, uint32_t old_state, uint32_t new_state) "VF%u: state %u -> %u" igbvf_mig_save_state(uint16_t vfn, uint32_t size) "VF%u: saved %u bytes of device state" igbvf_mig_load_state(uint16_t vfn, uint32_t size) "VF%u: loaded %u bytes of device state" +igbvf_mig_save_hash_tables(uint16_t vfn, const char *name, int index, uint32_t value) "VF%u: %s[%d]=0x%x" igbvf_mig_reset(uint16_t vfn) "VF%u: migration state reset" # spapr_llan.c
Signature · 1 line
2.56.0
RFC PATCH v3 11/17 igb: Add dirty page tracking for IGBVF migration
In reply to Cédric Le GoaterAdd per-VF dirty page tracking using bitmaps allocated per IOVA range. The DMA data path is instrumented via igb_core_dirty_track_dma() calls at all five DMA write sites: TX descriptor writeback (head pointer and status), RX descriptor writeback, RX header fragment, and RX payload fragment.
The migration DVSEC exposes DIRTY_ENABLE, DIRTY_DISABLE and DIRTY_QUERY commands. Range parameters and query results are exchanged through the shared DMA buffer.
Add the PRE_COPY device state to support pre-copy live migration with concurrent dirty tracking. PRE_COPY transitions:
- RUNNING -> PRE_COPY
- PRE_COPY -> STOP, RUNNING, STOP_COPY
Dirty tracking is automatically disabled when leaving PRE_COPY or STOP_COPY.
AI-used-for: code (prototype)
--- hw/net/igb_core.h | 4 + hw/net/igb_migration.h | 67 ++++++++- hw/net/igb_core.c | 42 ++++-- hw/net/igb_migration.c | 330 ++++++++++++++++++++++++++++++++++++++++- hw/net/trace-events | 11 +- 5 files changed, 432 insertions(+), 22 deletions(-)
hw/net/igb_core.h +4 -0
@@ -40,6 +40,8 @@#ifndef HW_NET_IGB_CORE_H #define HW_NET_IGB_CORE_H +#include "igb_migration.h" +#define E1000E_MAC_SIZE (0x8000)#define IGB_EEPROM_SIZE (1024)
@@ -99,6 +101,8 @@ struct IGBCore {void (*owner_start_recv)(PCIDevice *d);int64_t timadj; + +IGBVfDirtyState vf_dirty[IGB_MAX_VF_FUNCTIONS ]; };void
hw/net/igb_migration.h +66 -1
107 lines not on this page · raw message
hw/net/igb_core.c +28 -14
88 lines not on this page · raw message
hw/net/igb_migration.c +325 -5
386 lines not on this page · raw message
hw/net/trace-events +9 -2
@@ -299,10 +299,17 @@ igbvf_wrn_io_addr_unknown(uint64_t addr) "IO unknown register 0x%"PRIx64 igbvf_mig_cmd(uint16_t vfn, uint32_t cmd, uint32_t arg, uint32_t state) "VF%u: cmd %u arg %u (mig_state=%u)" igbvf_mig_status(uint16_t vfn, uint32_t status) "VF%u: status 0x%x" igbvf_mig_set_state(uint16_t vfn, uint32_t old_state, uint32_t new_state) "VF%u: state %u -> %u" -igbvf_mig_save_state(uint16_t vfn, uint32_t size) "VF%u: saved %u bytes of device state" -igbvf_mig_load_state(uint16_t vfn, uint32_t size) "VF%u: loaded %u bytes of device state" +igbvf_mig_save_state(uint16_t vfn, int size, bool vfre, bool vfte, uint32_t reg_vfre) "VF%u: saved %d bytes vfre=%d vfte=%d VFRE=0x%x" +igbvf_mig_load_state(uint16_t vfn, uint32_t size, bool vfre, bool vfte) "VF%u: loaded %u bytes vfre=%d vfte=%d" igbvf_mig_save_hash_tables(uint16_t vfn, const char *name, int index, uint32_t value) "VF%u: %s[%d]=0x%x" igbvf_mig_reset(uint16_t vfn) "VF%u: migration state reset" +igbvf_mig_dirty_enable(uint16_t vfn, uint64_t pgsize, uint64_t nbits) "VF%u: dirty tracking enabled pgsize=%"PRIu64" nbits=%"PRIu64 +igbvf_mig_dirty_disable(uint16_t vfn) "VF%u: dirty tracking disabled" +igbvf_mig_dirty_query(uint16_t vfn, uint64_t size, uint32_t dirty_pages) "VF%u: dirty query returned %"PRIu64" bytes, %u dirty pages" +igb_core_dirty_track_dma(int vfn, uint64_t addr, uint64_t len) "VF%d: dirty DMA addr=0x%"PRIx64" len=%"PRIu64 +igb_core_dirty_track_dma_drop(int vfn, uint64_t addr, uint64_t len) "VF%d: dirty DMA dropped addr=0x%"PRIx64" len=%"PRIu64" no matching range" +igbvf_mig_quiesce(uint16_t vfn, uint32_t vfre, uint32_t vfte) "VF%u: quiesce VFRE=0x%x VFTE=0x%x" +igbvf_mig_unquiesce(uint16_t vfn, uint32_t vfre, uint32_t vfte) "VF%u: unquiesce VFRE=0x%x VFTE=0x%x" # spapr_llan.c spapr_vlan_get_rx_bd_from_pool_found(int pool, int32_t count, uint32_t rx_bufs) "pool=%d count=%"PRId32" rxbufs=%"PRIu32
Signature · 1 line
2.56.0
RFC PATCH v3 12/17 igb: Quiesce VFs on STOP and include PF enable state in migration
In reply to Cédric Le GoaterQuiesce VFs by clearing VFRE/VFTE on transitions to STOP or STOP_COPY, preventing DMA while device state is serialized. Restore saved VFRE/VFTE on STOP->RUNNING.
Include per-VF VFRE/VFTE enable bits in the migration blob so the destination can restore the pre-quiesce state. Add a QUIESCED bit to STATUS for the driver to confirm DMA has drained. Clear VFLRE before state restore on the destination to prevent stale reset indications.
AI-used-for: analysis, code (prototype)
--- hw/net/igb_migration.h | 6 ++- hw/net/igb_migration.c | 86 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 89 insertions(+), 3 deletions(-)
hw/net/igb_migration.h +5 -1
@@ -24,7 +24,8 @@* +0x0C CAPS (RO: F_STATE[0], F_DIRTY[1], * max_ranges[11:8], pgsize[16:12]) * +0x10 CTRL (WO: doorbell command) -* +0x14 STATUS (RO: state[7:0], error_code[15:8]) +* +0x14 STATUS (RO: state[7:0], error_code[15:8], +* QUIESCED[16]) * +0x18 BUF_ADDR_LO (RW: shared buffer GPA low) * +0x1C BUF_ADDR_HI (RW: shared buffer GPA high) * +0x20 DATA_SIZE (RO: state blob size in bytes)
@@ -71,6 +72,7 @@#define IGB_MIG_STATUS_ERROR_CODE_SHIFT 8#define IGB_MIG_STATUS_ERR (code) \ ((uint32_t)(code) << IGB_MIG_STATUS_ERROR_CODE_SHIFT) +#define IGB_MIG_STATUS_QUIESCED (1u << 16)/* Device states (based on VFIO migration v2) */ #define IGB_MIG_STATE_ERROR 0
@@ -104,6 +106,8 @@ typedef struct IgbVfMigState {uint32_t mig_data[IGB_VF_STATE_MAX_SIZE /sizeof (uint32_t )];uint32_t mig_data_size;uint64_t mig_data_buf_addr; +bool mig_saved_vfre; +bool mig_saved_vfte; } IgbVfMigState;#define IGB_MIG_DIRTY_DEFAULT_PGSIZE 4096
hw/net/igb_migration.c +84 -2
154 lines not on this page · raw message
Signature · 1 line
2.56.0
RFC PATCH v3 13/17 igb: Save and restore effective VF interrupt masks for migration
In reply to Cédric Le GoaterThe PVT shadow registers (PVTEIMS/PVTEIAC/PVTEIAM) record the last VF write, not the effective accumulated state. The actual effective mask lives in the PF aggregate EIMS/EIAC/EIAM registers.
Capture the VF's effective mask bits from the PF aggregates at quiesce entry, before disabling VFRE/VFTE. Store them in the blob and restore via igb_core_vf_restore_irqs() on unquiesce paths.
AI-used-for: analysis, code (prototype)
--- hw/net/igb_migration.h | 3 ++ hw/net/igb_migration.c | 68 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 70 insertions(+), 1 deletion(-)
hw/net/igb_migration.h +3 -0
@@ -108,6 +108,9 @@ typedef struct IgbVfMigState {uint64_t mig_data_buf_addr;bool mig_saved_vfre;bool mig_saved_vfte; +uint32_t mig_saved_eims; +uint32_t mig_saved_eiac; +uint32_t mig_saved_eiam; } IgbVfMigState;#define IGB_MIG_DIRTY_DEFAULT_PGSIZE 4096
hw/net/igb_migration.c +67 -1
104 lines not on this page · raw message
Signature · 1 line
2.56.0
RFC PATCH v3 14/17 igb: Re-raise pending VF interrupt causes on unquiesce
In reply to Cédric Le GoaterAfter restoring VFRE/VFTE, the VF's RX and TX rings may be stalled because the guest driver is waiting for an interrupt that was pending at the time of migration.
Add igb_core_vf_raise_causes() to re-inject pending EICR causes on unquiesce, resuming interrupt delivery to the guest and kicking the RX and TX rings.
AI-used-for: analysis, code (prototype)
--- hw/net/igb_core.h | 1 + hw/net/igb_core.c | 14 ++++++++++++++ hw/net/igb_migration.c | 5 +++++ 3 files changed, 20 insertions(+)
hw/net/igb_core.h +1 -0
@@ -150,5 +150,6 @@ igb_start_recv(IGBCore *core);IGBCore *igb_pf_get_core (void *pf);void igb_core_vf_propagate_ivar (IGBCore *core,uint16_t vfn); +void igb_core_vf_raise_causes (IGBCore *core,uint16_t vfn);#endif
hw/net/igb_core.c +14 -0
@@ -4603,3 +4603,17 @@ void igb_core_vf_propagate_ivar(IGBCore *core, uint16_t vfn) core->mac[IVAR0 + n /4 ] &= ~mask; } } + +/* +* Raise pending VF interrupt causes without re-propagating masks. +*/ +void igb_core_vf_raise_causes (IGBCore *core,uint16_t vfn) +{ +uint32_t shift =22 - vfn *IGBVF_MSIX_VEC_NUM ; +uint32_t pvt_idx =PVTEICR0 + vfn *0x40 ; +uint32_t causes = (core->mac[pvt_idx] &0x7 ) << shift; + +if (causes) { +igb_set_eics (core,EICS , causes); + } +}
hw/net/igb_migration.c +5 -0
@@ -1291,6 +1291,11 @@ static void igb_core_vf_unquiesce(IgbVfState *s)igb_core_vf_restore_irqs (core, s->vfn, ms->mig_saved_eims, ms->mig_saved_eiac, ms->mig_saved_eiam); + +/* Re-inject pending VF interrupt causes to resume RX/TX ring polling */ +if (re || te) { +igb_core_vf_raise_causes (core, s->vfn); + } }static uint8_t igbvf_mig_set_state (IgbVfState *s,uint32_t new_state)
Signature · 1 line
2.56.0
RFC PATCH v3 15/17 igb: Add dirty page tracking statistics
In reply to Cédric Le GoaterAdd a GET_STATS command (cmd 7) to the migration DVSEC for monitoring dirty page tracking and DMA activity per VF. The device DMA-writes an igb_mig_stats_resp struct to the shared buffer.
The dma_writes counter is also reported in the dirty query buffer so the driver gets it alongside the bitmap without an extra config read.
Counters are reset on first DIRTY_ENABLE, so the driver can read final values after DIRTY_DISABLE.
AI-used-for: code (prototype)
--- hw/net/igb_core.h | 1 + hw/net/igb_migration.h | 22 +++++++++++++++ hw/net/igb_migration.c | 63 ++++++++++++++++++++++++++++++++++++++++-- hw/net/trace-events | 2 +- 4 files changed, 84 insertions(+), 4 deletions(-)
hw/net/igb_core.h +1 -0
@@ -103,6 +103,7 @@ struct IGBCore {int64_t timadj;IGBVfDirtyState vf_dirty[IGB_MAX_VF_FUNCTIONS ]; +IgbVfMigStats vf_mig_stats[IGB_MAX_VF_FUNCTIONS ]; };void
hw/net/igb_migration.h +22 -0
@@ -66,6 +66,7 @@#define IGB_MIG_CMD_DIRTY_ENABLE 4#define IGB_MIG_CMD_DIRTY_DISABLE 5#define IGB_MIG_CMD_DIRTY_QUERY 6 +#define IGB_MIG_CMD_GET_STATS 7/* STATUS register: state in [7:0], error code [15:8] */ #define IGB_MIG_STATUS_STATE_MASK 0xFF
@@ -101,6 +102,15 @@/* Shared buffer constants */ #define IGB_VF_STATE_MAX_SIZE 4096 +typedef struct IgbVfMigStats { +uint64_t dma_writes; +uint64_t dma_bytes; +uint32_t dirty_pages_set; +uint32_t dirty_pages_cleared; +uint32_t dirty_page_count; +uint32_t dirty_query_count; +}IgbVfMigStats ; + typedef struct IgbVfMigState { uint32_t mig_state; uint32_t mig_data[IGB_VF_STATE_MAX_SIZE / sizeof(uint32_t)];
@@ -157,6 +167,18 @@ struct igb_mig_dirty_query {uint8_t bitmap[]; }; +/* +* GET_STATS: device writes igb_mig_stats_resp to buffer. +*/ +struct igb_mig_stats_resp { +uint64_t dma_writes; +uint64_t dma_bytes; +uint32_t dirty_pages_set; +uint32_t dirty_pages_cleared; +uint32_t dirty_page_count; +uint32_t dirty_query_count; +}; +typedef struct IGBCore IGBCore ;typedef struct IgbVfState IgbVfState ;
hw/net/igb_migration.c +60 -3
123 lines not on this page · raw message
hw/net/trace-events +1 -1
@@ -305,7 +305,7 @@ igbvf_mig_save_hash_tables(uint16_t vfn, const char *name, int index, uint32_t v igbvf_mig_reset(uint16_t vfn) "VF%u: migration state reset" igbvf_mig_dirty_enable(uint16_t vfn, uint64_t pgsize, uint64_t nbits) "VF%u: dirty tracking enabled pgsize=%"PRIu64" nbits=%"PRIu64 igbvf_mig_dirty_disable(uint16_t vfn) "VF%u: dirty tracking disabled" -igbvf_mig_dirty_query(uint16_t vfn, uint64_t size, uint32_t dirty_pages) "VF%u: dirty query returned %"PRIu64" bytes, %u dirty pages" +igbvf_mig_dirty_query(uint16_t vfn, uint64_t size, uint32_t dirty_pages, uint64_t dma_writes) "VF%u: dirty query returned %"PRIu64" bytes, %u dirty pages (dma_writes=%"PRIu64")" igb_core_dirty_track_dma(int vfn, uint64_t addr, uint64_t len) "VF%d: dirty DMA addr=0x%"PRIx64" len=%"PRIu64 igb_core_dirty_track_dma_drop(int vfn, uint64_t addr, uint64_t len) "VF%d: dirty DMA dropped addr=0x%"PRIx64" len=%"PRIu64" no matching range" igbvf_mig_quiesce(uint16_t vfn, uint32_t vfre, uint32_t vfte) "VF%u: quiesce VFRE=0x%x VFTE=0x%x"
Signature · 1 line
2.56.0
RFC PATCH v3 16/17 docs: Add igb VF migration testing setup guide
In reply to Cédric Le GoaterDocument the igb VF migration interface: DVSEC register layout, dirty page tracking, testing setup with nested virtualization.
AI-used-for: docs
--- MAINTAINERS | 1 + docs/system/device-emulation.rst | 1 + docs/system/devices/igb-migration.rst | 410 ++++++++++++++++++++++++++ docs/system/devices/igb.rst | 6 + 4 files changed, 418 insertions(+) create mode 100644 docs/system/devices/igb-migration.rst
MAINTAINERS +1 -0
@@ -2826,6 +2826,7 @@ igb VF migration M: Cédric Le Goater <[email protected]> S: Maintained F: hw/net/igb_migration.* +F: docs/system/devices/igb-migration.rst eepro100 M: Stefan Weil <[email protected]>
docs/system/device-emulation.rst +1 -0
@@ -90,6 +90,7 @@ Emulated Devices devices/cxl.rst devices/emmc.rst devices/igb.rst + devices/igb-migration.rst devices/ivshmem-flat.rst devices/ivshmem.rst devices/keyboard.rst
docs/system/devices/igb-migration.rst new file +410 -0
410 lines not on this page · raw message
docs/system/devices/igb.rst +6 -0
@@ -64,6 +64,12 @@ command: pyvenv/bin/meson test --suite thorough func-x86_64-netdev_ethtool +VF Migration (experimental) +=========================== + +See :ref:`igb-migration` for details on the experimental VF live migration +interface. + References ==========
Signature · 1 line
2.56.0
RFC PATCH v3 17/17 tests/qtest: Add igb VF migration tests
In reply to Cédric Le GoaterAdd qtests for the igb VF migration DVSEC interface covering:
- DVSEC discovery: extended cap header, CAPS flags, CAPS read-only,
BUF_ADDR read-back, VF activation (ERROR -> STOP -> RUNNING)
- State machine: stop-copy and resuming paths with quiesced bit checks, invalid transitions, pre-copy transitions (RUNNING -> PRE_COPY -> STOP, RUNNING -> PRE_COPY -> STOP_COPY)
- Save/load roundtrip: DATA_SIZE in STOP vs STOP_COPY, double save, blob header verification
- Error recovery: full save/load cycle after ERROR -> STOP -> RUNNING
- Blob validation: bad magic, bad version, bad VFN, corrupted blob (random word flips)
- Command errors: unknown command, save/load in wrong state, missing save buffer, missing load buffer, size zero, size too big
- Dirty tracking: enable/disable/query cycle, enable without buffer, query without enable, bad page size, unsupported page size, bad range, overflow, overlapping ranges, misaligned range, multiple ranges, double enable, query with wrong range, 64K page size
The tests access the VF DVSEC via Q35 ECAM (PCIEXBAR enabled through legacy CF8/CFC) and use 16-bit writes for SR-IOV NumVFs/CTRL.
AI-used-for: tests
--- MAINTAINERS | 1 + tests/qtest/igb-migration-test.c | 921 +++++++++++++++++++++++++++++++ tests/qtest/meson.build | 1 + 3 files changed, 923 insertions(+) create mode 100644 tests/qtest/igb-migration-test.c
MAINTAINERS +1 -0
@@ -2826,6 +2826,7 @@ igb VF migration M: Cédric Le Goater <[email protected]> S: Maintained F: hw/net/igb_migration.* +F: tests/qtest/igb-migration-test.c F: docs/system/devices/igb-migration.rst eepro100
tests/qtest/igb-migration-test.c new file +921 -0
921 lines not on this page · raw message
tests/qtest/meson.build +1 -0
@@ -355,6 +355,7 @@ qos_test_ss.add( 'virtio-iommu-test.c', 'vmxnet3-test.c', 'igb-test.c', + 'igb-migration-test.c', 'ufs-test.c', 'riscv-iommu-test.c', )
Signature · 1 line
2.56.0
Quoted 126 lines · Cédric Le Goater
Hello,
Live migration of VFIO-passthrough devices, SR-IOV VFs, vGPUs, is a growing requirement, but real hardware with migration support is scarce and hard to debug. An emulated device provides a fully controlled testbed for developing and validating the entire software stack, vfio-pci variant drivers, VFIO core migration v2 framework, QEMU, libvirt, and for tuning complex migration policies such as downtime convergence. It also serves as an educational reference for understanding VFIO migration end-to-end, from device state serialization to dirty page tracking.
This series adds an experimental VF live migration interface to the emulated igb (82576) device. It enables a vfio-pci variant driver (igb-vfio-pci) to migrate VFs using the standard VFIO migration v2 protocol with stop-copy and pre-copy support.
The target scenario is nested virtualization:
L0 QEMU (these patches)
igb PF with x-vf-migration=on
└── VFs with migration DVSECL1 kernel
igb-vfio-pci variant driver [1]
translates VFIO migration v2 ioctls → DVSEC config writesL1 QEMU (stock, unmodified)
vfio-pci device model, standard migration fdL2 guest
standard igbvf driver, unaware of migrationThe L1 QEMU is completely unmodified. It sees a standard VFIO migratable device and uses the normal migration fd path.
* Design
The migration interface is exposed through a DVSEC (Designated Vendor-Specific Extended Capability, PCIe cap id
0x23) at offset0x160in VF extended config space. The DVSEC uses a command doorbell model; all commands are synchronous via PCI config space writes.Device state is serialized as a versioned blob of per-VF register (offset, value) pairs covering control, interrupt, RX/TX queue, receive address (RA/RA2), etc. plus TX context descriptors and VFRE/VFTE enable bits. The buffer address is a guest physical address (GPA) written by the driver via
virt_to_phys; the device accesses guest RAM directly through the system address space.Dirty page tracking is implemented with per-range bitmaps maintained in IGBCore. All VF DMA paths in
igb_core.c(TX data, RX data, descriptor writeback) are instrumented to record touched pages. The variant driver registers tracked IOVA ranges and queries dirty bitmaps through a shared buffer. Buffer structures include len, flags, and reserved fields for future extensibility.* Caveats
The x-vf-migration property is experimental (x- prefix, default off).
The current implementation maintains dirty bitmaps inside the device, which is not realistic for discrete NICs without on-chip DRAM.
On load, MTA/UTA fixup merges missing source entries into the destination but is not durable: the L1 PF driver zeroes and reprograms these tables on any multicast update, and has no record of the migrated VF's hashes. A proper fix requires QEMU to track per-VF multicast hashes and restore them on load, either through a new DVSEC command consumed by the variant driver or by injecting a VF mailbox message to the L1 PF driver.
* Testing
The target scenario is nested virtualization: L0 runs QEMU with an igb PF (x-vf-migration=on), L1 runs the igb-vfio-pci variant driver and an unmodified QEMU, and L2 runs a standard igbvf driver.
Migration under iperf3 load works correctly: dirty page tracking converges (from ~2000 pages per
PRE_COPYiteration down to ~280 atSTOP_COPY), andSTOP_COPYstays under 250ms.* Todo
1. Add VMState support for L0 migration (dirty bitmaps, tracking engines, DVSEC registers, stats)
2. AddPRE_COPYstate transfer to validate device INIT data (magic, version, etc.)* Ideas
1. RX bandwidth throttle (x-mig-rx-limit, uint32, default 0)
Return false from
can_receivewhen the per-VF packet count in the current tracking interval exceeds the limit. Reduces DMA writes and dirty pages realistically.2. Migration phase timing (
GET_STATSextension)Add per-VF timestamps:
precopy_start_ns,stopcopy_start_ns,precopy_duration_ns,stopcopy_duration_ns,state_transition_count. Expose viaGET_STATS.3. Hot page simulation (x-mig-hot-pages, uint32, default 0)
Re-set the first N bitmap bits after each
DIRTY_QUERY, simulating workloads with hot pages that prevent convergence.4. Error injection (x-mig-inject-error, uint32, default 0)
One-shot error code injection before command dispatch. A separate x-mig-inject-dma-fail (bool) for persistent DMA failure testing.
* Credits
Alex Williamson suggested the overall approach of a variant driver with the "x-vf-migration" device property to gate the feature. Thanks for the ever ongoing support and valuable discussions throughout these years.
* AI disclaimer
The lack of a migration-capable device has been a recurring pain point for VFIO development over the years, and we hope this proposal demonstrates the value of having one.
Quoted 5 lines
Claude was used to analyze the IGB PF and VF internal state and identify the pain points of a working live migration of such devices. The generated code served as a starting point but *significant* time was then spent cleaning up, reworking, and shaping it into a clear, reviewable IGB model extension.
Below is the raw output from running b4 shazam and asking GPT-6 Astra Ultra to "review each commit," shared here for demonstration. Normally, I review each comment, filter out false positives, and manually assemble the relevant context, but I wanted to provide the unfiltered results this time.
Since you use Claude while I use Codex, I can understand if Codex catches a few things Claude misses, but I didn't expect this volume. Moreover, many of these issues are recurring, following a pattern that hasn't changed over the last two reviews.
I don't believe Claude's core capabilities are too limited to catch these issues. Instead, my hypotheses are:
- Claude is not priotizing working "better, not faster" [1]. While working faster is nice, quality should take precedence, and the current balance may be miscalibrated.
- The model and reasoning effort configuration may be underpowered.
Suggestions for improvement:
- Explicitly ask: "review each commit".
- Pass past review comments as context when asking Claude to perform the review.
- Use the best model and highest reasoning effort configuration for final local reviews before submission.
Regards,
Akihiko Odaki
[1] https://lore.kernel.org/qemu-devel/[email protected]/
---
Reviewed all 17 commits in 615ece3c406b..c5d547be30d8. The series still has migration correctness issues and a qtest regression.
1. **5404e7f4e9ae — Property and DVSEC capability** No actionable finding.
2. **fc515c08615c — Migration blocker**
No actionable finding.
3. **dae704cc51b8 — Migration state machine**
No independent finding. The recovery problem introduced by quiescing
is covered under commit 12.
4. **995983deaea3 — Serialization infrastructure** No independent finding.
5. **207eb305d397 — VF register serialization**
**[P1] Preserve pending mailbox transactions.** The [register
list](hw/net/igb_migration.c:102) saves mailbox control registers but omits VMBMEM, claiming quiescing drains it. No drain occurs. A pending PF reply therefore restores PFSTS with stale destination payload. A focused probe restored PFSTS=1 but read payload 0 instead of 0x12345678. Preserve the transaction or coordinate its completion before saving.
6. **a0e79d2465df — Post-load fixups**
No additional finding.
7. **3509f2eb4600 — TX context serialization**
No additional finding.
8. **c0c5fe9620dd — Receive-address serialization**
**[P1] Reconcile restored addresses with PF allocation state.** The
[free-slot allocation](hw/net/igb_migration.c:284) moves addresses without updating the PF driver’s mac_table. A round trip moved VF0’s MAC from reserved RAR23 to RAR1. The PF still considers RAR1 free, so a subsequent secondary-address allocation can overwrite the migrated VF’s address. Restoring hardware entries alone does not preserve ownership.
9. **bd807329dbca — VLAN filter serialization**
**[P1] Restore PF VLAN bookkeeping alongside VFTA.** The [VFTA
update](hw/net/igb_migration.c:380) leaves the destination PF driver’s shadow_vfta unchanged. For example, restoring VLAN 100 and then adding VLAN 101 through the PF rewrites the same VFTA word from that stale shadow, clearing VLAN 100. The migrated VF then loses tagged traffic despite retaining its VLVF entry.
10. **7694a1bc9d43 — MTA/UTA restoration**
**[P1] The multicast restoration is still temporary.** [OR-ing the
saved MTA](hw/net/igb_migration.c:662) does not restore the PF driver’s per-VF multicast hashes and counts. A later multicast request from another VF rebuilds MTA and the receive-mode bits from those caches, discarding the migrated VF’s configuration. This remains the PF bookkeeping problem discussed in the thread.
11. **efe8749e6477 — Dirty tracking**
**[P1] This intermediate commit does not compile.** The [trace
declarations](hw/net/trace-events:302) change the save/load events to five/four arguments, while their call sites still pass two. Commit 12 fixes the calls; move the declaration changes there.
**[P1] Reject overflowing query ranges.** The [range
check](hw/net/igb_migration.c:1064) adds range_iova + range_size without checking overflow. With tracking enabled for [0, 64 KiB), a query starting at UINT64_MAX - 4095 with size 8192 incorrectly succeeds. Larger wrapped sizes can also truncate the bitmap allocation while leaving bitmap_count_one() scanning the full requested size.
**[P2] Honor the query buffer length.** The [query
handler](hw/net/igb_migration.c:1095) never reads len. A probe advertising only 24 bytes succeeded and overwrote the next 16 bytes with response fields. Validate the header and available bitmap space before writing or clearing dirty bits.
**[P2] Free dirty bitmaps during teardown.** The
[allocations](hw/net/igb_migration.c:961) are released only by explicit disable/state transitions. Neither VF nor PF unrealize cleans them up. Removing a PF with active tracking leaks its bitmaps; repeated hotplug accumulates the allocations.
12. **61cd2a726e1e — Quiescing and enable-state preservation**
**[P1] STOP does not quiesce interrupt DMA.**
[Quiescing](hw/net/igb_migration.c:1289) clears VFRE/VFTE but leaves active EITR timers able to notify MSI-X. A probe observed another MSI memory write after STOP reported QUIESCED. Pending timer notifications need to be stopped and preserved for resume.
**[P2] Error recovery overwrites the saved enable state.** [ERROR →
STOP](hw/net/igb_migration.c:1348) quiesces again even when the VF was already stopped. After RUNNING → STOP → STOP_COPY, a failed SAVE followed by ERROR → STOP → RUNNING replaces the saved RX/TX enables with zero. The probe returned to RUNNING with both directions disabled.
**[P2] Validate the blob before clearing VFLRE.** The [pre-load
operation](hw/net/igb_migration.c:831) consumes the PF’s pending VF-reset indication before validating the blob. A rejected LOAD therefore still changes device state. Move this mutation after successful validation.
13. **4a9d2fed1f04 — Effective interrupt masks**
**[P1] Preserve effective pending causes as well as masks.**
[Restoring masks](hw/net/igb_migration.c:1268) clears the VF’s EICR slice without saving it. A masked pending cause disappeared across a simple STOP → RUNNING cycle, without any migration. Serialize and restore the actual pending causes.
14. **dcffcb07ed87 — Interrupt re-injection**
**[P1] PVTEICR is not the pending-cause state.** The [new
helper](hw/net/igb_core.c:4613) reads a shadow containing the last write-one-to-clear value. It can therefore recreate an already acknowledged interrupt while missing a genuinely pending one. A probe changed effective EICR from zero to 0x400000 after STOP/RUNNING solely because that cause had previously been acknowledged.
15. **01bcf6d4e9d1 — Dirty-tracking statistics** No additional finding.
16. **4eda0478f80d — Testing documentation**
No independent finding. The documentation builds successfully.
17. **c5d547be30d8 — Migration qtests**
**[P1] Restrict registration to supported machines and devices.**
The [registration function](tests/qtest/igb-migration-test.c:867) unconditionally adds tests to the shared qos-test binary, while startup hardcodes q35. Running the new DVSEC test against qemu-system-aarch64 aborts with “unsupported machine type.” Gate registration or use the graph’s machine/device discovery.
The x86_64 and AArch64 binaries, qos-test, and HTML documentation build successfully at the tip. All 31 supplied migration tests pass on x86_64; focused probes reproduce the mailbox, address relocation, range/length validation, interrupt, and recovery failures above. The PF bookkeeping consequences were traced through the Linux driver; full nested guest migration was not run. The worktree remains unchanged.