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: 3ca0a0ab05 ("migration: Use bitset of MigMode instead of variable arguments")
Signed-off-by: Jim Shu <jim.shu@sifive.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260121063418.2001326-1-jim.shu@sifive.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
Jim Shu
2026-01-21 14:34:18 +08:00
committed by Cédric Le Goater
parent e3c659fee0
commit 0e387bd1df

View File

@@ -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);