vfio: Introduce new files for VFIO MemoryListener

File "common.c" has been emptied of most of its definitions by the
previous changes and the only definitions left are related to the VFIO
MemoryListener handlers. Rename it to "listener.c" and introduce its
associated "vfio-listener.h" header file for the declarations.

Cleanup a little the includes while at it.

Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
Reviewed-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Avihai Horon <avihaih@nvidia.com>
Link: https://lore.kernel.org/qemu-devel/20250326075122.1299361-33-clg@redhat.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
Cédric Le Goater 2025-03-26 08:51:17 +01:00
parent c51358bd17
commit 6b62a90c24
7 changed files with 18 additions and 3 deletions

View file

@ -35,6 +35,7 @@
#include "hw/vfio/vfio-container.h" #include "hw/vfio/vfio-container.h"
#include "vfio-helpers.h" #include "vfio-helpers.h"
#include "vfio-cpr.h" #include "vfio-cpr.h"
#include "vfio-listener.h"
#define TYPE_HOST_IOMMU_DEVICE_LEGACY_VFIO TYPE_HOST_IOMMU_DEVICE "-legacy-vfio" #define TYPE_HOST_IOMMU_DEVICE_LEGACY_VFIO TYPE_HOST_IOMMU_DEVICE "-legacy-vfio"

View file

@ -28,6 +28,7 @@
#include "vfio-iommufd.h" #include "vfio-iommufd.h"
#include "vfio-helpers.h" #include "vfio-helpers.h"
#include "vfio-cpr.h" #include "vfio-cpr.h"
#include "vfio-listener.h"
#define TYPE_HOST_IOMMU_DEVICE_IOMMUFD_VFIO \ #define TYPE_HOST_IOMMU_DEVICE_IOMMUFD_VFIO \
TYPE_HOST_IOMMU_DEVICE_IOMMUFD "-vfio" TYPE_HOST_IOMMU_DEVICE_IOMMUFD "-vfio"

View file

@ -1,6 +1,6 @@
vfio_ss = ss.source_set() vfio_ss = ss.source_set()
vfio_ss.add(files( vfio_ss.add(files(
'common.c', 'listener.c',
'container-base.c', 'container-base.c',
'container.c', 'container.c',
'helpers.c', 'helpers.c',

View file

@ -89,7 +89,7 @@ vfio_pci_igd_bdsm_enabled(const char *name, int size) "%s %dMB"
vfio_pci_igd_host_bridge_enabled(const char *name) "%s" vfio_pci_igd_host_bridge_enabled(const char *name) "%s"
vfio_pci_igd_lpc_bridge_enabled(const char *name) "%s" vfio_pci_igd_lpc_bridge_enabled(const char *name) "%s"
# common.c # listener.c
vfio_iommu_map_notify(const char *op, uint64_t iova_start, uint64_t iova_end) "iommu %s @ 0x%"PRIx64" - 0x%"PRIx64 vfio_iommu_map_notify(const char *op, uint64_t iova_start, uint64_t iova_end) "iommu %s @ 0x%"PRIx64" - 0x%"PRIx64
vfio_listener_region_skip(const char *name, uint64_t start, uint64_t end) "SKIPPING %s 0x%"PRIx64" - 0x%"PRIx64 vfio_listener_region_skip(const char *name, uint64_t start, uint64_t end) "SKIPPING %s 0x%"PRIx64" - 0x%"PRIx64
vfio_spapr_group_attach(int groupfd, int tablefd) "Attached groupfd %d to liobn fd %d" vfio_spapr_group_attach(int groupfd, int tablefd) "Attached groupfd %d to liobn fd %d"

14
hw/vfio/vfio-listener.h Normal file
View file

@ -0,0 +1,14 @@
/*
* VFIO MemoryListener services
*
* Copyright Red Hat, Inc. 2025
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef HW_VFIO_VFIO_LISTENER_H
#define HW_VFIO_VFIO_LISTENER_H
extern const MemoryListener vfio_memory_listener;
#endif /* HW_VFIO_VFIO_LISTENER_H */

View file

@ -131,7 +131,6 @@ VFIODevice *vfio_get_vfio_device(Object *obj);
typedef QLIST_HEAD(VFIODeviceList, VFIODevice) VFIODeviceList; typedef QLIST_HEAD(VFIODeviceList, VFIODevice) VFIODeviceList;
extern VFIODeviceList vfio_device_list; extern VFIODeviceList vfio_device_list;
extern const MemoryListener vfio_memory_listener;
#ifdef CONFIG_LINUX #ifdef CONFIG_LINUX
int vfio_get_region_info(VFIODevice *vbasedev, int index, int vfio_get_region_info(VFIODevice *vbasedev, int index,