Either IOMMULegacyDevice or IOMMUFDDevice into VFIODevice, neither both. Signed-off-by: Zhenzhong Duan <zhenzhong.d...@intel.com> --- include/hw/vfio/vfio-common.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index 8bfb9cbe94..1bbad003ee 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -32,6 +32,7 @@ #include "sysemu/sysemu.h" #include "hw/vfio/vfio-container-base.h" #include "sysemu/host_iommu_device.h" +#include "sysemu/iommufd.h" #define VFIO_MSG_PREFIX "vfio %s: " @@ -132,8 +133,18 @@ typedef struct VFIODevice { bool dirty_tracking; int devid; IOMMUFDBackend *iommufd; + union { + HostIOMMUDevice base_hdev; + IOMMULegacyDevice legacy_dev; + IOMMUFDDevice iommufd_dev; + }; } VFIODevice; +QEMU_BUILD_BUG_ON(offsetof(VFIODevice, legacy_dev.base) != + offsetof(VFIODevice, base_hdev)); +QEMU_BUILD_BUG_ON(offsetof(VFIODevice, iommufd_dev.base) != + offsetof(VFIODevice, base_hdev)); + struct VFIODeviceOps { void (*vfio_compute_needs_reset)(VFIODevice *vdev); int (*vfio_hot_reset_multi)(VFIODevice *vdev); -- 2.34.1