> From: Alex Williamson <alex.williamson@xxxxxxxxxx> > Sent: Thursday, September 1, 2022 1:15 AM > > On Wed, 31 Aug 2022 06:10:51 +0000 > "Tian, Kevin" <kevin.tian@xxxxxxxxx> wrote: > > > > From: Jason Gunthorpe <jgg@xxxxxxxx> > > > Sent: Wednesday, August 31, 2022 7:53 AM > > > > > > On Tue, Aug 30, 2022 at 04:18:38PM -0600, Alex Williamson wrote: > > > > On Sun, 28 Aug 2022 01:10:37 +0800 > > > > Kevin Tian <kevin.tian@xxxxxxxxx> wrote: > > > > > > > > > From: Yi Liu <yi.l.liu@xxxxxxxxx> > > > > > > > > > > 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. > > > > > > > > Shall we start Documentation/ABI/testing/vfio-dev now? Thanks. > > > > > > I always thought that was something to use when adding new custom > > > sysfs attributes? > > > > > > Here we are just creating a standard struct device with its standard > > > sysfs? > > > > > > > There is nothing special for vfio-dev/vfioX. But from pci device p.o.v > > this does introduce a custom node in the directory, which is probably > > what Alex referred to? > > Yup, but not just for pci, we're adding a node into the device > directory for any device bound to vfio. > > > Anyway if required following can be introduced: > > > > diff --git a/Documentation/ABI/testing/sysfs-devices-vfio-dev > b/Documentation/ABI/testing/sysfs-devices-vfio-dev > > new file mode 100644 > > index 000000000000..dfe8baaf1ccb > > --- /dev/null > > +++ b/Documentation/ABI/testing/sysfs-devices-vfio-dev > > @@ -0,0 +1,8 @@ > > +What: /sys/.../<device>/vfio-dev/vfioX/ > > +Date: September 2022 > > +Contact: Yi Liu <yi.l.liu@xxxxxxxxx> > > +Description: > > + This directory is created when the device is bound to a > > + vfio driver. The layout under this directory matches what > > + exists for a standard 'struct device'. 'X' is a random > > + number marking this device in vfio. > > It's not really random, it's a unique index. Seems like a good > starting point. > > > > > At the start I thought it might make more sense to add it into an > > existing vfio ABI file. But looks it doesn't exist. > > > > Curious why nobody asked for ABI doc for /dev/vfio/vfio, /sys/class/vfio, > etc... > > Oversight, there should probably be a sysfs-class-vfio file. Thanks, > I can help add one. btw I plan to respin v2 tomorrow. Regarding to this ABI thing there are three options: 1) Just add sysfs-devices-vfio-dev in this series. Later merge to sysfs-class-vfio once the latter is introduced in a separate patch. 2) Do sysfs-class-vfio in this series, including both existing vfio ABIs and the new vfio-dev. 3) No ABI file in this series. Handle it in a separate patch with sysfs-class-vfio. Which one do you prefer to? Thanks Kevin