* [PATCH v1] PCI: Increase maximum PCIe physical function number to 7 for non-ARI devices
@ 2024-02-16 17:24 Bean Huo
  2024-02-16 17:53 ` Kuppuswamy Sathyanarayanan
  0 siblings, 1 reply; 2+ messages in thread
From: Bean Huo @ 2024-02-16 17:24 UTC (permalink / raw)
  To: bhelgaas, schnelle; +Cc: linux-pci, linux-kernel, Bean Huo
From: Bean Huo <beanhuo@micron.com>
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.
Signed-off-by: Bean Huo <beanhuo@micron.com>
---
 drivers/pci/probe.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ed6b7f48736a..8c3d0f63bc13 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -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)
-- 
2.34.1
^ permalink raw reply related	[flat|nested] 2+ messages in thread
* Re: [PATCH v1] PCI: Increase maximum PCIe physical function number to 7 for non-ARI devices
  2024-02-16 17:24 [PATCH v1] PCI: Increase maximum PCIe physical function number to 7 for non-ARI devices Bean Huo
@ 2024-02-16 17:53 ` Kuppuswamy Sathyanarayanan
  0 siblings, 0 replies; 2+ messages in thread
From: Kuppuswamy Sathyanarayanan @ 2024-02-16 17:53 UTC (permalink / raw)
  To: Bean Huo, bhelgaas, schnelle; +Cc: linux-pci, linux-kernel, Bean Huo
On 2/16/24 9:24 AM, Bean Huo wrote:
> From: Bean Huo <beanhuo@micron.com>
>
> 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"
>
> 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.
>
> Signed-off-by: Bean Huo <beanhuo@micron.com>
> ---
Since it is a bug fix, I think you need a Fixes: tag as well.
>  drivers/pci/probe.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index ed6b7f48736a..8c3d0f63bc13 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -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)
-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer
^ permalink raw reply	[flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-16 17:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-16 17:24 [PATCH v1] PCI: Increase maximum PCIe physical function number to 7 for non-ARI devices Bean Huo
2024-02-16 17:53 ` Kuppuswamy Sathyanarayanan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).