Hi All, >-----Original Message----- >From: Duan, Zhenzhong <zhenzhong.d...@intel.com> >Subject: [PATCH v2 03/10] backends/iommufd: Introduce abstract >HIODIOMMUFD device > >HIODIOMMUFD represents a host IOMMU device under iommufd backend. > >Currently it includes only public iommufd handle and device id. >which could be used to get hw IOMMU information. > >When nested translation is supported in future, vIOMMU is going >to have iommufd related operations like attaching/detaching hwpt, >So IOMMUFDDevice interface will be further extended at that time. > >VFIO and VDPA device have different way of attaching/detaching hwpt. >So HIODIOMMUFD is still an abstract class which will be inherited by >VFIO and VDPA device. > >Introduce a helper hiod_iommufd_init() to initialize HIODIOMMUFD >device. > >Suggested-by: Cédric Le Goater <c...@redhat.com> >Originally-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> >--- > include/sysemu/iommufd.h | 22 +++++++++++++++++++ > backends/iommufd.c | 47 ++++++++++++++++++++++++++-------------- > 2 files changed, 53 insertions(+), 16 deletions(-) > >diff --git a/include/sysemu/iommufd.h b/include/sysemu/iommufd.h >index 9af27ebd6c..71c53cbb45 100644 >--- a/include/sysemu/iommufd.h >+++ b/include/sysemu/iommufd.h >@@ -4,6 +4,7 @@ > #include "qom/object.h" > #include "exec/hwaddr.h" > #include "exec/cpu-common.h" >+#include "sysemu/host_iommu_device.h" > > #define TYPE_IOMMUFD_BACKEND "iommufd" > OBJECT_DECLARE_TYPE(IOMMUFDBackend, IOMMUFDBackendClass, >IOMMUFD_BACKEND) >@@ -33,4 +34,25 @@ int iommufd_backend_map_dma(IOMMUFDBackend >*be, uint32_t ioas_id, hwaddr iova, > ram_addr_t size, void *vaddr, bool readonly); > int iommufd_backend_unmap_dma(IOMMUFDBackend *be, uint32_t >ioas_id, > hwaddr iova, ram_addr_t size); >+ >+#define TYPE_HIOD_IOMMUFD TYPE_HOST_IOMMU_DEVICE "-iommufd" >+OBJECT_DECLARE_TYPE(HIODIOMMUFD, HIODIOMMUFDClass, >HIOD_IOMMUFD) >+ >+struct HIODIOMMUFD { >+ /*< private >*/ >+ HostIOMMUDevice parent; >+ void *opaque;
Please ignore above line "void *opaque;", it's totally useless, I forgot to remove it. Sorry for noise. Thanks Zhenzhong