Received: from eggs.gnu.org ([2001:4830:134:3::10]:45267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3bJ0-0002bg-1M for qemu-devel@nongnu.org; Sun, 28 Jul 2013 20:27:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V3bIt-0003E2-8C for qemu-devel@nongnu.org; Sun, 28 Jul 2013 20:27:17 -0400 Received: from cantor2.suse.de ([195.135.220.15]:44761 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3bIs-0003Dw-VR for qemu-devel@nongnu.org; Sun, 28 Jul 2013 20:27:11 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Mon, 29 Jul 2013 02:27:00 +0200 Message-Id: <1375057621-19961-6-git-send-email-afaerber@suse.de> In-Reply-To: <1375057621-19961-1-git-send-email-afaerber@suse.de> References: <1375057621-19961-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 qom-next for-next v2 5/6] pci: Move vmstate_pcie_aer_log into vmstate_pci_device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Andreas=20F=C3=A4rber?= , "Michael S. Tsirkin" Make it conditional on PCIe and allocation of the AER log. Signed-off-by: Andreas F=C3=A4rber --- hw/pci-bridge/ioh3420.c | 2 -- hw/pci-bridge/xio3130_downstream.c | 2 -- hw/pci-bridge/xio3130_upstream.c | 2 -- hw/pci/pci.c | 9 +++++++++ hw/pci/pcie_aer.c | 1 + 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/hw/pci-bridge/ioh3420.c b/hw/pci-bridge/ioh3420.c index 680a13d..bf92884 100644 --- a/hw/pci-bridge/ioh3420.c +++ b/hw/pci-bridge/ioh3420.c @@ -188,8 +188,6 @@ static const VMStateDescription vmstate_ioh3420 =3D { .post_load =3D pcie_cap_slot_post_load, .fields =3D (VMStateField[]) { VMSTATE_PCI_DEVICE(), - VMSTATE_STRUCT(parent_obj.parent_obj.parent_obj.exp.aer_log, - PCIESlot, 0, vmstate_pcie_aer_log, PCIEAERLog), VMSTATE_END_OF_LIST() } }; diff --git a/hw/pci-bridge/xio3130_downstream.c b/hw/pci-bridge/xio3130_d= ownstream.c index 3fa4ec2..bf7099d 100644 --- a/hw/pci-bridge/xio3130_downstream.c +++ b/hw/pci-bridge/xio3130_downstream.c @@ -155,8 +155,6 @@ static const VMStateDescription vmstate_xio3130_downs= tream =3D { .post_load =3D pcie_cap_slot_post_load, .fields =3D (VMStateField[]) { VMSTATE_PCI_DEVICE(), - VMSTATE_STRUCT(parent_obj.parent_obj.parent_obj.exp.aer_log, - PCIESlot, 0, vmstate_pcie_aer_log, PCIEAERLog), VMSTATE_END_OF_LIST() } }; diff --git a/hw/pci-bridge/xio3130_upstream.c b/hw/pci-bridge/xio3130_ups= tream.c index 0edacc3..b564c7f 100644 --- a/hw/pci-bridge/xio3130_upstream.c +++ b/hw/pci-bridge/xio3130_upstream.c @@ -134,8 +134,6 @@ static const VMStateDescription vmstate_xio3130_upstr= eam =3D { .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_PCI_DEVICE(), - VMSTATE_STRUCT(parent_obj.parent_obj.exp.aer_log, PCIEPort, 0, - vmstate_pcie_aer_log, PCIEAERLog), VMSTATE_END_OF_LIST() } }; diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 6461c9d..b790d98 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -474,6 +474,13 @@ static bool pci_device_non_express_needed(void *opaq= ue, int version_id) return !pci_is_express(s); } =20 +static bool pci_device_aer_needed(void *opaque, int version_id) +{ + PCIDevice *s =3D opaque; + + return pci_is_express(s) && s->exp.aer_log.log !=3D NULL; +} + const VMStateDescription vmstate_pci_device =3D { .name =3D "PCIDevice", .version_id =3D 2, @@ -492,6 +499,8 @@ const VMStateDescription vmstate_pci_device =3D { VMSTATE_BUFFER_UNSAFE_INFO(irq_state, PCIDevice, 2, vmstate_info_pci_irq_state, PCI_NUM_PINS * sizeof(int32_t)), + VMSTATE_STRUCT_TEST(exp.aer_log, PCIDevice, pci_device_aer_neede= d, 0, + vmstate_pcie_aer_log, PCIEAERLog), VMSTATE_END_OF_LIST() } }; diff --git a/hw/pci/pcie_aer.c b/hw/pci/pcie_aer.c index ca762ab..2767ebc 100644 --- a/hw/pci/pcie_aer.c +++ b/hw/pci/pcie_aer.c @@ -166,6 +166,7 @@ int pcie_aer_init(PCIDevice *dev, uint16_t offset) void pcie_aer_exit(PCIDevice *dev) { g_free(dev->exp.aer_log.log); + dev->exp.aer_log.log =3D NULL; } =20 static void pcie_aer_update_uncor_status(PCIDevice *dev) --=20 1.8.1.4