On Tue, 13 Jun 2023 14:42:46 +0000 "Liu, Yi L" <yi.l....@intel.com> wrote:
> > From: Alex Williamson <alex.william...@redhat.com> > > Sent: Tuesday, June 13, 2023 10:40 PM > > > > On Tue, 13 Jun 2023 14:28:43 +0000 > > "Liu, Yi L" <yi.l....@intel.com> wrote: > > > > > > From: Alex Williamson <alex.william...@redhat.com> > > > > Sent: Tuesday, June 13, 2023 10:18 PM > > > > > > > > > > diff --git a/include/linux/vfio.h b/include/linux/vfio.h > > > > > > > index 83cc5dc28b7a..e80a8ac86e46 100644 > > > > > > > --- a/include/linux/vfio.h > > > > > > > +++ b/include/linux/vfio.h > > > > > > > @@ -66,6 +66,7 @@ struct vfio_device { > > > > > > > struct iommufd_device *iommufd_device; > > > > > > > bool iommufd_attached; > > > > > > > #endif > > > > > > > + bool cdev_opened:1; > > > > > > > > > > > > Perhaps a more strongly defined data type here as well and roll > > > > > > iommufd_attached into the same bit field scheme. > > > > > > > > > > Ok, then needs to make iommufd_attached always defined. > > > > > > > > That does not follow. Thanks, > > > > > > Well, I meant the iommufd_attached now is defined only when > > > CONFIG_IOMMUFD is enabled. To toll it with cdev_opened, needs > > > to change this. > > > > Understood, but I don't think it's true. If defined we use one more > > bit of the bit field, which is a consideration when we approach filling > > it, but we're not using bit-shift operations to address these bits, so > > why does it matter if one has compiler conditional usage? Thanks, > > Aha, I see. So you are suggesting something like the below. Is it? > > #if IS_ENABLED(CONFIG_IOMMUFD) > struct iommufd_device *iommufd_device; > u8 iommufd_attached:1; > #endif > u8 cdev_opened:1; Precisely. Thanks, Alex