@@ -477,6 +477,13 @@ const VMStateDescription vmstate_pci_device = {
}
};
+static bool pcie_msix_needed(void *opaque)
+{
+ PCIDevice *s = opaque;
+
+ return msix_present(s);
+}
+
const VMStateDescription vmstate_pcie_device = {
.name = "PCIEDevice",
.version_id = 2,
@@ -493,6 +500,13 @@ const VMStateDescription vmstate_pcie_device = {
VMSTATE_STRUCT(exp.aer_log, PCIDevice, 0,
vmstate_pcie_aer_log, PCIEAERLog),
VMSTATE_END_OF_LIST()
+ },
+ .subsections = (VMStateSubsection[]) {
+ {
+ .vmsd = &vmstate_msix,
+ .needed = pcie_msix_needed,
+ }, {
+ }
}
};
@@ -3545,7 +3545,6 @@ static const VMStateDescription vmstate_xhci = {
.post_load = usb_xhci_post_load,
.fields = (VMStateField[]) {
VMSTATE_PCIE_DEVICE(parent_obj, XHCIState),
- VMSTATE_MSIX(parent_obj, XHCIState),
VMSTATE_STRUCT_VARRAY_UINT32(ports, XHCIState, numports, 1,
vmstate_xhci_port, XHCIPort),
Instead of having devices like XHCI manually add VMSTATE_MSIX() fields, reuse vmstate_msix as subsection in VMSTATE_PCIE_DEVICE(), dependent on msix_present(). XHCI is the only user of VMSTATE_MSIX() and the only PCIe user of msix_init[_exclusive_bar](). XHCI was marked unmigratable in v1.5.0, so perform this change before 1.6. Signed-off-by: Andreas Färber <afaerber@suse.de> --- hw/pci/pci.c | 14 ++++++++++++++ hw/usb/hcd-xhci.c | 1 - 2 files changed, 14 insertions(+), 1 deletion(-)