linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] PCI: rockchip: 5.0 GT/s speed may be dangerous
@ 2025-11-17 21:46 Geraldo Nascimento
  2025-11-17 21:47 ` [PATCH v2 1/4] PCI: rockchip: limit RK3399 to 2.5 GT/s to prevent damage Geraldo Nascimento
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Geraldo Nascimento @ 2025-11-17 21:46 UTC (permalink / raw)
  To: Shawn Lin, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Heiko Stuebner,
	Krzysztof Kozlowski, Conor Dooley, Johan Jonker,
	Geraldo Nascimento, Dragan Simic
  Cc: linux-rockchip, linux-pci, linux-arm-kernel, linux-kernel,
	devicetree

Dragan Simic already had warned me of potential issues with 5.0 GT/s
speed operation in Rockchip PCIe. However, in recent interactions
with Shawn Lin from Rockchip it came to my attention there's grave
danger in the unknown errata regarding 5.0 GT/s operational speed
of their PCIe core. Even if the odds are low, to contain any damage,
let's cover the remaining corner-cases where the default would lead
to 5.0 GT/s operation as well as add a comment to Root Complex driver
core, documenting this danger. Furthermore, remove redundant
declaration of max-link-speed from rk3399-nanopi-r4s.dtsi

Signed-off-by: Geraldo Nascimento <geraldogabriel@gmail.com>

---

Changes in v2:
- hard limit to 2.5 GT/s, not just warn
- add Reported-by: and Reviewed-by: Dragan Simic
- remove redundant declaration of max-link-speed from helios64 dts
- fix Link: of helios64 patch
- simplify RC mode comment
- Link to v1: https://lore.kernel.org/all/aRhR79u5BPtRRFw3@geday/

Geraldo Nascimento (4):
  PCI: rockchip: limit RK3399 to 2.5 GT/s to prevent damage
  PCI: rockchip-host: comment danger of 5.0 GT/s speed
  arm64: dts: rockchip: remove dangerous max-link-speed from helios64
  arm64: dts: rockchip: remove redundant max-link-speed from nanopi-r4s

 arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts |  1 -
 arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dtsi    |  1 -
 drivers/pci/controller/pcie-rockchip-host.c            |  3 +++
 drivers/pci/controller/pcie-rockchip.c                 | 10 ++++++++--
 4 files changed, 11 insertions(+), 4 deletions(-)

-- 
2.49.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/4] PCI: rockchip: limit RK3399 to 2.5 GT/s to prevent damage
  2025-11-17 21:46 [PATCH v2 0/4] PCI: rockchip: 5.0 GT/s speed may be dangerous Geraldo Nascimento
@ 2025-11-17 21:47 ` Geraldo Nascimento
  2025-11-17 21:47 ` [PATCH v2 2/4] PCI: rockchip-host: comment danger of 5.0 GT/s speed Geraldo Nascimento
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Geraldo Nascimento @ 2025-11-17 21:47 UTC (permalink / raw)
  To: Shawn Lin, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Heiko Stuebner,
	Krzysztof Kozlowski, Conor Dooley, Johan Jonker,
	Geraldo Nascimento, Dragan Simic
  Cc: linux-rockchip, linux-pci, linux-arm-kernel, linux-kernel,
	devicetree

Shawn Lin from Rockchip has reiterated that there may be danger in using
their PCIe with 5.0 GT/s speeds. Warn the user if they make a DT change
from the default and drive at 2.5 GT/s only, even if the DT
max-link-speed property is invalid or inexistent.

This change is corroborated by RK3399 official datasheet [1], which
says maximum link speed for this platform is 2.5 GT/s.

[1] https://opensource.rock-chips.com/images/d/d7/Rockchip_RK3399_Datasheet_V2.1-20200323.pdf

Fixes: 956cd99b35a8 ("PCI: rockchip: Separate common code from RC driver")
Link: https://lore.kernel.org/all/ffd05070-9879-4468-94e3-b88968b4c21b@rock-chips.com/
Cc: stable@vger.kernel.org
Reported-by: Dragan Simic <dsimic@manjaro.org>
Reported-by: Shawn Lin <shawn.lin@rock-chips.com>
Reviewed-by: Dragan Simic <dsimic@manjaro.org>
Signed-off-by: Geraldo Nascimento <geraldogabriel@gmail.com>
---
 drivers/pci/controller/pcie-rockchip.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/pcie-rockchip.c b/drivers/pci/controller/pcie-rockchip.c
index 0f88da378805..992ccf4b139e 100644
--- a/drivers/pci/controller/pcie-rockchip.c
+++ b/drivers/pci/controller/pcie-rockchip.c
@@ -66,8 +66,14 @@ int rockchip_pcie_parse_dt(struct rockchip_pcie *rockchip)
 	}
 
 	rockchip->link_gen = of_pci_get_max_link_speed(node);
-	if (rockchip->link_gen < 0 || rockchip->link_gen > 2)
-		rockchip->link_gen = 2;
+	if (rockchip->link_gen < 0 || rockchip->link_gen > 2) {
+		rockchip->link_gen = 1;
+		dev_warn(dev, "invalid max-link-speed, set to 2.5 GT/s\n");
+	}
+	else if (rockchip->link_gen == 2) {
+		rockchip->link_gen = 1;
+		dev_warn(dev, "5.0 GT/s is dangerous, set to 2.5 GT/s\n");
+	}
 
 	for (i = 0; i < ROCKCHIP_NUM_PM_RSTS; i++)
 		rockchip->pm_rsts[i].id = rockchip_pci_pm_rsts[i];
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/4] PCI: rockchip-host: comment danger of 5.0 GT/s speed
  2025-11-17 21:46 [PATCH v2 0/4] PCI: rockchip: 5.0 GT/s speed may be dangerous Geraldo Nascimento
  2025-11-17 21:47 ` [PATCH v2 1/4] PCI: rockchip: limit RK3399 to 2.5 GT/s to prevent damage Geraldo Nascimento
@ 2025-11-17 21:47 ` Geraldo Nascimento
  2025-11-17 21:47 ` [PATCH v2 3/4] arm64: dts: rockchip: remove dangerous max-link-speed from helios64 Geraldo Nascimento
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Geraldo Nascimento @ 2025-11-17 21:47 UTC (permalink / raw)
  To: Shawn Lin, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Heiko Stuebner,
	Krzysztof Kozlowski, Conor Dooley, Johan Jonker,
	Geraldo Nascimento, Dragan Simic
  Cc: linux-rockchip, linux-pci, linux-arm-kernel, linux-kernel,
	devicetree

According to Rockchip sources, there is grave danger in enabling 5.0
GT/s speed for this core. Add a comment documenting that danger and
discouraging end-users from forcing higher speed.

Link: https://lore.kernel.org/all/ffd05070-9879-4468-94e3-b88968b4c21b@rock-chips.com/
Cc: stable@vger.kernel.org
Reported-by: Dragan Simic <dsimic@manjaro.org>
Reported-by: Shawn Lin <shawn.lin@rock-chips.com>
Reviewed-by: Dragan Simic <dsimic@manjaro.org>
Signed-off-by: Geraldo Nascimento <geraldogabriel@gmail.com>
---
 drivers/pci/controller/pcie-rockchip-host.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pci/controller/pcie-rockchip-host.c b/drivers/pci/controller/pcie-rockchip-host.c
index ee1822ca01db..0af550277ee5 100644
--- a/drivers/pci/controller/pcie-rockchip-host.c
+++ b/drivers/pci/controller/pcie-rockchip-host.c
@@ -332,6 +332,9 @@ static int rockchip_pcie_host_init_port(struct rockchip_pcie *rockchip)
 		/*
 		 * Enable retrain for gen2. This should be configured only after
 		 * gen1 finished.
+		 *
+		 * Dangerous and may lead to catastrophic failure eventually!
+		 *
 		 */
 		status = rockchip_pcie_read(rockchip, PCIE_RC_CONFIG_CR + PCI_EXP_LNKCTL2);
 		status &= ~PCI_EXP_LNKCTL2_TLS;
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 3/4] arm64: dts: rockchip: remove dangerous max-link-speed from helios64
  2025-11-17 21:46 [PATCH v2 0/4] PCI: rockchip: 5.0 GT/s speed may be dangerous Geraldo Nascimento
  2025-11-17 21:47 ` [PATCH v2 1/4] PCI: rockchip: limit RK3399 to 2.5 GT/s to prevent damage Geraldo Nascimento
  2025-11-17 21:47 ` [PATCH v2 2/4] PCI: rockchip-host: comment danger of 5.0 GT/s speed Geraldo Nascimento
@ 2025-11-17 21:47 ` Geraldo Nascimento
  2025-11-17 21:47 ` [PATCH v2 4/4] arm64: dts: rockchip: remove redundant max-link-speed from nanopi-r4s Geraldo Nascimento
  2025-11-18  0:43 ` [PATCH v2 0/4] PCI: rockchip: 5.0 GT/s speed may be dangerous Shawn Lin
  4 siblings, 0 replies; 6+ messages in thread
From: Geraldo Nascimento @ 2025-11-17 21:47 UTC (permalink / raw)
  To: Shawn Lin, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Heiko Stuebner,
	Krzysztof Kozlowski, Conor Dooley, Johan Jonker,
	Geraldo Nascimento, Dragan Simic
  Cc: linux-rockchip, linux-pci, linux-arm-kernel, linux-kernel,
	devicetree

Shawn Lin from Rockchip strongly discourages attempts to use their
RK3399 PCIe core at 5.0 GT/s speed, citing concerns about catastrophic
failures that may happen. Even if the odds are low, drop from last user
of this non-default property for the RK3399 platform, helios64 board
dts.

Fixes: 755fff528b1b ("arm64: dts: rockchip: add variables for pcie completion to helios64")
Link: https://lore.kernel.org/all/e8524bf8-a90c-423f-8a58-9ef05a3db1dd@rock-chips.com/
Cc: stable@vger.kernel.org
Reported-by: Shawn Lin <shawn.lin@rock-chips.com>
Reviewed-by: Dragan Simic <dsimic@manjaro.org>
Signed-off-by: Geraldo Nascimento <geraldogabriel@gmail.com>
---
 arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
index e7d4a2f9a95e..78a7775c3b22 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
@@ -424,7 +424,6 @@ &pcie_phy {
 
 &pcie0 {
 	ep-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_HIGH>;
-	max-link-speed = <2>;
 	num-lanes = <2>;
 	pinctrl-names = "default";
 	status = "okay";
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 4/4] arm64: dts: rockchip: remove redundant max-link-speed from nanopi-r4s
  2025-11-17 21:46 [PATCH v2 0/4] PCI: rockchip: 5.0 GT/s speed may be dangerous Geraldo Nascimento
                   ` (2 preceding siblings ...)
  2025-11-17 21:47 ` [PATCH v2 3/4] arm64: dts: rockchip: remove dangerous max-link-speed from helios64 Geraldo Nascimento
@ 2025-11-17 21:47 ` Geraldo Nascimento
  2025-11-18  0:43 ` [PATCH v2 0/4] PCI: rockchip: 5.0 GT/s speed may be dangerous Shawn Lin
  4 siblings, 0 replies; 6+ messages in thread
From: Geraldo Nascimento @ 2025-11-17 21:47 UTC (permalink / raw)
  To: Shawn Lin, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Heiko Stuebner,
	Krzysztof Kozlowski, Conor Dooley, Johan Jonker,
	Geraldo Nascimento, Dragan Simic
  Cc: linux-rockchip, linux-pci, linux-arm-kernel, linux-kernel,
	devicetree

This is already the default in rk3399-base.dtsi, remove redundant
declaration from rk3399-nanopi-r4s.dtsi.

Fixes: db792e9adbf8 ("rockchip: rk3399: Add support for FriendlyARM NanoPi R4S")
Cc: stable@vger.kernel.org
Reported-by: Dragan Simic <dsimic@manjaro.org>
Reviewed-by: Dragan Simic <dsimic@manjaro.org>
Signed-off-by: Geraldo Nascimento <geraldogabriel@gmail.com>
---
 arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dtsi | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dtsi
index 8d94d9f91a5c..3a9a10f531bd 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dtsi
@@ -71,7 +71,6 @@ &i2c4 {
 };
 
 &pcie0 {
-	max-link-speed = <1>;
 	num-lanes = <1>;
 	vpcie3v3-supply = <&vcc3v3_sys>;
 };
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 0/4] PCI: rockchip: 5.0 GT/s speed may be dangerous
  2025-11-17 21:46 [PATCH v2 0/4] PCI: rockchip: 5.0 GT/s speed may be dangerous Geraldo Nascimento
                   ` (3 preceding siblings ...)
  2025-11-17 21:47 ` [PATCH v2 4/4] arm64: dts: rockchip: remove redundant max-link-speed from nanopi-r4s Geraldo Nascimento
@ 2025-11-18  0:43 ` Shawn Lin
  4 siblings, 0 replies; 6+ messages in thread
From: Shawn Lin @ 2025-11-18  0:43 UTC (permalink / raw)
  To: Geraldo Nascimento
  Cc: shawn.lin, linux-rockchip, linux-pci, linux-arm-kernel,
	linux-kernel, devicetree, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
	Bjorn Helgaas, Heiko Stuebner, Krzysztof Kozlowski, Conor Dooley,
	Johan Jonker, Dragan Simic

在 2025/11/18 星期二 5:46, Geraldo Nascimento 写道:
> Dragan Simic already had warned me of potential issues with 5.0 GT/s
> speed operation in Rockchip PCIe. However, in recent interactions
> with Shawn Lin from Rockchip it came to my attention there's grave
> danger in the unknown errata regarding 5.0 GT/s operational speed
> of their PCIe core. Even if the odds are low, to contain any damage,
> let's cover the remaining corner-cases where the default would lead
> to 5.0 GT/s operation as well as add a comment to Root Complex driver
> core, documenting this danger. Furthermore, remove redundant
> declaration of max-link-speed from rk3399-nanopi-r4s.dtsi
> 
> Signed-off-by: Geraldo Nascimento <geraldogabriel@gmail.com>
> 

Thanks for fixing these.

Acked-by: Shawn Lin <shawn.lin@rock-chips.com>

> ---
> 
> Changes in v2:
> - hard limit to 2.5 GT/s, not just warn
> - add Reported-by: and Reviewed-by: Dragan Simic
> - remove redundant declaration of max-link-speed from helios64 dts
> - fix Link: of helios64 patch
> - simplify RC mode comment
> - Link to v1: https://lore.kernel.org/all/aRhR79u5BPtRRFw3@geday/
> 
> Geraldo Nascimento (4):
>    PCI: rockchip: limit RK3399 to 2.5 GT/s to prevent damage
>    PCI: rockchip-host: comment danger of 5.0 GT/s speed
>    arm64: dts: rockchip: remove dangerous max-link-speed from helios64
>    arm64: dts: rockchip: remove redundant max-link-speed from nanopi-r4s
> 
>   arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts |  1 -
>   arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dtsi    |  1 -
>   drivers/pci/controller/pcie-rockchip-host.c            |  3 +++
>   drivers/pci/controller/pcie-rockchip.c                 | 10 ++++++++--
>   4 files changed, 11 insertions(+), 4 deletions(-)
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-11-18  0:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-17 21:46 [PATCH v2 0/4] PCI: rockchip: 5.0 GT/s speed may be dangerous Geraldo Nascimento
2025-11-17 21:47 ` [PATCH v2 1/4] PCI: rockchip: limit RK3399 to 2.5 GT/s to prevent damage Geraldo Nascimento
2025-11-17 21:47 ` [PATCH v2 2/4] PCI: rockchip-host: comment danger of 5.0 GT/s speed Geraldo Nascimento
2025-11-17 21:47 ` [PATCH v2 3/4] arm64: dts: rockchip: remove dangerous max-link-speed from helios64 Geraldo Nascimento
2025-11-17 21:47 ` [PATCH v2 4/4] arm64: dts: rockchip: remove redundant max-link-speed from nanopi-r4s Geraldo Nascimento
2025-11-18  0:43 ` [PATCH v2 0/4] PCI: rockchip: 5.0 GT/s speed may be dangerous Shawn Lin

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).