linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
To: Bean Huo <beanhuo@iokpp.de>, bhelgaas@google.com, schnelle@linux.ibm.com
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	Bean Huo <beanhuo@micron.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v2] PCI: Increase maximum PCIe physical function number to 7 for non-ARI devices
Date: Fri, 16 Feb 2024 14:26:47 -0800	[thread overview]
Message-ID: <4858e202-6097-493a-8405-86d3e8e17c83@linux.intel.com> (raw)
In-Reply-To: <20240216190113.20341-1-beanhuo@iokpp.de>


On 2/16/24 11:01 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.
I would quote specification reference here, like below:

As per PCIe specification r6.2, sec titled "Alternative Routing-ID Interpretation
(ARI)", up to 8 [fn # 0..7] functions are allowed in an non ARI capable device.

It looks like for an ARI capable device the limit is 256. Why not add that
check as well?

>
> 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.
>
> The necessity for this adjustment was verified by a thorough review of the
> "Alternative Routing-ID Interpretation (ARI)" section in the PCIe 3.0 Spec,
> which first introduced ARI.

I would always use latest PCIe spec for reference.

>
> Fixes: c3df83e01a96 ("PCI: Clean up pci_scan_slot()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Bean Huo <beanhuo@micron.com>
> ---
> Changelog:
> 	v1--v2:
> 		1. Add Fixes tag
> 		2. Modify commit message
> ---
>  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


  reply	other threads:[~2024-02-16 22:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-16 19:01 [PATCH v2] PCI: Increase maximum PCIe physical function number to 7 for non-ARI devices Bean Huo
2024-02-16 22:26 ` Kuppuswamy Sathyanarayanan [this message]
2024-02-16 22:41   ` Bjorn Helgaas
2024-02-19 10:50   ` Bean Huo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4858e202-6097-493a-8405-86d3e8e17c83@linux.intel.com \
    --to=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=beanhuo@iokpp.de \
    --cc=beanhuo@micron.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=schnelle@linux.ibm.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).