From: Nicolin Chen nicolinc@nvidia.com Sent: Friday, May 9, 2025 11:02 AM
+#define iommufd_vdevice_alloc(viommu, drv_struct, member) \
- ({ \
drv_struct *ret; \
\
static_assert(__same_type(struct iommufd_viommu,
*viommu)); \
static_assert(__same_type(struct iommufd_vdevice, \
((drv_struct *)NULL)->member));
\
static_assert(offsetof(drv_struct, member.obj) == 0); \
ret = (drv_struct *)_iommufd_object_alloc( \
viommu->ictx, sizeof(drv_struct),
IOMMUFD_OBJ_VDEVICE);\
if (!IS_ERR(ret)) { \
ret->member.viommu = viommu; \
ret->member.ictx = viommu->ictx; \
} \
ret; \
- })
viommu->ictx is set in patch5, so logically this is better put after that.
Reviewed-by: Kevin Tian kevin.tian@intel.com