From patchwork Tue Jun 15 13:31:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 55671 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 95CA8B7D80 for ; Tue, 15 Jun 2010 23:49:43 +1000 (EST) Received: from localhost ([127.0.0.1]:52738 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OOWVZ-0007sk-9e for incoming@patchwork.ozlabs.org; Tue, 15 Jun 2010 09:48:53 -0400 Received: from [140.186.70.92] (port=53299 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OOWEd-0002x4-MH for qemu-devel@nongnu.org; Tue, 15 Jun 2010 09:31:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OOWEV-0006ux-0e for qemu-devel@nongnu.org; Tue, 15 Jun 2010 09:31:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1025) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OOWEU-0006uo-Mj for qemu-devel@nongnu.org; Tue, 15 Jun 2010 09:31:14 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o5FDVE9S006772 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 15 Jun 2010 09:31:14 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5FDV5KS014460; Tue, 15 Jun 2010 09:31:13 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Tue, 15 Jun 2010 15:31:05 +0200 Message-Id: <31e7e4aefc644057186f501bfef4584d337a4d9c.1276607973.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 5/5] 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 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 */ + } } };