[PATCH v4 01/23] iommufd/viommu: Add driver-allocated vDEVICE support

Nicolin Chen nicolinc at nvidia.com
Thu May 15 09:55:48 PDT 2025


On Thu, May 15, 2025 at 05:42:46AM +0000, Tian, Kevin wrote:
> > From: Nicolin Chen <nicolinc at 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 at intel.com>

OK. Will rearrange a bit.

Thanks
Nicolin



More information about the linux-arm-kernel mailing list