From patchwork Mon Jul 29 00:27:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 262630 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3C4DD2C012A for ; Mon, 29 Jul 2013 10:27:55 +1000 (EST) Received: from localhost ([::1]:53442 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3bJZ-0002f6-47 for incoming@patchwork.ozlabs.org; Sun, 28 Jul 2013 20:27:53 -0400 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 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 792BEA51FE; Mon, 29 Jul 2013 02:27:10 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Mon, 29 Jul 2013 02:27:00 +0200 Message-Id: <1375057621-19961-6-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.8.1.4 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 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: Gerd Hoffmann , =?UTF-8?q?Andreas=20F=C3=A4rber?= , "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH qom-next for-next v2 5/6] pci: Move vmstate_pcie_aer_log into vmstate_pci_device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Make it conditional on PCIe and allocation of the AER log. Signed-off-by: Andreas Färber --- 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 = { .post_load = pcie_cap_slot_post_load, .fields = (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_downstream.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_downstream = { .post_load = pcie_cap_slot_post_load, .fields = (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_upstream.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_upstream = { .minimum_version_id_old = 1, .fields = (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 *opaque, int version_id) return !pci_is_express(s); } +static bool pci_device_aer_needed(void *opaque, int version_id) +{ + PCIDevice *s = opaque; + + return pci_is_express(s) && s->exp.aer_log.log != NULL; +} + const VMStateDescription vmstate_pci_device = { .name = "PCIDevice", .version_id = 2, @@ -492,6 +499,8 @@ const VMStateDescription vmstate_pci_device = { 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_needed, 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 = NULL; } static void pcie_aer_update_uncor_status(PCIDevice *dev)