Re: [PATCH v16 3/4] PCI/DOE: Expose the DOE features via sysfs

From: Bjorn Helgaas
Date: Wed Mar 05 2025 - 15:05:11 EST


On Thu, Feb 27, 2025 at 02:34:02PM +1000, Alistair Francis wrote:
> The PCIe 6 specification added support for the Data Object
> Exchange (DOE).

> +++ b/drivers/pci/probe.c
> @@ -2662,6 +2662,9 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
> WARN_ON(ret < 0);
>
> pci_npem_create(dev);
> +
> + ret = pci_doe_sysfs_init(dev);
> + WARN_ON(ret < 0);

IIUC the "doe_features" directory is added implicitly by
device_add_attrs() in device_add(), but the *contents* of that
directory can't be done that way because they're dynamic, based on the
DOE features we discovered.

I see that we WARN_ON() for device_add() failure, but it doesn't
really seem like much of an error handling strategy in either case.
I think we'll just get a stack trace that's alarming and probably not
useful.

I think it might be more useful to use pci_warn() at the interesting
places that might fail inside pci_doe_sysfs_init(), e.g., where we
know the name of the relevant feature, and make pci_doe_sysfs_init()
itself void.