diff mbox series

[2/5] vfio: Modify vfio_viommu_preset() parameter

Message ID 20250122151732.1351821-3-clg@redhat.com (mailing list archive)
State New
Headers show
Series vfio: Improve error reporting when MMIO region mapping fails | expand

Commit Message

Cédric Le Goater Jan. 22, 2025, 3:17 p.m. UTC
We plan to use vfio_viommu_preset() in MemoryListener handlers which
operate at the container level. Change the parameter to VFIOContainerBase
to ease future changes.

Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
 include/hw/vfio/vfio-common.h | 2 +-
 hw/vfio/common.c              | 4 ++--
 hw/vfio/migration.c           | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
index 48018dc751e51066769b23bc6e4675a7167b099e..fcfe0b4b8cbe907877e366117e7bb7f74311d4f6 100644
--- a/include/hw/vfio/vfio-common.h
+++ b/include/hw/vfio/vfio-common.h
@@ -274,7 +274,7 @@  extern int vfio_kvm_device_fd;
 bool vfio_mig_active(void);
 int vfio_block_multiple_devices_migration(VFIODevice *vbasedev, Error **errp);
 void vfio_unblock_multiple_devices_migration(void);
-bool vfio_viommu_preset(VFIODevice *vbasedev);
+bool vfio_viommu_preset(VFIOContainerBase *bcontainer);
 int64_t vfio_mig_bytes_transferred(void);
 void vfio_reset_bytes_transferred(void);
 bool vfio_device_state_is_running(VFIODevice *vbasedev);
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 2660a42f9edc9346f2e62652efb0c78a8b48b52b..3ca5dbf883ed2262e36952fcc47e717ff4154f12 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -142,9 +142,9 @@  void vfio_unblock_multiple_devices_migration(void)
     migrate_del_blocker(&multiple_devices_migration_blocker);
 }
 
-bool vfio_viommu_preset(VFIODevice *vbasedev)
+bool vfio_viommu_preset(VFIOContainerBase *bcontainer)
 {
-    return vbasedev->bcontainer->space->as != &address_space_memory;
+    return bcontainer->space->as != &address_space_memory;
 }
 
 static void vfio_set_migration_error(int ret)
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index adfa752db5272e37d73fc0a435a0834e74e3f2fe..347390adb27bc3cd123f3eec1de6dc6986d8d952 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -1069,7 +1069,7 @@  bool vfio_migration_realize(VFIODevice *vbasedev, Error **errp)
         goto out_deinit;
     }
 
-    if (vfio_viommu_preset(vbasedev)) {
+    if (vfio_viommu_preset(vbasedev->bcontainer)) {
         error_setg(&err, "%s: Migration is currently not supported "
                    "with vIOMMU enabled", vbasedev->name);
         goto add_blocker;