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