[Intel-gfx] [PATCH 15/15] vfio: Add struct device to vfio_device
Alex Williamson
alex.williamson at redhat.com
Wed Aug 31 17:15:12 UTC 2022
On Wed, 31 Aug 2022 06:10:51 +0000
"Tian, Kevin" <kevin.tian at intel.com> wrote:
> > From: Jason Gunthorpe <jgg at ziepe.ca>
> > 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 at intel.com> wrote:
> > >
> > > > From: Yi Liu <yi.l.liu at 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.
> > >
> > > 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 at intel.com>
> +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,
Alex
More information about the Intel-gfx
mailing list