From patchwork Mon Jun 20 14:33:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 9187817 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BA7E06075F for ; Mon, 20 Jun 2016 15:30:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA01C2793B for ; Mon, 20 Jun 2016 15:30:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9EDF727A98; Mon, 20 Jun 2016 15:30:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3A2CD2793B for ; Mon, 20 Jun 2016 15:30:19 +0000 (UTC) Received: from localhost ([::1]:44363 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF19V-0000Ei-QO for patchwork-qemu-devel@patchwork.kernel.org; Mon, 20 Jun 2016 11:30:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF0Gb-0004g3-1C for qemu-devel@nongnu.org; Mon, 20 Jun 2016 10:33:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bF0GX-0003yI-8w for qemu-devel@nongnu.org; Mon, 20 Jun 2016 10:33:31 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:33526) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF0GX-0003yE-2I for qemu-devel@nongnu.org; Mon, 20 Jun 2016 10:33:29 -0400 Received: by mail-wm0-x242.google.com with SMTP id r201so14583974wme.0 for ; Mon, 20 Jun 2016 07:33:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=kJXWebQkqqpuehNcF2nQocu+qMdkT/Alwj5q3irL3tk=; b=0cNyvNBILNxHNyp2gFsYhOjdEg6ObKuSeHEjJV2Lh6/w+7JFqYLm3BQl+VUgM0DKxp HMrGDpRRS9qldbqyZN3biscGRWWE32szQfdgjo8qsZbYQeynCDH5H9Q71LAvA1QzGmo0 M0tv/enOWFoZUNP6gFTkdvYiUAFBlhwuVIhCta2E8KHBw2fOA6NOIPW2lo/iT5aK4CqY Eiq65aV9+VHep2kYMRlM5rf1zyYhmioOXLBjFrwWjgBp7bCOjlej0tX5ntdVBJXVDWYb zqclUyntI/OcOFuopLfcMSXWw00dMm3FWHW268ojM7wTx7+N3UNGWnN+HG/RBQjW1z50 rUPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=kJXWebQkqqpuehNcF2nQocu+qMdkT/Alwj5q3irL3tk=; b=CoNiIK09qs+fels/qBt/qi9aQH/y2RR3Dgisar+dXnwty7Ox+JHUft+BPdNZkRcVUj oInImuroe1NsNMX0ynxqVe64ZhDmrHNAJcKodG7GAgNoAURkRqNVFw/NqyYCdSHw/Nqp ed+vT19vaZBNwKpbSSuYOagKRNvVPvVMgYRV6aWyFhzIBAxBUImeNWogEjwIiCq7VC4w iebsv2zzpwDuybHtJ3aPRbJppgP9r4WBMER5CrDaBH3EHReNEqDy1JQ8P+BKEXehYr/W w7jODhIirzNUZ7a9eGu8xY+ZmjoCWLm5Cq1Rw4hoeWUhXzp55/rGXb5BxgU+sSNd8sbd aGXg== X-Gm-Message-State: ALyK8tLcpkc1C7wa+wF+27TLkLhIHPlKus6SyvtTHy86wuRHmubEmIfTsP2+6/MSjLonOQ== X-Received: by 10.28.11.79 with SMTP id 76mr4985109wml.91.1466433208157; Mon, 20 Jun 2016 07:33:28 -0700 (PDT) Received: from donizetti.lan (94-39-188-118.adsl-ull.clienti.tiscali.it. [94.39.188.118]) by smtp.gmail.com with ESMTPSA id bo1sm34345753wjb.35.2016.06.20.07.33.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jun 2016 07:33:27 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 20 Jun 2016 16:33:26 +0200 Message-Id: <1466433206-29241-1-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 2.5.5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PATCH] scsi: esp: fix migration X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: amit.shah@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Commit 926cde5 ("scsi: esp: make cmdbuf big enough for maximum CDB size", 2016-06-16) changed the size of a migrated field. Split it in two parts, and only migrate the second part in a new vmstate version. Signed-off-by: Paolo Bonzini --- hw/scsi/esp.c | 5 +++-- include/migration/vmstate.h | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index baa0a2c..1f2f2d3 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -574,7 +574,7 @@ static bool esp_mem_accepts(void *opaque, hwaddr addr, const VMStateDescription vmstate_esp = { .name ="esp", - .version_id = 3, + .version_id = 4, .minimum_version_id = 3, .fields = (VMStateField[]) { VMSTATE_BUFFER(rregs, ESPState), @@ -585,7 +585,8 @@ const VMStateDescription vmstate_esp = { VMSTATE_BUFFER(ti_buf, ESPState), VMSTATE_UINT32(status, ESPState), VMSTATE_UINT32(dma, ESPState), - VMSTATE_BUFFER(cmdbuf, ESPState), + VMSTATE_PARTIAL_BUFFER(cmdbuf, ESPState, 16), + VMSTATE_BUFFER_START_MIDDLE_V(cmdbuf, ESPState, 16, 4), VMSTATE_UINT32(cmdlen, ESPState), VMSTATE_UINT32(do_cmd, ESPState), VMSTATE_UINT32(dma_left, ESPState), diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 6c65811..187c931 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -898,8 +898,11 @@ extern const VMStateInfo vmstate_info_bitmap; #define VMSTATE_PARTIAL_BUFFER(_f, _s, _size) \ VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, 0, _size) +#define VMSTATE_BUFFER_START_MIDDLE_V(_f, _s, _start, _v) \ + VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, _start, sizeof(typeof_field(_s, _f))) + #define VMSTATE_BUFFER_START_MIDDLE(_f, _s, _start) \ - VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, _start, sizeof(typeof_field(_s, _f))) + VMSTATE_BUFFER_START_MIDDLE_V(_f, _s, _start, 0) #define VMSTATE_PARTIAL_VBUFFER(_f, _s, _size) \ VMSTATE_VBUFFER(_f, _s, 0, NULL, 0, _size)