From mboxrd@z Thu Jan 1 00:00:00 1970 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 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> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [RFC PATCH v2 14/49] ide pci: reset status field before loading the vmstate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 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),