Re: [PATCH v3 3/4] iommufd: Add IOMMU_DEVICE_GET_HW_INFO

From: Nicolin Chen
Date: Wed May 24 2023 - 01:20:17 EST


On Wed, May 24, 2023 at 05:00:40AM +0000, Tian, Kevin wrote:
> > > > +};
> > > > +#define IOMMU_DEVICE_GET_HW_INFO _IO(IOMMUFD_TYPE,
> > > > IOMMUFD_CMD_DEVICE_GET_HW_INFO)
> > > > #endif
> > >
> > > Here we have a naming confusion.
> > >
> > > 'IOMMU' is the prefix of iommufd ioctls.
> > >
> > > 'DEVICE' is the subjective.
> > >
> > > Then "GET_HW_INFO" implies getting hardware info related to
> > > this device. then it should not be restricted to the iommu info.
> > >
> > > with that it's clearer to call it IOMMU_DEVICE_GET_IOMMU_INFO.
> >
> > Though the entire ioctl is tied to the input "dev_id", I think
> > it isn't really about the device corresponding to the dev_id,
> > similar to the IOMMU_HWPT_ALLOC having a dev_id input too. So,
> > I think the "IOMMU_DEVICE" here should be interpreted simply
> > as "an iommu device". We could also highlight this somewhere
> > in the header.
>
> yes this is a good view of it. with that it's not necessary to have
> a 'DEVICE' notation in the name which looks confusing with dev_id.
>
> Just IOMMU_GET_HW_INFO for the iommu behind the specified dev_id.
>
> then keep the structure name as iommu_hw_info.

That'd be neat.

> > With that being said, IOMMU_DEVICE_SET/UNSET_DATA should be
> > renamed to IOMMU_DEVICE_SET/UNSET_DEV_DATA -- "DEVICE" is the
> > iommu device while the "DEV_DATA" is a given device that's
> > behind the iommu.
>
> this then becomes IOMMU_SET/UNSET_DEV_DATA.

Ack.

Thanks
Nic