From patchwork Thu Jul 17 11:03:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Dovgalyuk X-Patchwork-Id: 371153 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 5C472140093 for ; Thu, 17 Jul 2014 23:50:45 +1000 (EST) Received: from localhost ([::1]:44413 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7m55-0003rP-Hz for incoming@patchwork.ozlabs.org; Thu, 17 Jul 2014 09:50:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7jft-0006jD-7W for qemu-devel@nongnu.org; Thu, 17 Jul 2014 07:16:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X7jT1-0004j0-ML for qemu-devel@nongnu.org; Thu, 17 Jul 2014 07:04:06 -0400 Received: from mail.ispras.ru ([83.149.199.45]:47400) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7jT1-0004i0-An for qemu-devel@nongnu.org; Thu, 17 Jul 2014 07:03:15 -0400 Received: from [10.10.150.172] (unknown [80.250.189.177]) by mail.ispras.ru (Postfix) with ESMTPSA id 83ACF540151; Thu, 17 Jul 2014 15:03:14 +0400 (MSK) To: qemu-devel@nongnu.org From: Pavel Dovgalyuk Date: Thu, 17 Jul 2014 15:03:18 +0400 Message-ID: <20140717110317.8352.46660.stgit@PASHA-ISP> In-Reply-To: <20140717110153.8352.80175.stgit@PASHA-ISP> References: <20140717110153.8352.80175.stgit@PASHA-ISP> User-Agent: StGit/0.16 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 X-Mailman-Approved-At: Thu, 17 Jul 2014 09:36:33 -0400 Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, mark.burton@greensocs.com, real@ispras.ru, batuzovk@ispras.ru, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, fred.konrad@greensocs.com Subject: [Qemu-devel] [RFC PATCH v2 14/49] ide pci: reset status field before loading the vmstate 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 patch resets status field before loading the state of IDE BMDMA device. Resetting status is needed for replay, because it does not reset whole virtual machine before loading state of the VM. Signed-off-by: Pavel Dovgalyuk --- hw/ide/pci.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/hw/ide/pci.c b/hw/ide/pci.c index 6257a21..47ab24d 100644 --- a/hw/ide/pci.c +++ b/hw/ide/pci.c @@ -382,6 +382,15 @@ static bool ide_bmdma_status_needed(void *opaque) return ((bm->status & abused_bits) != 0); } +static int ide_bmdma_pre_load(void *opaque) +{ + BMDMAState *bm = opaque; + /* Reset is not performed in replay mode, + so reset status manually to allow ide_bmdma_post_load function initialize it. */ + bm->status = 0; + return 0; +} + static void ide_bmdma_pre_save(void *opaque) { BMDMAState *bm = opaque; @@ -434,6 +443,7 @@ static const VMStateDescription vmstate_bmdma = { .name = "ide bmdma", .version_id = 3, .minimum_version_id = 0, + .pre_load = ide_bmdma_pre_load, .pre_save = ide_bmdma_pre_save, .fields = (VMStateField[]) { VMSTATE_UINT8(cmd, BMDMAState),