lkml.org 
[lkml]   [2022]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH 15/15] vfio: Add struct device to vfio_device
Date
> From: Jason Gunthorpe <jgg@ziepe.ca>
> Sent: Wednesday, August 31, 2022 8:32 AM
>
> On Sun, Aug 28, 2022 at 01:10:37AM +0800, Kevin Tian wrote:
> > From: Yi Liu <yi.l.liu@intel.com>
> >
> > and replace kref. With it a 'vfio-dev/vfioX' node is created under the
> > sysfs path of the parent, indicating the device is bound to a vfio
> > driver, e.g.:
> >
> > /sys/devices/pci0000\:6f/0000\:6f\:01.0/vfio-dev/vfio0
> >
> > It is also a preparatory step toward adding cdev for supporting future
> > device-oriented uAPI.
> >
> > Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
> > Signed-off-by: Yi Liu <yi.l.liu@intel.com>
> > Signed-off-by: Kevin Tian <kevin.tian@intel.com>
> > ---
> > drivers/vfio/vfio_main.c | 70 +++++++++++++++++++++++++++++++++-------
> > include/linux/vfio.h | 6 ++--
> > 2 files changed, 61 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
> > index 0c5d120aeced..9ad0cbb83f1c 100644
> > --- a/drivers/vfio/vfio_main.c
> > +++ b/drivers/vfio/vfio_main.c
> > @@ -46,6 +46,8 @@ static struct vfio {
> > struct mutex group_lock; /* locks group_list */
> > struct ida group_ida;
> > dev_t group_devt;
> > + struct class *device_class;
> > + struct ida device_ida;
> > } vfio;
> >
> > struct vfio_iommu_driver {
> > @@ -524,11 +526,19 @@ EXPORT_SYMBOL_GPL(_vfio_alloc_device);
> > *
> > * Only vfio-ccw driver should call this interface.
> > */
> > +static void vfio_device_release(struct device *dev);
>
> Since you added this new function in patch 1, it would be nice to
> place it in a way that avoids this forward reference in this patch
>
> > ret = alloc_chrdev_region(&vfio.group_devt, 0, MINORMASK + 1,
> "vfio");
>
> I think we should change this "vfio" string at this point, it is
> really the group fd, so "vfio_group" ?
>
> It only shows in procfs.
>

All make sense and fixed.

\
 
 \ /
  Last update: 2022-08-31 08:15    [W:0.896 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site