mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-19 16:12:40 -06:00
vfio/container: mdev cpr blocker
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> Reviewed-by: Cédric Le Goater <clg@redhat.com> Link: https://lore.kernel.org/qemu-devel/1749569991-25171-8-git-send-email-steven.sistare@oracle.com [ clg: Fixed context change in VFIODevice ] Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
7e9f214113
commit
dac0dd68d9
3 changed files with 13 additions and 0 deletions
|
@ -987,6 +987,13 @@ static bool vfio_legacy_attach_device(const char *name, VFIODevice *vbasedev,
|
||||||
goto device_put_exit;
|
goto device_put_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
device_put_exit:
|
device_put_exit:
|
||||||
|
@ -1004,6 +1011,7 @@ static void vfio_legacy_detach_device(VFIODevice *vbasedev)
|
||||||
|
|
||||||
vfio_device_unprepare(vbasedev);
|
vfio_device_unprepare(vbasedev);
|
||||||
|
|
||||||
|
migrate_del_blocker(&vbasedev->cpr.mdev_blocker);
|
||||||
object_unref(vbasedev->hiod);
|
object_unref(vbasedev->hiod);
|
||||||
vfio_device_put(vbasedev);
|
vfio_device_put(vbasedev);
|
||||||
vfio_group_put(group);
|
vfio_group_put(group);
|
||||||
|
|
|
@ -22,6 +22,9 @@ typedef struct VFIOContainerCPR {
|
||||||
void *vaddr, bool readonly, MemoryRegion *mr);
|
void *vaddr, bool readonly, MemoryRegion *mr);
|
||||||
} VFIOContainerCPR;
|
} VFIOContainerCPR;
|
||||||
|
|
||||||
|
typedef struct VFIODeviceCPR {
|
||||||
|
Error *mdev_blocker;
|
||||||
|
} VFIODeviceCPR;
|
||||||
|
|
||||||
bool vfio_legacy_cpr_register_container(struct VFIOContainer *container,
|
bool vfio_legacy_cpr_register_container(struct VFIOContainer *container,
|
||||||
Error **errp);
|
Error **errp);
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include "system/system.h"
|
#include "system/system.h"
|
||||||
#include "hw/vfio/vfio-container-base.h"
|
#include "hw/vfio/vfio-container-base.h"
|
||||||
|
#include "hw/vfio/vfio-cpr.h"
|
||||||
#include "system/host_iommu_device.h"
|
#include "system/host_iommu_device.h"
|
||||||
#include "system/iommufd.h"
|
#include "system/iommufd.h"
|
||||||
|
|
||||||
|
@ -86,6 +87,7 @@ typedef struct VFIODevice {
|
||||||
QLIST_ENTRY(VFIODevice) hwpt_next;
|
QLIST_ENTRY(VFIODevice) hwpt_next;
|
||||||
struct vfio_region_info **reginfo;
|
struct vfio_region_info **reginfo;
|
||||||
int *region_fds;
|
int *region_fds;
|
||||||
|
VFIODeviceCPR cpr;
|
||||||
} VFIODevice;
|
} VFIODevice;
|
||||||
|
|
||||||
struct VFIODeviceOps {
|
struct VFIODeviceOps {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue