new file mode 100644
@@ -0,0 +1,29 @@
+/*
+ * VFIO iommufd
+ *
+ * Copyright Red Hat, Inc. 2025
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef HW_VFIO_IOMMUFD_H
+#define HW_VFIO_IOMMUFD_H
+
+
+typedef struct VFIOIOASHwpt {
+ uint32_t hwpt_id;
+ uint32_t hwpt_flags;
+ QLIST_HEAD(, VFIODevice) device_list;
+ QLIST_ENTRY(VFIOIOASHwpt) next;
+} VFIOIOASHwpt;
+
+typedef struct VFIOIOMMUFDContainer {
+ VFIOContainerBase bcontainer;
+ IOMMUFDBackend *be;
+ uint32_t ioas_id;
+ QLIST_HEAD(, VFIOIOASHwpt) hwpt_list;
+} VFIOIOMMUFDContainer;
+
+OBJECT_DECLARE_SIMPLE_TYPE(VFIOIOMMUFDContainer, VFIO_IOMMU_IOMMUFD);
+
+#endif /* HW_VFIO_IOMMUFD_H */
@@ -69,27 +69,12 @@ typedef struct VFIOContainer {
OBJECT_DECLARE_SIMPLE_TYPE(VFIOContainer, VFIO_IOMMU_LEGACY);
-typedef struct IOMMUFDBackend IOMMUFDBackend;
-
-typedef struct VFIOIOASHwpt {
- uint32_t hwpt_id;
- uint32_t hwpt_flags;
- QLIST_HEAD(, VFIODevice) device_list;
- QLIST_ENTRY(VFIOIOASHwpt) next;
-} VFIOIOASHwpt;
-
-typedef struct VFIOIOMMUFDContainer {
- VFIOContainerBase bcontainer;
- IOMMUFDBackend *be;
- uint32_t ioas_id;
- QLIST_HEAD(, VFIOIOASHwpt) hwpt_list;
-} VFIOIOMMUFDContainer;
-
-OBJECT_DECLARE_SIMPLE_TYPE(VFIOIOMMUFDContainer, VFIO_IOMMU_IOMMUFD);
-
typedef struct VFIODeviceOps VFIODeviceOps;
typedef struct VFIOMigration VFIOMigration;
+typedef struct IOMMUFDBackend IOMMUFDBackend;
+typedef struct VFIOIOASHwpt VFIOIOASHwpt;
+
typedef struct VFIODevice {
QLIST_ENTRY(VFIODevice) next;
QLIST_ENTRY(VFIODevice) container_next;
@@ -26,6 +26,7 @@
#include "qemu/chardev_open.h"
#include "pci.h"
#include "migration.h"
+#include "iommufd.h"
static int iommufd_cdev_map(const VFIOContainerBase *bcontainer, hwaddr iova,
ram_addr_t size, void *vaddr, bool readonly)
Gather all VFIOIOMMUFD related declarations into "iommufd.h" to reduce exposure of VFIO internals in "hw/vfio/vfio-common.h". Signed-off-by: Cédric Le Goater <clg@redhat.com> --- hw/vfio/iommufd.h | 29 +++++++++++++++++++++++++++++ include/hw/vfio/vfio-common.h | 21 +++------------------ hw/vfio/iommufd.c | 1 + 3 files changed, 33 insertions(+), 18 deletions(-) create mode 100644 hw/vfio/iommufd.h