From patchwork Tue Dec 23 00:36:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 423553 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C979D140082 for ; Tue, 23 Dec 2014 11:38:30 +1100 (AEDT) Received: from localhost ([::1]:42596 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y3DUb-0008CF-1n for incoming@patchwork.ozlabs.org; Mon, 22 Dec 2014 19:38:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y3DTm-0006h4-K5 for qemu-devel@nongnu.org; Mon, 22 Dec 2014 19:37:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y3DTf-0006XC-Pd for qemu-devel@nongnu.org; Mon, 22 Dec 2014 19:37:38 -0500 Received: from s16892447.onlinehome-server.info ([82.165.15.123]:53984) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y3DTM-0006Ov-UO; Mon, 22 Dec 2014 19:37:13 -0500 Received: from 5ec32461.skybroadband.com ([94.195.36.97] helo=kentang.lan) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1Y3DTE-00075O-Nb; Tue, 23 Dec 2014 00:37:05 +0000 From: Mark Cave-Ayland To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, agraf@suse.de Date: Tue, 23 Dec 2014 00:36:15 +0000 Message-Id: <1419294981-17368-2-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1419294981-17368-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1419294981-17368-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 94.195.36.97 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 82.165.15.123 Cc: Mark Cave-Ayland Subject: [Qemu-devel] [PATCH 1/7] macio.c: include parent PCIDevice state in VMStateDescription 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 This ensures that the macio PCI device is correctly configured when restoring from a VM snapshot. Signed-off-by: Mark Cave-Ayland --- hw/misc/macio/macio.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index e0f1e88..9bc3f2d 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -336,20 +336,44 @@ static void macio_instance_init(Object *obj) memory_region_add_subregion(&s->bar, 0x08000, dbdma_mem); } +static const VMStateDescription vmstate_macio_oldworld = { + .name = "macio-oldworld", + .version_id = 0, + .minimum_version_id = 0, + .fields = (VMStateField[]) { + VMSTATE_PCI_DEVICE(parent_obj.parent, OldWorldMacIOState), + VMSTATE_END_OF_LIST() + } +}; + static void macio_oldworld_class_init(ObjectClass *oc, void *data) { PCIDeviceClass *pdc = PCI_DEVICE_CLASS(oc); + DeviceClass *dc = DEVICE_CLASS(oc); pdc->init = macio_oldworld_initfn; pdc->device_id = PCI_DEVICE_ID_APPLE_343S1201; + dc->vmsd = &vmstate_macio_oldworld; } +static const VMStateDescription vmstate_macio_newworld = { + .name = "macio-newworld", + .version_id = 0, + .minimum_version_id = 0, + .fields = (VMStateField[]) { + VMSTATE_PCI_DEVICE(parent_obj.parent, NewWorldMacIOState), + VMSTATE_END_OF_LIST() + } +}; + static void macio_newworld_class_init(ObjectClass *oc, void *data) { PCIDeviceClass *pdc = PCI_DEVICE_CLASS(oc); + DeviceClass *dc = DEVICE_CLASS(oc); pdc->init = macio_newworld_initfn; pdc->device_id = PCI_DEVICE_ID_APPLE_UNI_N_KEYL; + dc->vmsd = &vmstate_macio_newworld; } static Property macio_properties[] = {