Skip to contentSkip to conversation

vfio/migration: Fix wrong enum usage

PATCH In review Avihai Horon 2 participants 3 messages Oct 16, 2022 – Oct 18, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfio/migration: Fix wrong enum usage

vfio_migration_init() initializes VFIOMigration->device_state using enum of VFIO migration protocol v2. Current implemented protocol is v1 so v1 enum should be used. Fix it.

Fixes 429c72800654 ("vfio/migration: Fix incorrect initialization value for parameters in VFIOMigration")
---
 hw/vfio/migration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio/migration.c +1 -1
index d9598ce070..8dbbfa2c56 100644
@@ -803,7 +803,7 @@ static int vfio_migration_init(VFIODevice *vbasedev,
     }
 
     vbasedev->migration = g_new0(VFIOMigration, 1);
-    vbasedev->migration->device_state = VFIO_DEVICE_STATE_RUNNING;
+    vbasedev->migration->device_state = VFIO_DEVICE_STATE_V1_RUNNING;
     vbasedev->migration->vm_running = runstate_is_running();
 
     ret = vfio_region_setup(obj, vbasedev, &vbasedev->migration->region,
Signature · 1 line
2.21.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines

-----Original Message-----
From: Qemu-devel <[email protected]> On Behalf Of Avihai Horon
Sent: Sunday, October 16, 2022 4:58 PM
To: [email protected]; Alex Williamson <[email protected]>; Kunkun Jiang <[email protected]>
Cc: Avihai Horon <[email protected]>
Subject: [PATCH] vfio/migration: Fix wrong enum usage

Quoted 7 lines

vfio_migration_init() initializes VFIOMigration->device_state using enum of VFIO migration protocol v2. Current implemented protocol is v1 so v1 enum should be used. Fix it.

Fixes 429c72800654 ("vfio/migration: Fix incorrect initialization value for

parameters in VFIOMigration")

Looks good to me.

But I found nowhere using the enum of VFIO migration protocol v2 (vfio_device_mig_state). I don't know more about the background, should we remove the redundancy definition or add full support for the VFIO migration protocol v2 ?

Thanks
Chen

Quoted 20 lines
---
 hw/vfio/migration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio/migration.c index renamed from hw/vfio/migration.c +0 -0

d9598ce070..8dbbfa2c56 100644

hw/vfio/migration.c +1 -2
@@ -803,7 +803,7 @@ static int vfio_migration_init(VFIODevice *vbasedev,
     }
 
     vbasedev->migration = g_new0(VFIOMigration, 1);
-    vbasedev->migration->device_state = VFIO_DEVICE_STATE_RUNNING;
+    vbasedev->migration->device_state = VFIO_DEVICE_STATE_V1_RUNNING;
     vbasedev->migration->vm_running = runstate_is_running();
 
     ret = vfio_region_setup(obj, vbasedev, &vbasedev->migration->region,
--

2.21.3

#2 lore raw
Quoted 19 lines · Chen

External email: Use caution opening links or attachments

Quoted 9 lines

-----Original Message-----
From: Qemu-devel <[email protected]> On Behalf Of Avihai Horon
Sent: Sunday, October 16, 2022 4:58 PM
To: [email protected]; Alex Williamson <[email protected]>; Kunkun Jiang <[email protected]>
Cc: Avihai Horon <[email protected]>
Subject: [PATCH] vfio/migration: Fix wrong enum usage

Quoted 7 lines

vfio_migration_init() initializes VFIOMigration->device_state using enum of VFIO migration protocol v2. Current implemented protocol is v1 so v1 enum should be used. Fix it.

Fixes 429c72800654 ("vfio/migration: Fix incorrect initialization value for

parameters in VFIOMigration")

Quoted 6 lines

Looks good to me.

But I found nowhere using the enum of VFIO migration protocol v2 (vfio_device_mig_state). I don't know more about the background, should we remove the redundancy definition or add full support for the VFIO migration protocol v2 ?

We are currently in the process of adding support for v2 protocol that will replace v1. Once v2 is added, v1 will be removed.

Thanks.

Quoted 24 lines

Thanks
Chen

Quoted 20 lines
---
  hw/vfio/migration.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio/migration.c index renamed from hw/vfio/migration.c +0 -0

d9598ce070..8dbbfa2c56 100644

hw/vfio/migration.c +1 -2
@@ -803,7 +803,7 @@ static int vfio_migration_init(VFIODevice *vbasedev,
      }
 
      vbasedev->migration = g_new0(VFIOMigration, 1);
-    vbasedev->migration->device_state = VFIO_DEVICE_STATE_RUNNING;
+    vbasedev->migration->device_state = VFIO_DEVICE_STATE_V1_RUNNING;
      vbasedev->migration->vm_running = runstate_is_running();
 
      ret = vfio_region_setup(obj, vbasedev, &vbasedev->migration->region,
--

2.21.3