On Thu, Oct 17, 2024 at 01:33:59PM -0300, Jason Gunthorpe wrote: > > diff --git a/drivers/iommu/iommufd/viommu_api.c b/drivers/iommu/iommufd/viommu_api.c > > new file mode 100644 > > index 000000000000..c1731f080d6b > > --- /dev/null > > +++ b/drivers/iommu/iommufd/viommu_api.c > > Let's call this file driver.c to match CONFIG_IOMMUFD_DRIVER Would this make its scope too large that it might feel odd to have the iova_bitmap.c in a separate file? > /* > * Helpers for IOMMU driver to allocate driver structures that will be freed by > * the iommufd core. The free op will be called prior to freeing the memory. > */ > #define iommufd_viommu_alloc(ictx, drv_struct, member, viommu_ops) \ > ({ \ > struct drv_struct *ret; \ > \ > static_assert( \ > __same_type(struct iommufd_viommu, \ > ((struct drv_struct *)NULL)->member)); \ > static_assert(offsetof(struct drv_struct, member.obj) == 0); \ > ret = (struct drv_struct *)iommufd_object_alloc_elm( \ > ictx, sizeof(struct drv_struct), IOMMUFD_OBJ_VIOMMU); \ > ret->member.ops = viommu_ops; \ > ret; \ > }) OK. Will try with this. Thanks Nicolin