[PATCH v3 01/16] iommufd/viommu: Introduce IOMMUFD_OBJ_VDEVICE and its related struct
Nicolin Chen
nicolinc at nvidia.com
Mon Oct 21 09:42:59 PDT 2024
On Mon, Oct 21, 2024 at 09:21:48AM -0300, Jason Gunthorpe wrote:
> On Sat, Oct 19, 2024 at 06:35:45PM -0700, Nicolin Chen wrote:
> > On Thu, Oct 17, 2024 at 03:45:56PM -0300, Jason Gunthorpe wrote:
> > > > +struct iommufd_vdevice *
> > > > +__iommufd_vdevice_alloc(struct iommufd_ctx *ictx, size_t size)
> > > > +{
> > > > + struct iommufd_object *obj;
> > > > +
> > > > + if (WARN_ON(size < sizeof(struct iommufd_vdevice)))
> > > > + return ERR_PTR(-EINVAL);
> > > > + obj = iommufd_object_alloc_elm(ictx, size, IOMMUFD_OBJ_VDEVICE);
> > > > + if (IS_ERR(obj))
> > > > + return ERR_CAST(obj);
> > > > + return container_of(obj, struct iommufd_vdevice, obj);
> > > > +}
> > >
> > > Like for the viommu this can all just be folded into the #define
> >
> > It seems that we have to keep two small functions as followings,
> > unless we want to expose the enum iommufd_object_type.
>
> I'd probably expose the enum along with the struct..
OK. Let's do that.
Nicolin
More information about the linux-arm-kernel
mailing list