qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] esp: fix migration version check in esp_is_version_5()


From: Paolo Bonzini
Subject: Re: [PATCH] esp: fix migration version check in esp_is_version_5()
Date: Mon, 14 Jun 2021 10:15:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1

On 13/06/21 12:26, Mark Cave-Ayland wrote:
Commit 4e78f3bf35 "esp: defer command completion interrupt on incoming data
transfers" added a version check for use with VMSTATE_*_TEST macros to allow
migration from older QEMU versions. Unfortunately the version check fails to
work in its current form since if the VMStateDescription version_id is
incremented, the test returns false and so the fields are not included in the
outgoing migration stream.

Change the version check to use >= rather == to ensure that migration works
correctly when the ESPState VMStateDescription has version_id > 5.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Fixes: 4e78f3bf35 ("esp: defer command completion interrupt on incoming data 
transfers")
---
  hw/scsi/esp.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index bfdb94292b..39756ddd99 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -1120,7 +1120,7 @@ static bool esp_is_version_5(void *opaque, int version_id)
      ESPState *s = ESP(opaque);
version_id = MIN(version_id, s->mig_version_id);
-    return version_id == 5;
+    return version_id >= 5;
  }
int esp_pre_save(void *opaque)


You can use the _V version of the macros and get rid of this function altogether. VMSTATE_FIFO8_TEST is not used outside esp.c so it can also be replaced with VMSTATE_FIFO8_V, just initializing .version_id in place of .field_exists.

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]