@@ -999,6 +999,13 @@ static bool vfio_legacy_attach_device(const char *name, VFIODevice *vbasedev,
return false;
}
+ if (vbasedev->mdev) {
+ error_setg(&vbasedev->cpr.mdev_blocker,
+ "CPR does not support vfio mdev %s", vbasedev->name);
+ migrate_add_blocker_modes(&vbasedev->cpr.mdev_blocker, &error_fatal,
+ MIG_MODE_CPR_TRANSFER, -1);
+ }
+
bcontainer = &group->container->bcontainer;
vbasedev->bcontainer = bcontainer;
QLIST_INSERT_HEAD(&bcontainer->device_list, vbasedev, container_next);
@@ -1015,6 +1022,7 @@ static void vfio_legacy_detach_device(VFIODevice *vbasedev)
QLIST_REMOVE(vbasedev, container_next);
vbasedev->bcontainer = NULL;
trace_vfio_detach_device(vbasedev->name, group->groupid);
+ migrate_del_blocker(&vbasedev->cpr.mdev_blocker);
vfio_put_base_device(vbasedev);
vfio_put_group(group);
}
@@ -17,6 +17,7 @@ typedef struct VFIOContainerCPR {
typedef struct VFIODeviceCPR {
bool reused;
+ Error *mdev_blocker;
} VFIODeviceCPR;
struct VFIOContainer;
During CPR, after VFIO_DMA_UNMAP_FLAG_VADDR, the vaddr is temporarily invalid, so mediated devices cannot be supported. Add a blocker for them. This restriction will not apply to iommufd containers when CPR is added for them in a future patch. Signed-off-by: Steve Sistare <steven.sistare@oracle.com> --- hw/vfio/container.c | 8 ++++++++ include/hw/vfio/vfio-cpr.h | 1 + 2 files changed, 9 insertions(+)