>-----Original Message----- >From: Eric Auger <eric.au...@redhat.com> >Subject: Re: [PATCH rfcv2 11/18] intel_iommu: Add >set/unset_iommu_device callback > > > >On 2/1/24 08:28, Zhenzhong Duan wrote: >> From: Yi Liu <yi.l....@intel.com> >> >> This adds set/unset_iommu_device() implementation in Intel vIOMMU. >> In set call, a pointer to host IOMMU device info is stored in hash >> table indexed by PCI BDF. >> >> Signed-off-by: Yi Liu <yi.l....@intel.com> >> Signed-off-by: Yi Sun <yi.y....@linux.intel.com> >> Signed-off-by: Zhenzhong Duan <zhenzhong.d...@intel.com> >> --- >> hw/i386/intel_iommu_internal.h | 14 +++++++ >> include/hw/i386/intel_iommu.h | 2 + >> hw/i386/intel_iommu.c | 74 >++++++++++++++++++++++++++++++++++ >> 3 files changed, 90 insertions(+) >> >> diff --git a/hw/i386/intel_iommu_internal.h >b/hw/i386/intel_iommu_internal.h >> index f8cf99bddf..3301f54b35 100644 >> --- a/hw/i386/intel_iommu_internal.h >> +++ b/hw/i386/intel_iommu_internal.h >> @@ -28,6 +28,8 @@ >> #ifndef HW_I386_INTEL_IOMMU_INTERNAL_H >> #define HW_I386_INTEL_IOMMU_INTERNAL_H >> #include "hw/i386/intel_iommu.h" >> +#include "sysemu/host_iommu_device.h" >> +#include "hw/vfio/vfio-common.h" >> >> /* >> * Intel IOMMU register specification >> @@ -537,4 +539,16 @@ typedef struct VTDRootEntry VTDRootEntry; >> #define VTD_SL_IGN_COM 0xbff0000000000000ULL >> #define VTD_SL_TM (1ULL << 62) >> >> + >> +typedef struct VTDHostIOMMUDevice { >> + IntelIOMMUState *iommu_state; >> + PCIBus *bus; >> + uint8_t devfn; >> + union { >> + HostIOMMUDevice *dev; >> + IOMMULegacyDevice *ldev; >> + IOMMUFDDevice *idev; >> + }; >again this looks really weird to me. Why don't we simply have > >HostIOMMUDevice *dev;
Sure, will do. Thanks Zhenzhong