PCI/portdrv: Disable bwctrl service if port is fixed at 2.5 GT/s
PATCH v2 1/1 PCI/portdrv: Disable bwctrl service if port is fixed at 2.5 GT/s
Trying to enable bwctrl on an Intel JHL7540 (Titan Ridge) based Thunderbolt port causes a boot hang on at least some systems though the exact reason is not yet understood. As per the spec Thunderbolt PCIe Downstream Ports have a fake Max Link Speed of 2.5 GT/s (USB4 v2 sec 11.2.1):
"Max Link Speed field in the Link Capabilities Register set to 0001b
(data rate of 2.5 GT/s only).
Note: These settings do not represent actual throughput. Throughput is implementation specific and based on the USB4 Fabric performance."
More generally if 2.5 GT/s is the only supported link speed there is no point in throtteling as this is already the lowest possible PCIe speed so don't advertise the capability stopping bwctrl from being probed on these ports.
The PCIe r6.2 specification section 7.5.3.18 recommends to primarily utilize the Supported Link Speeds Vector instead of the Max Link Speeds field to prevent confusion if future specifications allow devices not to support lower speeds. This concern does not apply however when specifically targeting devices claiming support only for 2.5 GT/s.
---
Note: This issue causes a boot hang on my personal workstation.
While there is an ongoing discussion about generalizing this to all
devices with a single supported speed. It turns out however that in my
case dev->supported_speeds incorrectly claims 2.5-8 GT/s requiring
a seperate second fix. So in the interest of simplicity and because I'll
be out from the 19th until January, I'd like to propose to do this simple
fix to the boot hang now and take the time to figure out a more general
approach afterwards.
---
Changes in v2:
- Improve commit message to mention the specific controller and
why using the Max Link Speeds field should be fine here.
- Add a comment (Lukas)
- Add R-b's (no change to logic).
- Link to v1: https://lore.kernel.org/r/[email protected]
--- drivers/pci/pcie/portdrv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/pci/pcie/portdrv.c +6 -1
@@ -270,7 +270,12 @@ static int get_port_device_capability(struct pci_dev *dev)u32 linkcap;pcie_capability_read_dword (dev,PCI_EXP_LNKCAP , &linkcap); -if (linkcap &PCI_EXP_LNKCAP_LBNC ) +/* +* Enable bandwidth control only if more than just the base +* speed of 2.5 GT/s is supported. +*/ +if (linkcap &PCI_EXP_LNKCAP_LBNC && + (linkcap &PCI_EXP_LNKCAP_SLS ) !=PCI_EXP_LNKCAP_SLS_2_5GB ) services |=PCIE_PORT_SERVICE_BWCTRL ; }
---
base-commit: fac04efc5c793dccbd07e2d59af9f90b7fc0dca4
change-id: 20241207-fix_bwctrl_thunderbolt-bd1f96b3d98f
Best regards,
Signature · 1 line
Niklas Schnelle <[email protected]>
Quoted 32 lines · Niklas Schnelle
Trying to enable bwctrl on an Intel JHL7540 (Titan Ridge) based Thunderbolt port causes a boot hang on at least some systems though the exact reason is not yet understood. As per the spec Thunderbolt PCIe Downstream Ports have a fake Max Link Speed of 2.5 GT/s (USB4 v2 sec 11.2.1):
"Max Link Speed field in the Link Capabilities Register set to 0001b
(data rate of 2.5 GT/s only).
Note: These settings do not represent actual throughput. Throughput is implementation specific and based on the USB4 Fabric performance."More generally if 2.5 GT/s is the only supported link speed there is no point in throtteling as this is already the lowest possible PCIe speed so don't advertise the capability stopping bwctrl from being probed on these ports.
The PCIe r6.2 specification section 7.5.3.18 recommends to primarily utilize the Supported Link Speeds Vector instead of the Max Link Speeds field to prevent confusion if future specifications allow devices not to support lower speeds. This concern does not apply however when specifically targeting devices claiming support only for 2.5 GT/s.
Fixes 665745f27487 ("PCI/bwctrl: Re-add BW notification portdrv as PCIe BW controller")Tested-by Niklas Schnelle <[email protected]>Reviewed-by Ilpo Järvinen <[email protected]>Reviewed-by Mika Westerberg <[email protected]>Signed-off-by Niklas Schnelle <[email protected]>---
Note: This issue causes a boot hang on my personal workstation.
Quoted 14 lines
While there is an ongoing discussion about generalizing this to all
devices with a single supported speed. It turns out however that in my
casedev->supported_speedsincorrectly claims 2.5-8 GT/s requiring
a seperate second fix. So in the interest of simplicity and because I'll
be out from the 19th until January, I'd like to propose to do this simple
fix to the boot hang now and take the time to figure out a more general
approach afterwards.
---
Changes in v2:
- Improve commit message to mention the specific controller and
why using the Max Link Speeds field should be fine here.
- Add a comment (Lukas)
- Add R-b's (no change to logic).
- Link to v1: https://lore.kernel.org/r/[email protected]
This is now commit e50e27a613db6f18 ("PCI/portdrv: Disable bwctrl service if port is fixed at 2.5 GT/s") in pci/next, which conflicts with commit 774c71c52aa48700 ("PCI/bwctrl: Enable only if more than one speed is supported") in v6.13-rc4.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Quoted 48 lines · Geert Uytterhoeven
Quoted 32 lines · Niklas Schnelle
Trying to enable bwctrl on an Intel JHL7540 (Titan Ridge) based Thunderbolt port causes a boot hang on at least some systems though the exact reason is not yet understood. As per the spec Thunderbolt PCIe Downstream Ports have a fake Max Link Speed of 2.5 GT/s (USB4 v2 sec 11.2.1):
"Max Link Speed field in the Link Capabilities Register set to 0001b
(data rate of 2.5 GT/s only).
Note: These settings do not represent actual throughput. Throughput is implementation specific and based on the USB4 Fabric performance."More generally if 2.5 GT/s is the only supported link speed there is no point in throtteling as this is already the lowest possible PCIe speed so don't advertise the capability stopping bwctrl from being probed on these ports.
The PCIe r6.2 specification section 7.5.3.18 recommends to primarily utilize the Supported Link Speeds Vector instead of the Max Link Speeds field to prevent confusion if future specifications allow devices not to support lower speeds. This concern does not apply however when specifically targeting devices claiming support only for 2.5 GT/s.
Fixes 665745f27487 ("PCI/bwctrl: Re-add BW notification portdrv as PCIe BW controller")Tested-by Niklas Schnelle <[email protected]>Reviewed-by Ilpo Järvinen <[email protected]>Reviewed-by Mika Westerberg <[email protected]>Signed-off-by Niklas Schnelle <[email protected]>---
Note: This issue causes a boot hang on my personal workstation.Quoted 14 lines
While there is an ongoing discussion about generalizing this to all
devices with a single supported speed. It turns out however that in my
casedev->supported_speedsincorrectly claims 2.5-8 GT/s requiring
a seperate second fix. So in the interest of simplicity and because I'll
be out from the 19th until January, I'd like to propose to do this simple
fix to the boot hang now and take the time to figure out a more general
approach afterwards.
---
Changes in v2:
- Improve commit message to mention the specific controller and
why using the Max Link Speeds field should be fine here.
- Add a comment (Lukas)
- Add R-b's (no change to logic).
- Link to v1: https://lore.kernel.org/r/[email protected]
Quoted 8 lines
This is now commit
e50e27a613db6f18("PCI/portdrv: Disable bwctrl service if port is fixed at 2.5 GT/s") in pci/next, which conflicts with commit774c71c52aa48700("PCI/bwctrl: Enable only if more than one speed is supported") in v6.13-rc4.Gr{oetje,eeting}s,
Geert
Oh, that's not right, good catch. This patch is superseded by "PCI/bwctrl: Enable only if more than one speed is supported" and should be dropped. Sorry if that wasn't clear from the the limited context of this patch discussion. @Bjorn I think this needs to be taken care of by you?
Thanks,
Niklas
Hello,
[...]
Quoted 5 lines
Quoted 5 lines
This is now commit
e50e27a613db6f18("PCI/portdrv: Disable bwctrl service if port is fixed at 2.5 GT/s") in pci/next, which conflicts with commit774c71c52aa48700("PCI/bwctrl: Enable only if more than one speed is supported") in v6.13-rc4.
Quoted 7 lines
Quoted 3 lines
Gr{oetje,eeting}s,
Geert
Oh, that's not right, good catch. This patch is superseded by "PCI/bwctrl: Enable only if more than one speed is supported" and should be dropped.
Done.
Quoted 2 lines
Sorry if that wasn't clear from the the limited context of this patch discussion. @Bjorn I think this needs to be taken care of by you?
No worries. I removed it from our next branch and marked accordingly in Patchwork.
Krzysztof