Skip to contentSkip to conversation

mptsas: really fix migration compatibility

PATCH In review Paolo Bonzini 2 participants 2 messages Aug 2, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mptsas: really fix migration compatibility

Commit 2e2aa316 removed internal flag msi_in_use, but it existed in vmstate. Restore it for migration to older QEMU versions.

Cc Markus Armbruster <[email protected]>
Cc Marcel Apfelbaum <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Amit Shah <[email protected]>
Cc Cao jin <[email protected]>
---
 hw/scsi/mptsas.c | 4 +++-
 hw/scsi/mptsas.h | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)
hw/scsi/mptsas.c +3 -1
index bebe513..0e0a22f 100644
@@ -1295,6 +1295,8 @@ static void mptsas_scsi_init(PCIDevice *dev, Error **errp)
         /* With msi=auto, we fall back to MSI off silently */
         error_free(err);
 
+        /* Only used for migration.  */
+        s->msi_in_use = (ret == 0);
     }
 
     memory_region_init_io(&s->mmio_io, OBJECT(s), &mptsas_mmio_ops, s,
@@ -1370,7 +1372,7 @@ static const VMStateDescription vmstate_mptsas = {
     .post_load = mptsas_post_load,
     .fields      = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(dev, MPTSASState),
-        VMSTATE_UNUSED(sizeof(bool)), /* Was msi_in_use */
+        VMSTATE_BOOL(msi_in_use, MPTSASState),
         VMSTATE_UINT32(state, MPTSASState),
         VMSTATE_UINT8(who_init, MPTSASState),
         VMSTATE_UINT8(doorbell_state, MPTSASState),
hw/scsi/mptsas.h +2 -0
index da014a3..0436a33 100644
@@ -31,6 +31,8 @@ struct MPTSASState {
     OnOffAuto msi;
     uint64_t sas_addr;
 
+    bool msi_in_use;
+
     /* Doorbell register */
     uint32_t state;
     uint8_t who_init;
Signature · 1 line
2.7.4
#1 lore raw
Quoted 46 lines · Paolo Bonzini

Commit 2e2aa316 removed internal flag msi_in_use, but it existed in vmstate. Restore it for migration to older QEMU versions.

Cc Markus Armbruster <[email protected]>
Cc Marcel Apfelbaum <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Amit Shah <[email protected]>
Cc Cao jin <[email protected]>
---
  hw/scsi/mptsas.c | 4 +++-
  hw/scsi/mptsas.h | 2 ++
  2 files changed, 5 insertions(+), 1 deletion(-)
hw/scsi/mptsas.c +3 -1
index bebe513..0e0a22f 100644
@@ -1295,6 +1295,8 @@ static void mptsas_scsi_init(PCIDevice *dev, Error **errp)
          /* With msi=auto, we fall back to MSI off silently */
          error_free(err);
 
+        /* Only used for migration.  */
+        s->msi_in_use = (ret == 0);
      }
 
      memory_region_init_io(&s->mmio_io, OBJECT(s), &mptsas_mmio_ops, s,
@@ -1370,7 +1372,7 @@ static const VMStateDescription vmstate_mptsas = {
      .post_load = mptsas_post_load,
      .fields      = (VMStateField[]) {
          VMSTATE_PCI_DEVICE(dev, MPTSASState),
-        VMSTATE_UNUSED(sizeof(bool)), /* Was msi_in_use */
+        VMSTATE_BOOL(msi_in_use, MPTSASState),
          VMSTATE_UINT32(state, MPTSASState),
          VMSTATE_UINT8(who_init, MPTSASState),
          VMSTATE_UINT8(doorbell_state, MPTSASState),
hw/scsi/mptsas.h +0 -0
index da014a3..0436a33 100644

hw/scsi/mptsas.h struct MPTSASState { · line 38

Quoted 8 lines
hw/scsi/mptsas.h +2 -0
@@ -31,6 +31,8 @@ struct MPTSASState {
      OnOffAuto msi;
      uint64_t sas_addr;
 
+    bool msi_in_use;
+
      /* Doorbell register */
      uint32_t state;
      uint8_t who_init;

Thanks for saving my mistake.
Just FYI: there is a superfluous newline in mptsas_scsi_init() made by me, maybe is handy to remove.

Signature · 3 lines
Yours Sincerely,

Cao jin