|
|
9ae3a8 |
From 5cd8edcba7977ebc8973af8a894716f3915e1dc7 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Date: Wed, 19 Mar 2014 05:33:14 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 2/2] scsi: Fix migration of scsi sense data
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1395207194-25330-3-git-send-email-famz@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 58140
|
|
|
9ae3a8 |
O-Subject: [RHEL-7 qemu-kvm PATCH v2 2/2] scsi: Fix migration of scsi sense data
|
|
|
9ae3a8 |
Bugzilla: 1058173
|
|
|
9ae3a8 |
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
c5f52875 changed the size of sense array in vmstate_scsi_device by
|
|
|
9ae3a8 |
mistake. This patch restores the old size, and add a subsection for the
|
|
|
9ae3a8 |
remaining part of the buffer size. So that migration is not broken.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 2e323f03bfa323636552b386c982412944ff86ae)
|
|
|
9ae3a8 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/scsi/scsi-bus.c | 30 +++++++++++++++++++++++++++++-
|
|
|
9ae3a8 |
include/hw/scsi/scsi.h | 1 +
|
|
|
9ae3a8 |
include/migration/vmstate.h | 3 +++
|
|
|
9ae3a8 |
3 files changed, 33 insertions(+), 1 deletion(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/scsi/scsi-bus.c | 30 +++++++++++++++++++++++++++++-
|
|
|
9ae3a8 |
include/hw/scsi/scsi.h | 1 +
|
|
|
9ae3a8 |
include/migration/vmstate.h | 3 +++
|
|
|
9ae3a8 |
3 files changed, 33 insertions(+), 1 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
|
|
|
9ae3a8 |
index a0fbf06..77e0c10 100644
|
|
|
9ae3a8 |
--- a/hw/scsi/scsi-bus.c
|
|
|
9ae3a8 |
+++ b/hw/scsi/scsi-bus.c
|
|
|
9ae3a8 |
@@ -1874,6 +1874,26 @@ static const VMStateInfo vmstate_info_scsi_requests = {
|
|
|
9ae3a8 |
.put = put_scsi_requests,
|
|
|
9ae3a8 |
};
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+static bool scsi_sense_state_needed(void *opaque)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ SCSIDevice *s = opaque;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ return s->sense_len > SCSI_SENSE_BUF_SIZE_OLD;
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+static const VMStateDescription vmstate_scsi_sense_state = {
|
|
|
9ae3a8 |
+ .name = "SCSIDevice/sense",
|
|
|
9ae3a8 |
+ .version_id = 1,
|
|
|
9ae3a8 |
+ .minimum_version_id = 1,
|
|
|
9ae3a8 |
+ .minimum_version_id_old = 1,
|
|
|
9ae3a8 |
+ .fields = (VMStateField []) {
|
|
|
9ae3a8 |
+ VMSTATE_UINT8_SUB_ARRAY(sense, SCSIDevice,
|
|
|
9ae3a8 |
+ SCSI_SENSE_BUF_SIZE_OLD,
|
|
|
9ae3a8 |
+ SCSI_SENSE_BUF_SIZE - SCSI_SENSE_BUF_SIZE_OLD),
|
|
|
9ae3a8 |
+ VMSTATE_END_OF_LIST()
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+};
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
const VMStateDescription vmstate_scsi_device = {
|
|
|
9ae3a8 |
.name = "SCSIDevice",
|
|
|
9ae3a8 |
.version_id = 1,
|
|
|
9ae3a8 |
@@ -1884,7 +1904,7 @@ const VMStateDescription vmstate_scsi_device = {
|
|
|
9ae3a8 |
VMSTATE_UINT8(unit_attention.asc, SCSIDevice),
|
|
|
9ae3a8 |
VMSTATE_UINT8(unit_attention.ascq, SCSIDevice),
|
|
|
9ae3a8 |
VMSTATE_BOOL(sense_is_ua, SCSIDevice),
|
|
|
9ae3a8 |
- VMSTATE_UINT8_ARRAY(sense, SCSIDevice, SCSI_SENSE_BUF_SIZE),
|
|
|
9ae3a8 |
+ VMSTATE_UINT8_SUB_ARRAY(sense, SCSIDevice, 0, SCSI_SENSE_BUF_SIZE_OLD),
|
|
|
9ae3a8 |
VMSTATE_UINT32(sense_len, SCSIDevice),
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
.name = "requests",
|
|
|
9ae3a8 |
@@ -1896,6 +1916,14 @@ const VMStateDescription vmstate_scsi_device = {
|
|
|
9ae3a8 |
.offset = 0,
|
|
|
9ae3a8 |
},
|
|
|
9ae3a8 |
VMSTATE_END_OF_LIST()
|
|
|
9ae3a8 |
+ },
|
|
|
9ae3a8 |
+ .subsections = (VMStateSubsection []) {
|
|
|
9ae3a8 |
+ {
|
|
|
9ae3a8 |
+ .vmsd = &vmstate_scsi_sense_state,
|
|
|
9ae3a8 |
+ .needed = scsi_sense_state_needed,
|
|
|
9ae3a8 |
+ }, {
|
|
|
9ae3a8 |
+ /* empty */
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
};
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
|
|
|
9ae3a8 |
index 4a1de1b..b0d6e8f 100644
|
|
|
9ae3a8 |
--- a/include/hw/scsi/scsi.h
|
|
|
9ae3a8 |
+++ b/include/hw/scsi/scsi.h
|
|
|
9ae3a8 |
@@ -31,6 +31,7 @@ typedef struct SCSISense {
|
|
|
9ae3a8 |
uint8_t ascq;
|
|
|
9ae3a8 |
} SCSISense;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+#define SCSI_SENSE_BUF_SIZE_OLD 96
|
|
|
9ae3a8 |
#define SCSI_SENSE_BUF_SIZE 252
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
struct SCSICommand {
|
|
|
9ae3a8 |
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
|
|
|
9ae3a8 |
index ebc4d09..11d93e1 100644
|
|
|
9ae3a8 |
--- a/include/migration/vmstate.h
|
|
|
9ae3a8 |
+++ b/include/migration/vmstate.h
|
|
|
9ae3a8 |
@@ -625,6 +625,9 @@ extern const VMStateInfo vmstate_info_bitmap;
|
|
|
9ae3a8 |
#define VMSTATE_UINT8_ARRAY(_f, _s, _n) \
|
|
|
9ae3a8 |
VMSTATE_UINT8_ARRAY_V(_f, _s, _n, 0)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+#define VMSTATE_UINT8_SUB_ARRAY(_f, _s, _start, _num) \
|
|
|
9ae3a8 |
+ VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint8, uint8_t)
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
#define VMSTATE_UINT8_2DARRAY(_f, _s, _n1, _n2) \
|
|
|
9ae3a8 |
VMSTATE_UINT8_2DARRAY_V(_f, _s, _n1, _n2, 0)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|