Skip to contentSkip to conversation

hw/vfio: cpr-iommufd: Fix wrong usage of migrate_add_blocker_modes

PATCH In review Jim Shu 2 participants 2 messages Jan 21

lore
Share & tools
lore

Jim Shu

author
#0 lore raw

PATCH 1/1 hw/vfio: cpr-iommufd: Fix wrong usage of migrate_add_blocker_modes

The return value of API is 0 for success and negative error code for failure. We'll check if the return value equals to 0. Also, the MIG_MODE should be CPR_TRANSFER and CPR_EXEC instead of 2 same bits.

The API usage is aligned with 'hw/vfio/cpr-legacy.c' after these 2 changes.

Fixes 3ca0a0ab05c ("migration: Use bitset of MigMode instead of variable arguments")
---
 hw/vfio/cpr-iommufd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/vfio/cpr-iommufd.c +2 -2
index c244db88fbb..6758c73b6b9 100644
@@ -159,8 +159,8 @@ bool vfio_iommufd_cpr_register_iommufd(IOMMUFDBackend *be, Error **errp)
 
     if (!vfio_cpr_supported(be, cpr_blocker)) {
         return migrate_add_blocker_modes(cpr_blocker,
-                    BIT(MIG_MODE_CPR_TRANSFER) | BIT(MIG_MODE_CPR_TRANSFER),
-                    errp);
+                    BIT(MIG_MODE_CPR_TRANSFER) | BIT(MIG_MODE_CPR_EXEC),
+                    errp) == 0;
     }
 
     vmstate_register(NULL, -1, &iommufd_cpr_vmstate, be);
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Jim Shu

The return value of API is 0 for success and negative error code for failure. We'll check if the return value equals to 0. Also, the MIG_MODE should be CPR_TRANSFER and CPR_EXEC instead of 2 same bits.

The API usage is aligned with 'hw/vfio/cpr-legacy.c' after these 2 changes.

Fixes 3ca0a0ab05c ("migration: Use bitset of MigMode instead of variable arguments")
---
  hw/vfio/cpr-iommufd.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/vfio/cpr-iommufd.c +0 -0
index c244db88fbb..6758c73b6b9 100644

hw/vfio/cpr-iommufd.c bool vfio_iommufd_cpr_register_iommufd(IOMMUFDBackend *be, Error **errp) · line 166

Quoted 10 lines
hw/vfio/cpr-iommufd.c +2 -2
@@ -159,8 +159,8 @@ bool vfio_iommufd_cpr_register_iommufd(IOMMUFDBackend *be, Error **errp)
 
      if (!vfio_cpr_supported(be, cpr_blocker)) {
          return migrate_add_blocker_modes(cpr_blocker,
-                    BIT(MIG_MODE_CPR_TRANSFER) | BIT(MIG_MODE_CPR_TRANSFER),
-                    errp);
+                    BIT(MIG_MODE_CPR_TRANSFER) | BIT(MIG_MODE_CPR_EXEC),
+                    errp) == 0;
      }
 
      vmstate_register(NULL, -1, &iommufd_cpr_vmstate, be);

Thanks,

C.