Skip to contentSkip to conversation

PCI: Increase maximum PCIe physical function number to 7 for non-ARI devices

PATCH Superseded Bean Huo 2 participants 2 messages Feb 16, 2024 PCI

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Bean Huo

author
#0 lore raw

PATCH 1/1 PCI: Increase maximum PCIe physical function number to 7 for non-ARI devices

From: Bean Huo <[email protected]>

The PCIe specification allows up to 8 Physical Functions (PFs) per endpoint when ARI (Alternative Routing-ID Interpretation) is not supported. Previously, our implementation erroneously limited the maximum number of PFs to 7 for endpoints without ARI support.

This patch corrects the maximum PF count to adhere to the PCIe specification by allowing up to 8 PFs on non-ARI endpoints. This change ensures better compliance with the standard and improves compatibility with devices relying on this specification.

This adjustment was verified against the PCIe spec (reference specific sections if applicable) and tested with a range of PCIe devices not supporting ARI to ensure no regressions in functionality.

---
 drivers/pci/probe.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/probe.c +2 -1
index ed6b7f48736a..8c3d0f63bc13 100644
@@ -2630,7 +2630,8 @@ static int next_fn(struct pci_bus *bus, struct pci_dev *dev, int fn)
 	if (pci_ari_enabled(bus))
 		return next_ari_fn(bus, dev, fn);
 
-	if (fn >= 7)
+	/* If EP does not support ARI, the maximum number of functions should be 7 */
+	if (fn > 7)
 		return -ENODEV;
 	/* only multifunction devices may have more functions */
 	if (dev && !dev->multifunction)
Signature · 1 line
2.34.1
#1 lore raw
Quoted 6 lines · Bean Huo

From: Bean Huo <[email protected]>

The PCIe specification allows up to 8 Physical Functions (PFs) per endpoint when ARI (Alternative Routing-ID Interpretation) is not supported. Previously, our implementation erroneously limited the maximum number of PFs to 7 for endpoints without ARI support.

Can you include the spec section and revision details?

I assume it is section "Alternative Routing-ID Interpretation"

Quoted 6 lines

This patch corrects the maximum PF count to adhere to the PCIe specification by allowing up to 8 PFs on non-ARI endpoints. This change ensures better compliance with the standard and improves compatibility with devices relying on this specification.

Quoted 6 lines

This adjustment was verified against the PCIe spec (reference specific sections if applicable) and tested with a range of PCIe devices not supporting ARI to ensure no regressions in functionality.

---

Since it is a bug fix, I think you need a Fixes: tag as well.

Quoted 17 lines
 drivers/pci/probe.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/probe.c +2 -1
index ed6b7f48736a..8c3d0f63bc13 100644
@@ -2630,7 +2630,8 @@ static int next_fn(struct pci_bus *bus, struct pci_dev *dev, int fn)
 	if (pci_ari_enabled(bus))
 		return next_ari_fn(bus, dev, fn);
 
-	if (fn >= 7)
+	/* If EP does not support ARI, the maximum number of functions should be 7 */
+	if (fn > 7)
 		return -ENODEV;
 	/* only multifunction devices may have more functions */
 	if (dev && !dev->multifunction)
Signature · 2 lines
Sathyanarayanan Kuppuswamy
Linux Kernel Developer