diff options
| author | Cédric Le Goater <clg@redhat.com> | 2025-03-26 08:51:19 +0100 |
|---|---|---|
| committer | Cédric Le Goater <clg@redhat.com> | 2025-04-25 09:01:37 +0200 |
| commit | a9183378f54969c8b11f08fdb3063925de8d77c3 (patch) | |
| tree | 767d638f2b5ee3ebf1106d57472f5d6078e1e8c5 /hw/vfio/iommufd.c | |
| parent | 74d376378e2a41392a36f34cef7d2c89ac2dfb33 (diff) | |
| download | focaccia-qemu-a9183378f54969c8b11f08fdb3063925de8d77c3.tar.gz focaccia-qemu-a9183378f54969c8b11f08fdb3063925de8d77c3.zip | |
vfio: Introduce vfio_listener_un/register() routines
This hides the MemoryListener implementation and makes the code common to both IOMMU backends, legacy and IOMMUFD. Reviewed-by: Joao Martins <joao.m.martins@oracle.com> Reviewed-by: John Levon <john.levon@nutanix.com> Link: https://lore.kernel.org/qemu-devel/20250326075122.1299361-35-clg@redhat.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'hw/vfio/iommufd.c')
| -rw-r--r-- | hw/vfio/iommufd.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c index 7488d21215..e47720247d 100644 --- a/hw/vfio/iommufd.c +++ b/hw/vfio/iommufd.c @@ -410,7 +410,7 @@ static void iommufd_cdev_container_destroy(VFIOIOMMUFDContainer *container) if (!QLIST_EMPTY(&bcontainer->device_list)) { return; } - memory_listener_unregister(&bcontainer->listener); + vfio_listener_unregister(bcontainer); iommufd_backend_free_id(container->be, container->ioas_id); object_unref(container); } @@ -562,12 +562,7 @@ static bool iommufd_cdev_attach(const char *name, VFIODevice *vbasedev, bcontainer->pgsizes = qemu_real_host_page_size(); } - bcontainer->listener = vfio_memory_listener; - memory_listener_register(&bcontainer->listener, bcontainer->space->as); - - if (bcontainer->error) { - error_propagate_prepend(errp, bcontainer->error, - "memory listener initialization failed: "); + if (!vfio_listener_register(bcontainer, errp)) { goto err_listener_register; } |