summary refs log tree commit diff stats
path: root/hw/vfio/device.c
diff options
context:
space:
mode:
authorSteve Sistare <steven.sistare@oracle.com>2025-07-02 14:58:52 -0700
committerCédric Le Goater <clg@redhat.com>2025-07-03 13:42:28 +0200
commit2a3f0a59bd6479f75fa5335f82b85b4f9cd7ed4e (patch)
tree308378dad2b6d8d73fd5b0fa7fe181d6ac48b336 /hw/vfio/device.c
parentf2f3e4667e4d6026f39ab17f355f79b2f8431e19 (diff)
downloadfocaccia-qemu-2a3f0a59bd6479f75fa5335f82b85b4f9cd7ed4e.tar.gz
focaccia-qemu-2a3f0a59bd6479f75fa5335f82b85b4f9cd7ed4e.zip
vfio/iommufd: preserve descriptors
Save the iommu and vfio device fd in CPR state when it is created.
After CPR, the fd number is found in CPR state and reused.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Link: https://lore.kernel.org/qemu-devel/1751493538-202042-16-git-send-email-steven.sistare@oracle.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'hw/vfio/device.c')
-rw-r--r--hw/vfio/device.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/hw/vfio/device.c b/hw/vfio/device.c
index 0ae3f3c660..96cf21462c 100644
--- a/hw/vfio/device.c
+++ b/hw/vfio/device.c
@@ -351,14 +351,7 @@ void vfio_device_free_name(VFIODevice *vbasedev)
 
 void vfio_device_set_fd(VFIODevice *vbasedev, const char *str, Error **errp)
 {
-    ERRP_GUARD();
-    int fd = monitor_fd_param(monitor_cur(), str, errp);
-
-    if (fd < 0) {
-        error_prepend(errp, "Could not parse remote object fd %s:", str);
-        return;
-    }
-    vbasedev->fd = fd;
+    vbasedev->fd = cpr_get_fd_param(vbasedev->dev->id, str, 0, errp);
 }
 
 static VFIODeviceIOOps vfio_device_io_ops_ioctl;