diff mbox series

[RFC,V1,03/12] iommufd: pass name to connect

Message ID 1721502937-87102-4-git-send-email-steven.sistare@oracle.com (mailing list archive)
State New, archived
Headers show
Series Live update: iommufd | expand

Commit Message

Steven Sistare July 20, 2024, 7:15 p.m. UTC
Pass device name to iommufd_backend_connect and iommufd_backend_disconnect,
for use by CPR in a subsequent patch.  No functional change.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
 backends/iommufd.c       | 4 ++--
 hw/vfio/iommufd.c        | 6 +++---
 include/sysemu/iommufd.h | 5 +++--
 3 files changed, 8 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/backends/iommufd.c b/backends/iommufd.c
index 84fefbc..fc37386 100644
--- a/backends/iommufd.c
+++ b/backends/iommufd.c
@@ -72,7 +72,7 @@  static void iommufd_backend_class_init(ObjectClass *oc, void *data)
     object_class_property_add_str(oc, "fd", NULL, iommufd_backend_set_fd);
 }
 
-bool iommufd_backend_connect(IOMMUFDBackend *be, Error **errp)
+bool iommufd_backend_connect(IOMMUFDBackend *be, const char *name, Error **errp)
 {
     int fd;
 
@@ -90,7 +90,7 @@  bool iommufd_backend_connect(IOMMUFDBackend *be, Error **errp)
     return true;
 }
 
-void iommufd_backend_disconnect(IOMMUFDBackend *be)
+void iommufd_backend_disconnect(IOMMUFDBackend *be, const char *name)
 {
     if (!be->users) {
         goto out;
diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
index c2f158e..255966a 100644
--- a/hw/vfio/iommufd.c
+++ b/hw/vfio/iommufd.c
@@ -71,7 +71,7 @@  static bool iommufd_cdev_connect_and_bind(VFIODevice *vbasedev, Error **errp)
         .flags = 0,
     };
 
-    if (!iommufd_backend_connect(iommufd, errp)) {
+    if (!iommufd_backend_connect(iommufd, vbasedev->name, errp)) {
         return false;
     }
 
@@ -99,7 +99,7 @@  static bool iommufd_cdev_connect_and_bind(VFIODevice *vbasedev, Error **errp)
 err_bind:
     iommufd_cdev_kvm_device_del(vbasedev);
 err_kvm_device_add:
-    iommufd_backend_disconnect(iommufd);
+    iommufd_backend_disconnect(iommufd, vbasedev->name);
     return false;
 }
 
@@ -107,7 +107,7 @@  static void iommufd_cdev_unbind_and_disconnect(VFIODevice *vbasedev)
 {
     /* Unbind is automatically conducted when device fd is closed */
     iommufd_cdev_kvm_device_del(vbasedev);
-    iommufd_backend_disconnect(vbasedev->iommufd);
+    iommufd_backend_disconnect(vbasedev->iommufd, vbasedev->name);
 }
 
 static int iommufd_cdev_getfd(const char *sysfs_path, Error **errp)
diff --git a/include/sysemu/iommufd.h b/include/sysemu/iommufd.h
index 9edfec6..aa195d1 100644
--- a/include/sysemu/iommufd.h
+++ b/include/sysemu/iommufd.h
@@ -37,8 +37,9 @@  struct IOMMUFDBackend {
     /*< public >*/
 };
 
-bool iommufd_backend_connect(IOMMUFDBackend *be, Error **errp);
-void iommufd_backend_disconnect(IOMMUFDBackend *be);
+bool iommufd_backend_connect(IOMMUFDBackend *be, const char *name,
+                             Error **errp);
+void iommufd_backend_disconnect(IOMMUFDBackend *be, const char *name);
 
 bool iommufd_backend_alloc_ioas(IOMMUFDBackend *be, uint32_t *ioas_id,
                                 Error **errp);