[PATCH v7 0/2] PCI: of: Remove max-link-speed generation validation

From: Hans Zhang

Date: Sun Mar 08 2026 - 10:27:41 EST


This series removes the hardcoded max-link-speed validation from
of_pci_get_max_link_speed() to avoid updating the kernel for every new
PCIe generation. As pointed out by Bjorn Helgaas, the removal must be
accompanied by proper validation in callers to ensure robustness.
Therefore, this series also adds validation in the DWC controller driver,
which is a primary user of this function.

Patch 1 simplifies of_pci_get_max_link_speed() by returning the raw
property value (including error codes) without imposing an artificial
upper bound. Patch 2 introduces dw_pcie_get_link_speed() in the DWC core
to validate the retrieved speed against the known pcie_link_speed array,
falling back to Gen1 (safe default) if the value is missing or invalid.

---
Changes for v7:
- Add validation in dw_pcie_get_link_speed() (Bjorn)
- Modify it so that two patches constitute one series.

Changes for v6:
https://patchwork.kernel.org/project/linux-pci/patch/20251218132036.308094-1-18255117159@xxxxxxx/

- It'd be good to return the actual errno as of_property_read_u32() can return
-EINVAL, -ENODATA and -EOVERFLOW. (Mani)

Changes for v5:
https://patchwork.kernel.org/project/linux-pci/patch/20251218125909.305300-1-18255117159@xxxxxxx/

- Delete the check for speed. (Mani)

Changes for v4:
https://patchwork.kernel.org/project/linux-pci/patch/20251105134701.182795-1-18255117159@xxxxxxx/

- Add pcie_max_supported_link_speed.(Ilpo)

Changes for v3:
https://patchwork.kernel.org/project/linux-pci/patch/20251101164132.14145-1-18255117159@xxxxxxx/

- Modify the commit message.
- Add Reviewed-by tag.

Changes for v2:
https://patchwork.kernel.org/project/linux-pci/cover/20250529021026.475861-1-18255117159@xxxxxxx/
- The following files have been deleted:
Documentation/devicetree/bindings/pci/pci.txt

Update to this file again:
dtschema/schemas/pci/pci-bus-common.yaml
---

Hans Zhang (2):
PCI: of: Remove max-link-speed generation validation
PCI: dwc: Validate max-link-speed property

drivers/pci/controller/dwc/pcie-designware.c | 29 +++++++++++++++++++-
drivers/pci/of.c | 7 +++--
2 files changed, 32 insertions(+), 4 deletions(-)


base-commit: c23719abc3308df7ed3ad35650ad211fb2d2003d
--
2.34.1