From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57769) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3FzC-0003y2-3a for qemu-devel@nongnu.org; Sat, 27 Jul 2013 21:41:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V3Fz4-0003Fe-R0 for qemu-devel@nongnu.org; Sat, 27 Jul 2013 21:41:26 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49440 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3Fz4-0003FW-Kk for qemu-devel@nongnu.org; Sat, 27 Jul 2013 21:41:18 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 28 Jul 2013 03:41:09 +0200 Message-Id: <1374975670-8820-3-git-send-email-afaerber@suse.de> In-Reply-To: <1374975670-8820-1-git-send-email-afaerber@suse.de> References: <1374975670-8820-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH RFC for-1.6 qom-next 2/3] pci: Add MSIX subsection for vmstate_pcie_device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , Gerd Hoffmann , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Juan Quintela 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=C3=A4rber --- hw/pci/pci.c | 14 ++++++++++++++ hw/usb/hcd-xhci.c | 1 - 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 51ec4f7..b69421a 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -477,6 +477,13 @@ const VMStateDescription vmstate_pci_device =3D { } }; =20 +static bool pcie_msix_needed(void *opaque) +{ + PCIDevice *s =3D opaque; + + return msix_present(s); +} + const VMStateDescription vmstate_pcie_device =3D { .name =3D "PCIEDevice", .version_id =3D 2, @@ -493,6 +500,13 @@ const VMStateDescription vmstate_pcie_device =3D { VMSTATE_STRUCT(exp.aer_log, PCIDevice, 0, vmstate_pcie_aer_log, PCIEAERLog), VMSTATE_END_OF_LIST() + }, + .subsections =3D (VMStateSubsection[]) { + { + .vmsd =3D &vmstate_msix, + .needed =3D pcie_msix_needed, + }, { + } } }; =20 diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 9ba3e3e..c9c29b7 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -3545,7 +3545,6 @@ static const VMStateDescription vmstate_xhci =3D { .post_load =3D usb_xhci_post_load, .fields =3D (VMStateField[]) { VMSTATE_PCIE_DEVICE(parent_obj, XHCIState), - VMSTATE_MSIX(parent_obj, XHCIState), =20 VMSTATE_STRUCT_VARRAY_UINT32(ports, XHCIState, numports, 1, vmstate_xhci_port, XHCIPort), --=20 1.8.1.4