From patchwork Mon Jul 26 19:38:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 59941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C7279B70A6 for ; Tue, 27 Jul 2010 05:46:22 +1000 (EST) Received: from localhost ([127.0.0.1]:36143 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdTcx-00063D-Ah for incoming@patchwork.ozlabs.org; Mon, 26 Jul 2010 15:46:19 -0400 Received: from [140.186.70.92] (port=54145 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdTXA-0003w0-F7 for qemu-devel@nongnu.org; Mon, 26 Jul 2010 15:40:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OdTX8-0007Td-Hu for qemu-devel@nongnu.org; Mon, 26 Jul 2010 15:40:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:10335) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OdTX8-0007TT-6X for qemu-devel@nongnu.org; Mon, 26 Jul 2010 15:40:18 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o6QJeF3H020227 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 26 Jul 2010 15:40:15 -0400 Received: from trasno.mitica (ovpn-113-23.phx2.redhat.com [10.3.113.23]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6QJe73U016073; Mon, 26 Jul 2010 15:40:14 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 26 Jul 2010 21:38:45 +0200 Message-Id: <4b09db62eba14ef3624f284ea28a64741f65acb3.1280172745.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Subject: [Qemu-devel] [PATCH 5/6] ide: fix migration in the middle of a bmdma transfer X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org It reintroduces Revert "ide save/restore pio/atapi cmd transfer fields and io buffer" but using subsections. Added bonus is the addition of ide_dummy_transfer_stop to transfer_end_table, that was missing. Signed-off-by: Juan Quintela --- hw/ide/pci.c | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-) diff --git a/hw/ide/pci.c b/hw/ide/pci.c index 780fc5f..4331d77 100644 --- a/hw/ide/pci.c +++ b/hw/ide/pci.c @@ -121,6 +121,28 @@ void bmdma_addr_writel(void *opaque, uint32_t addr, uint32_t val) bm->cur_addr = bm->addr; } +static bool ide_bmdma_current_needed(void *opaque) +{ + BMDMAState *bm = opaque; + + return (bm->cur_prd_len != 0); +} + +static const VMStateDescription vmstate_bmdma_current = { + .name = "ide bmdma_current", + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .fields = (VMStateField []) { + VMSTATE_UINT32(cur_addr, BMDMAState), + VMSTATE_UINT32(cur_prd_last, BMDMAState), + VMSTATE_UINT32(cur_prd_addr, BMDMAState), + VMSTATE_UINT32(cur_prd_len, BMDMAState), + VMSTATE_END_OF_LIST() + } +}; + + static const VMStateDescription vmstate_bmdma = { .name = "ide bmdma", .version_id = 3, @@ -134,6 +156,14 @@ static const VMStateDescription vmstate_bmdma = { VMSTATE_UINT32(nsector, BMDMAState), VMSTATE_UINT8(unit, BMDMAState), VMSTATE_END_OF_LIST() + }, + .subsections = (VMStateSubsection []) { + { + .vmsd = &vmstate_bmdma_current, + .needed = ide_bmdma_current_needed, + }, { + /* empty */ + } } };