>-----Original Message----- >From: Cédric Le Goater <c...@redhat.com> >Subject: [PATCH for-10.1 09/32] vfio: Introduce a new header file for >VFIOIOMMUFD declarations > >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 <c...@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 > >diff --git a/hw/vfio/iommufd.h b/hw/vfio/iommufd.h >new file mode 100644 >index >0000000000000000000000000000000000000000..7d87994c4fadbc328b6ac7f9ae >e00469dd8808b0 >--- /dev/null >+++ b/hw/vfio/iommufd.h >@@ -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;
Do we need to add 'typedef struct IOMMUFDBackend IOMMUFDBackend;' for above line? Thanks Zhenzhong >+ uint32_t ioas_id; >+ QLIST_HEAD(, VFIOIOASHwpt) hwpt_list; >+} VFIOIOMMUFDContainer; >+ >+OBJECT_DECLARE_SIMPLE_TYPE(VFIOIOMMUFDContainer, >VFIO_IOMMU_IOMMUFD); >+ >+#endif /* HW_VFIO_IOMMUFD_H */ >diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h >index >3355c2d4e57569d7bb01b4d9378fb49a807335e8..8d48f5300a791d8858fe29d1bb >905f814ef11990 100644 >--- a/include/hw/vfio/vfio-common.h >+++ b/include/hw/vfio/vfio-common.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; >diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c >index >2fb2a01ec6d29dbc284cfd9830c24e78ce560dd0..a219b6453037e2d4e0d12800ea >25678885af98f8 100644 >--- a/hw/vfio/iommufd.c >+++ b/hw/vfio/iommufd.c >@@ -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) >-- >2.48.1