Re: [PATCH v4] PCI/DOE: Expose the DOE protocols via sysfs

From: Greg KH
Date: Fri Aug 11 2023 - 15:47:53 EST


On Fri, Aug 11, 2023 at 02:40:45PM -0400, Alistair Francis wrote:
> On Thu, Aug 10, 2023 at 9:04 PM Damien Le Moal <dlemoal@xxxxxxxxxx> wrote:
> >
> > On 8/11/23 01:33, Alistair Francis wrote:
> > > The PCIe 6 specification added support for the Data Object Exchange (DOE).
> > > When DOE is supported the Discovery Data Object Protocol must be
> > > implemented. The protocol allows a requester to obtain information about
> > > the other DOE protocols supported by the device.
> > >
> > > The kernel is already querying the DOE protocols supported and cacheing
> > > the values. This patch exposes the values via sysfs. This will allow
> > > userspace to determine which DOE protocols are supported by the PCIe
> > > device.
> > >
> > > By exposing the information to userspace tools like lspci can relay the
> > > information to users. By listing all of the supported protocols we can
> > > allow userspace to parse and support the list, which might include
> > > vendor specific protocols as well as yet to be supported protocols.
> > >
> > > Each DOE feature is exposed as a single file. The files are empty and
> > > the information is contained in the file name.
> >
> > s/feature/protocol ?
>
> Fixed
>
> >
> > Personally, I would still have each file content repeat the same information as
> > the file name specifies. That is, file value == file name. That will avoid
> > people getting confused as empty sysfs files are rather uncommon.
>
> I don't see an obvious way to implement that with the .show()
> function. I don't see a clear way to know what file the user accessed.

The show callback gets a pointer to the attribute it was called with, so
you know the file that was opened and can figure it out from there as to
what it should print out.

I think right now it returns an error, right? That's not good as
userspace is going to think "this attribute really isn't there if I
can't read from it" as that is how all other sysfs files work.

thanks,

greg k-h