[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZkFFbIiXBEQH+2Fd@nvidia.com>
Date: Sun, 12 May 2024 15:40:44 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: Jason Gunthorpe <jgg@...dia.com>
CC: <will@...nel.org>, <robin.murphy@....com>, <kevin.tian@...el.com>,
<suravee.suthikulpanit@....com>, <joro@...tes.org>,
<linux-kernel@...r.kernel.org>, <iommu@...ts.linux.dev>,
<linux-arm-kernel@...ts.infradead.org>, <linux-tegra@...r.kernel.org>,
<yi.l.liu@...el.com>, <eric.auger@...hat.com>, <vasant.hegde@....com>,
<jon.grimm@....com>, <santosh.shukla@....com>, <Dhaval.Giani@....com>,
<shameerali.kolothum.thodi@...wei.com>
Subject: Re: [PATCH RFCv1 01/14] iommufd: Move iommufd_object to public
iommufd header
On Sun, May 12, 2024 at 10:21:49AM -0300, Jason Gunthorpe wrote:
> On Fri, Apr 12, 2024 at 08:46:58PM -0700, Nicolin Chen wrote:
> > diff --git a/include/linux/iommufd.h b/include/linux/iommufd.h
> > +enum iommufd_object_type {
> > + IOMMUFD_OBJ_NONE,
> > + IOMMUFD_OBJ_ANY = IOMMUFD_OBJ_NONE,
> > + IOMMUFD_OBJ_DEVICE,
> > + IOMMUFD_OBJ_HWPT_PAGING,
> > + IOMMUFD_OBJ_HWPT_NESTED,
> > + IOMMUFD_OBJ_IOAS,
> > + IOMMUFD_OBJ_ACCESS,
> > +#ifdef CONFIG_IOMMUFD_TEST
> > + IOMMUFD_OBJ_SELFTEST,
> > +#endif
> > + IOMMUFD_OBJ_MAX,
> > +};
>
> Can we just forward declare the enum? It would be nice to keep it in
> the private header
It doesn't seem to support that:
/include/linux/iommufd.h:31:34: error: field ‘type’ has incomplete type
31 | enum iommufd_object_type type;
By testing the following change on top of the series:
===================================
-enum iommufd_object_type {
- IOMMUFD_OBJ_NONE,
- IOMMUFD_OBJ_ANY = IOMMUFD_OBJ_NONE,
- IOMMUFD_OBJ_DEVICE,
- IOMMUFD_OBJ_HWPT_PAGING,
- IOMMUFD_OBJ_HWPT_NESTED,
- IOMMUFD_OBJ_IOAS,
- IOMMUFD_OBJ_ACCESS,
- IOMMUFD_OBJ_VIOMMU,
- IOMMUFD_OBJ_VQUEUE,
-#ifdef CONFIG_IOMMUFD_TEST
- IOMMUFD_OBJ_SELFTEST,
-#endif
- IOMMUFD_OBJ_MAX,
-};
+enum iommufd_object_type;
/* Base struct for all objects with a userspace ID handle. */
struct iommufd_object {
refcount_t shortterm_users;
refcount_t users;
enum iommufd_object_type type;
unsigned int id;
};
===================================
We could change the "enum iommufd_object_type type" in struct
iommufd_object to "unsigned int type" though...
Thanks
Nicolin
Powered by blists - more mailing lists