public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Achal Verma <a-verma1@ti.com>
Cc: Vignesh Raghavendra <vigneshr@ti.com>,
	Tom Joseph <tjoseph@cadence.com>,
	Lorenzo Pieralisi <lpieralisi@kernel.org>,
	Krzysztof Wilczy_ski <kw@linux.com>,
	Rob Herring <robh@kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	linux-omap@vger.kernel.org, linux-pci@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: cadence: Set the AFS bit in Device Capabilities 2 Register
Date: Wed, 2 Aug 2023 11:19:53 -0500	[thread overview]
Message-ID: <20230802161953.GA60043@bhelgaas> (raw)
In-Reply-To: <20230802103059.3492181-1-a-verma1@ti.com>

In subject, "Advertise ARI Forwarding Supported".

It's not obvious that "AFS" refers to ARI Forwarding Supported, and
the bit name is enough; we don't need to know that it's in Dev Cap 2.
"Advertise" shows that we're just *advertising* the functionality, not
*enabling* it.

On Wed, Aug 02, 2023 at 04:00:59PM +0530, Achal Verma wrote:
> J7 PCIe Root Complex has ARI Forwarding Support, means supporting
> forwarding of TLPs addressed to functions with function number greater than
> 7 but some PCIe instances on J7 have this bit cleared which results in
> failure of forwarding of TLPs destined for function number > 7.
> Setting the AFS bit in Device Capabilities 2 Register explicitly, resolves
> the issue and leads to successful access to function number > 7.

s/AFS/ARI Forwarding Supported/

> Some observations:
> 1. J7200-EVB has single PCIe instance(PCIe1) for which ARIFwd bit is not
>    set. Enumeration gracefully fails for funciton number greater than 7 but
>    later read/write access to these funcitons results in a crash.

By "ARIFwd bit" here, I assume you mean PCI_EXP_DEVCAP2_ARI in the Root
Port?  Maybe you can use the #define to make this more greppable.

s/funciton/function/ (twice)

If we don't enumerate function numbers greater than 7, we shouldn't
have pci_dev structs for them, so why are there later read/write
config accesses to them?

If the Root Port doesn't advertise ARI Forwarding Supported,
bridge->ari_enabled will not be set, and we shouldn't even try to
enumerate functions greater than 7.  So it's not that enumeration
*fails*; it just doesn't happen at all.

> 2. On J721E-EVB, PCIe1 instance has ARIFwd bit set while it is cleared for
>    PCIe0 instance. This issue combined with errata i2086
>    (Unsupported Request (UR) Response Results in External Abort) results in
>    SERROR while scanning multi-function endpoint device.

Is the SERROR when scanning under PCIe0 or under PCIe1?

I'm not clear on what's happening here:

  1) Root Port advertises PCI_EXP_DEVCAP2_ARI, we set
     bridge->ari_enabled and scan functions > 7, we do a config read
     to function 8, get a UR response (as expected during enumeration)
     and that results in SERROR?

  2) Root Port *doesn't* advertise PCI_EXP_DEVCAP2_ARI, we don't set
     bridge->ari_enabled, so we don't try config read to function 8,
     and something blows up later?

  3) Something else?

> @@ -507,6 +507,7 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
>  	struct cdns_pcie *pcie;
>  	struct resource *res;
>  	int ret;
> +	u32 pcie_cap2;
>  
>  	bridge = pci_host_bridge_from_priv(rc);
>  	if (!bridge)
> @@ -536,6 +537,12 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
>  	if (rc->quirk_detect_quiet_flag)
>  		cdns_pcie_detect_quiet_min_delay_set(&rc->pcie);
>  
> +	if (rc->set_afs_bit) {
> +		pcie_cap2 = cdns_pcie_rp_readl(pcie, CDNS_PCIE_RP_CAP_OFFSET + PCI_EXP_DEVCAP2);
> +		pcie_cap2 |= PCI_EXP_DEVCAP2_ARI;
> +		cdns_pcie_rp_writel(pcie, CDNS_PCIE_RP_CAP_OFFSET + PCI_EXP_DEVCAP2, pcie_cap2);
> +	}

This seems like a j721e defect; why does the workaround need to be in
the generic cadence code?

Bjorn

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-08-02 16:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02 10:30 [PATCH] PCI: cadence: Set the AFS bit in Device Capabilities 2 Register Achal Verma
2023-08-02 16:19 ` Bjorn Helgaas [this message]
2023-08-04  7:52   ` [EXTERNAL] " Verma, Achal
2023-08-08 22:49     ` Bjorn Helgaas

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=20230802161953.GA60043@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=a-verma1@ti.com \
    --cc=bhelgaas@google.com \
    --cc=kw@linux.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=robh@kernel.org \
    --cc=tjoseph@cadence.com \
    --cc=vigneshr@ti.com \
    /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