* [PATCH] PCI: tegra264: Fix Link Capabilities register offset
@ 2026-08-27 9:39 Linmao Li
2026-08-27 9:46 ` sashiko-bot
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Linmao Li @ 2026-08-27 9:39 UTC (permalink / raw)
To: thierry.reding, lpieralisi, kwilczynski, mani
Cc: robh, bhelgaas, jonathanh, mmaddireddy, linux-tegra, linux-pci,
linux-kernel, Linmao Li
The PCI Express Link Capabilities and Link Status registers are at offsets
0x0c and 0x12 from the capability header, respectively. Since the driver
uses 0x5a for Link Status, Link Capabilities starts at 0x54, not 0x56.
Reading a 16-bit value at 0x56 returns the upper half of the Link
Capabilities register. When a hotplug-capable port has no link during
probe, tegra264_pcie_icc_set() consequently derives the maximum speed and
width from unrelated bits and requests the wrong interconnect bandwidth.
Use the correct Link Capabilities offset.
Fixes: 01c3c27a0ef6 ("PCI: tegra264: Add Tegra264 support")
Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
---
drivers/pci/controller/pcie-tegra264.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/controller/pcie-tegra264.c b/drivers/pci/controller/pcie-tegra264.c
index 653136db401e0..3a672d18c4d2d 100644
--- a/drivers/pci/controller/pcie-tegra264.c
+++ b/drivers/pci/controller/pcie-tegra264.c
@@ -49,7 +49,7 @@
#define XAL_RC_BAR_CNTL_STANDARD_64B_BAR_EN BIT(2)
/* XTL registers */
-#define XTL_RC_PCIE_CFG_LINK_CAPS 0x56
+#define XTL_RC_PCIE_CFG_LINK_CAPS 0x54
#define XTL_RC_PCIE_CFG_LINK_STATUS 0x5a
#define XTL_RC_MGMT_PERST_CONTROL 0x218
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] PCI: tegra264: Fix Link Capabilities register offset
2026-08-27 9:39 [PATCH] PCI: tegra264: Fix Link Capabilities register offset Linmao Li
@ 2026-08-27 9:46 ` sashiko-bot
2026-08-27 10:02 ` Thierry Reding
2026-08-27 17:03 ` Bjorn Helgaas
2 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-08-27 9:46 UTC (permalink / raw)
To: Linmao Li; +Cc: linux-pci
> The PCI Express Link Capabilities and Link Status registers are at offsets
> 0x0c and 0x12 from the capability header, respectively. Since the driver
> uses 0x5a for Link Status, Link Capabilities starts at 0x54, not 0x56.
>
> Reading a 16-bit value at 0x56 returns the upper half of the Link
> Capabilities register. When a hotplug-capable port has no link during
> probe, tegra264_pcie_icc_set() consequently derives the maximum speed and
> width from unrelated bits and requests the wrong interconnect bandwidth.
>
> Use the correct Link Capabilities offset.
>
> Fixes: 01c3c27a0ef6 ("PCI: tegra264: Add Tegra264 support")
> Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260827093919.2825467-1-lilinmao@kylinos.cn?part=1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] PCI: tegra264: Fix Link Capabilities register offset
2026-08-27 9:39 [PATCH] PCI: tegra264: Fix Link Capabilities register offset Linmao Li
2026-08-27 9:46 ` sashiko-bot
@ 2026-08-27 10:02 ` Thierry Reding
2026-08-27 17:03 ` Bjorn Helgaas
2 siblings, 0 replies; 5+ messages in thread
From: Thierry Reding @ 2026-08-27 10:02 UTC (permalink / raw)
To: Linmao Li
Cc: lpieralisi, kwilczynski, mani, robh, bhelgaas, jonathanh,
mmaddireddy, linux-tegra, linux-pci, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 957 bytes --]
On Thu, Aug 27, 2026 at 05:39:19PM +0800, Linmao Li wrote:
> The PCI Express Link Capabilities and Link Status registers are at offsets
> 0x0c and 0x12 from the capability header, respectively. Since the driver
> uses 0x5a for Link Status, Link Capabilities starts at 0x54, not 0x56.
>
> Reading a 16-bit value at 0x56 returns the upper half of the Link
> Capabilities register. When a hotplug-capable port has no link during
> probe, tegra264_pcie_icc_set() consequently derives the maximum speed and
> width from unrelated bits and requests the wrong interconnect bandwidth.
>
> Use the correct Link Capabilities offset.
>
> Fixes: 01c3c27a0ef6 ("PCI: tegra264: Add Tegra264 support")
> Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
> ---
> drivers/pci/controller/pcie-tegra264.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Yes, that's what the manual says, too. /o\
Acked-by: Thierry Reding <treding@nvidia.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] PCI: tegra264: Fix Link Capabilities register offset
2026-08-27 9:39 [PATCH] PCI: tegra264: Fix Link Capabilities register offset Linmao Li
2026-08-27 9:46 ` sashiko-bot
2026-08-27 10:02 ` Thierry Reding
@ 2026-08-27 17:03 ` Bjorn Helgaas
2026-08-27 17:11 ` Thierry Reding
2 siblings, 1 reply; 5+ messages in thread
From: Bjorn Helgaas @ 2026-08-27 17:03 UTC (permalink / raw)
To: Linmao Li
Cc: thierry.reding, lpieralisi, kwilczynski, mani, robh, bhelgaas,
jonathanh, mmaddireddy, linux-tegra, linux-pci, linux-kernel
On Thu, Aug 27, 2026 at 05:39:19PM +0800, Linmao Li wrote:
> The PCI Express Link Capabilities and Link Status registers are at offsets
> 0x0c and 0x12 from the capability header, respectively. Since the driver
> uses 0x5a for Link Status, Link Capabilities starts at 0x54, not 0x56.
>
> Reading a 16-bit value at 0x56 returns the upper half of the Link
> Capabilities register. When a hotplug-capable port has no link during
> probe, tegra264_pcie_icc_set() consequently derives the maximum speed and
> width from unrelated bits and requests the wrong interconnect bandwidth.
>
> Use the correct Link Capabilities offset.
>
> Fixes: 01c3c27a0ef6 ("PCI: tegra264: Add Tegra264 support")
> Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
> ---
> drivers/pci/controller/pcie-tegra264.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/pcie-tegra264.c b/drivers/pci/controller/pcie-tegra264.c
> index 653136db401e0..3a672d18c4d2d 100644
> --- a/drivers/pci/controller/pcie-tegra264.c
> +++ b/drivers/pci/controller/pcie-tegra264.c
> @@ -49,7 +49,7 @@
> #define XAL_RC_BAR_CNTL_STANDARD_64B_BAR_EN BIT(2)
>
> /* XTL registers */
> -#define XTL_RC_PCIE_CFG_LINK_CAPS 0x56
> +#define XTL_RC_PCIE_CFG_LINK_CAPS 0x54
> #define XTL_RC_PCIE_CFG_LINK_STATUS 0x5a
If this is a standard PCIe Capability, and since we use the standard
#defines like PCI_EXP_LNKSTA_CLS and PCI_EXP_LNKCAP_SLS for values
read from it, it appears to be, I think these XTL_RC* #defines should
somehow be based on the existing PCI_EXP_LNKSTA and PCI_EXP_LNKCAP.
E.g., we could read from pcie->ecam + XTL_RC_PCIE_CAP + PCI_EXP_LNKSTA.
That way grep would be more useful.
> #define XTL_RC_MGMT_PERST_CONTROL 0x218
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] PCI: tegra264: Fix Link Capabilities register offset
2026-08-27 17:03 ` Bjorn Helgaas
@ 2026-08-27 17:11 ` Thierry Reding
0 siblings, 0 replies; 5+ messages in thread
From: Thierry Reding @ 2026-08-27 17:11 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Linmao Li, lpieralisi, kwilczynski, mani, robh, bhelgaas,
jonathanh, mmaddireddy, linux-tegra, linux-pci, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2020 bytes --]
On Thu, Aug 27, 2026 at 12:03:58PM -0500, Bjorn Helgaas wrote:
> On Thu, Aug 27, 2026 at 05:39:19PM +0800, Linmao Li wrote:
> > The PCI Express Link Capabilities and Link Status registers are at offsets
> > 0x0c and 0x12 from the capability header, respectively. Since the driver
> > uses 0x5a for Link Status, Link Capabilities starts at 0x54, not 0x56.
> >
> > Reading a 16-bit value at 0x56 returns the upper half of the Link
> > Capabilities register. When a hotplug-capable port has no link during
> > probe, tegra264_pcie_icc_set() consequently derives the maximum speed and
> > width from unrelated bits and requests the wrong interconnect bandwidth.
> >
> > Use the correct Link Capabilities offset.
> >
> > Fixes: 01c3c27a0ef6 ("PCI: tegra264: Add Tegra264 support")
> > Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
> > ---
> > drivers/pci/controller/pcie-tegra264.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/pci/controller/pcie-tegra264.c b/drivers/pci/controller/pcie-tegra264.c
> > index 653136db401e0..3a672d18c4d2d 100644
> > --- a/drivers/pci/controller/pcie-tegra264.c
> > +++ b/drivers/pci/controller/pcie-tegra264.c
> > @@ -49,7 +49,7 @@
> > #define XAL_RC_BAR_CNTL_STANDARD_64B_BAR_EN BIT(2)
> >
> > /* XTL registers */
> > -#define XTL_RC_PCIE_CFG_LINK_CAPS 0x56
> > +#define XTL_RC_PCIE_CFG_LINK_CAPS 0x54
> > #define XTL_RC_PCIE_CFG_LINK_STATUS 0x5a
>
> If this is a standard PCIe Capability, and since we use the standard
> #defines like PCI_EXP_LNKSTA_CLS and PCI_EXP_LNKCAP_SLS for values
> read from it, it appears to be, I think these XTL_RC* #defines should
> somehow be based on the existing PCI_EXP_LNKSTA and PCI_EXP_LNKCAP.
>
> E.g., we could read from pcie->ecam + XTL_RC_PCIE_CAP + PCI_EXP_LNKSTA.
> That way grep would be more useful.
That's a good point. And, yes, this does look like a regular PCIe
capability, so I'll try to rework this using the standard defines.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-08-27 17:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-27 9:39 [PATCH] PCI: tegra264: Fix Link Capabilities register offset Linmao Li
2026-08-27 9:46 ` sashiko-bot
2026-08-27 10:02 ` Thierry Reding
2026-08-27 17:03 ` Bjorn Helgaas
2026-08-27 17:11 ` Thierry Reding
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox