Skip to content

FROMLIST: PCI/bwctrl: Set host bridge OPP and optionally disable ASPM around link retraining - #1475

Open
krishna-chundru wants to merge 2 commits into
qualcomm-linux:qcom-7.3from
krishna-chundru:bwctrl-opp-freq-width
Open

krishna-chundru wants to merge 2 commits into
qualcomm-linux:qcom-7.3from
krishna-chundru:bwctrl-opp-freq-width

Conversation

@krishna-chundru

@krishna-chundru krishna-chundru commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

PCIe host bridge devices may need their operating point raised before
retraining to a higher link speed so that hardware resources (e.g., RPMh
votes on Qualcomm platforms) are available at the requested data rate.
After retraining, the operating point must be updated to reflect the
actual negotiated speed.

Add pcie_set_opp() to look up an OPP on the host bridge parent device
using a key of (total link rate in kHz, LNKCTL2 Target Link Speed
level). The total link rate is the per-lane rate multiplied by the
link width, so that OPP tables can carry separate entries per generation
and width, e.g. Gen 3 x1 and Gen 3 x2.

In pcie_set_target_speed(), call pcie_set_opp() before retraining only
when upscaling (speed_req > cur_bus_speed), since only raising the
operating point requires pre-staging hardware. After retraining, call
pcie_set_opp() unconditionally with the actual cur_bus_speed to settle
the votes. Both calls are skipped for downstream ports of PCIe switches,
as those are outside the host controller's scope.

Some controllers also require ASPM to be disabled around link retraining.
Add a disable_aspm_for_retrain flag to pci_host_bridge; when set,
pcie_set_target_speed() saves the child device's ASPM state, disables
all ASPM link states before retraining, and restores them afterward. The
child device is used because the ASPM core ignores requests made on the
Root Port itself and configures the link through its downstream device.
The states are restored with pci_force_enable_link_state(), as a
plain enable does not undo pci_disable_link_state().

Tested-by: Val Packett val@packett.cool # x1e80100-dell-latitude-7455
Signed-off-by: Krishna Chaitanya Chundru krishna.chundru@oss.qualcomm.com
Link: https://lore.kernel.org/all/20261119-bwscale-v6-1-9a9a715fcb46@oss.qualcomm.com/

@qcomlnxci

Copy link
Copy Markdown

Test results

Workflow run: 44258350036 attempt 1

Known failures configured: 0

Target Pass Non-pass Total
kbdev-glymur-crd-multimedia 31 5 36

Test Matrix

Test Case kbdev-glymur-crd-multimedia
LAVA result ✅ Results
Audio_Card_Registration ✅ Pass
BT_FW_KMD_Service ✅ Pass
BT_ON_OFF ✅ Pass
BT_SCAN ✅ Pass
CPUFreq_Validation ✅ Pass
CPU_affinity ✅ Pass
DSP_AudioPD ✅ Pass
Ethernet_Basic_Validation ⚠️ skip
Freq_Scaling ✅ Pass
GIC ✅ Pass
IPA ✅ Pass
Interrupts ✅ Pass
KVM_Driver ✅ Pass
KVM_EL2_DTB ✅ Pass
KVM_Infra ✅ Pass
OpenCV ✅ Pass
PCIe ✅ Pass
Probe_Failure_Check ❌ Fail
RMNET ✅ Pass
UFS_Validation ⚠️ skip
USBHost ✅ Pass
WiFi_Firmware_Driver ✅ Pass
WiFi_OnOff ✅ Pass
adsp_remoteproc ✅ Pass
cdsp_remoteproc ✅ Pass
gpdsp_remoteproc ⚠️ skip
hotplug ✅ Pass
irq ✅ Pass
kaslr ✅ Pass
pinctrl ✅ Pass
qcom_hwrng ✅ Pass
rngtest ✅ Pass
shmbridge ✅ Pass
smmu ❌ Fail
watchdog ✅ Pass
wpss_remoteproc ✅ Pass
Failure summary

Unexpected failures

  • kbdev-glymur-crd-multimedia: gpdsp_remoteproc => skip.
  • kbdev-glymur-crd-multimedia: Probe_Failure_Check => fail.
  • kbdev-glymur-crd-multimedia: smmu => fail.
  • kbdev-glymur-crd-multimedia: UFS_Validation => skip.
  • kbdev-glymur-crd-multimedia: Ethernet_Basic_Validation => skip.

Result: blocked because unexpected failures were found.

…ble ASPM around link retraining"

This reverts commit 26ad524.
… around link retraining

PCIe host bridge devices may need their operating point raised before
retraining to a higher link speed so that hardware resources (e.g., RPMh
votes on Qualcomm platforms) are available at the requested data rate.
After retraining, the operating point must be updated to reflect the
actual negotiated speed.

Add pcie_set_opp() to look up an OPP on the host bridge parent device
using a key of (total link rate in kHz, LNKCTL2 Target Link Speed
level). The total link rate is the per-lane rate multiplied by the
link width, so that OPP tables can carry separate entries per generation
and width, e.g. Gen 3 x1 and Gen 3 x2.

In pcie_set_target_speed(), call pcie_set_opp() before retraining only
when upscaling (speed_req > cur_bus_speed), since only raising the
operating point requires pre-staging hardware.  After retraining, call
pcie_set_opp() unconditionally with the actual cur_bus_speed to settle
the votes.  Both calls are skipped for downstream ports of PCIe switches,
as those are outside the host controller's scope.

Some controllers also require ASPM to be disabled around link retraining.
Add a disable_aspm_for_retrain flag to pci_host_bridge; when set,
pcie_set_target_speed() saves the child device's ASPM state, disables
all ASPM link states before retraining, and restores them afterward. The
child device is used because the ASPM core ignores requests made on the
Root Port itself and configures the link through its downstream device.
The states are restored with pci_force_enable_link_state(), as a
plain enable does not undo pci_disable_link_state().

Tested-by: Val Packett <val@packett.cool> # x1e80100-dell-latitude-7455
Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
Link: https://lore.kernel.org/all/20261119-bwscale-v6-1-9a9a715fcb46@oss.qualcomm.com/
@krishna-chundru krishna-chundru changed the title PENDING: PCI/bwctrl: Include link width in OPP frequency key FROMLIST: PCI/bwctrl: Set host bridge OPP and optionally disable ASPM around link retraining Nov 19, 2026
@qswat-orbit-external

Copy link
Copy Markdown

Merge Check Failed: No CR Numbers Found

Error: No Change Request numbers were found.

Please add Change Request numbers to your pull request description in the format CRs-Fixed: 12345 or link GitHub issues that are associated with Change Requests.

@qcomlnxci

Copy link
Copy Markdown

Test results

Workflow run: 44529950153 attempt 1

Known failures configured: 0

Target Pass Non-pass Total
kbdev-glymur-crd-multimedia 31 5 36

Test Matrix

Test Case kbdev-glymur-crd-multimedia
LAVA result ✅ Results
Audio_Card_Registration ✅ Pass
BT_FW_KMD_Service ✅ Pass
BT_ON_OFF ✅ Pass
BT_SCAN ✅ Pass
CPUFreq_Validation ✅ Pass
CPU_affinity ✅ Pass
DSP_AudioPD ✅ Pass
Ethernet_Basic_Validation ⚠️ skip
Freq_Scaling ✅ Pass
GIC ✅ Pass
IPA ✅ Pass
Interrupts ✅ Pass
KVM_Driver ✅ Pass
KVM_EL2_DTB ✅ Pass
KVM_Infra ✅ Pass
OpenCV ✅ Pass
PCIe ✅ Pass
Probe_Failure_Check ❌ Fail
RMNET ✅ Pass
UFS_Validation ⚠️ skip
USBHost ✅ Pass
WiFi_Firmware_Driver ✅ Pass
WiFi_OnOff ✅ Pass
adsp_remoteproc ✅ Pass
cdsp_remoteproc ✅ Pass
gpdsp_remoteproc ⚠️ skip
hotplug ✅ Pass
irq ✅ Pass
kaslr ✅ Pass
pinctrl ✅ Pass
qcom_hwrng ✅ Pass
rngtest ✅ Pass
shmbridge ✅ Pass
smmu ❌ Fail
watchdog ✅ Pass
wpss_remoteproc ✅ Pass
Failure summary

Unexpected failures

  • kbdev-glymur-crd-multimedia: gpdsp_remoteproc => skip.
  • kbdev-glymur-crd-multimedia: Probe_Failure_Check => fail.
  • kbdev-glymur-crd-multimedia: smmu => fail.
  • kbdev-glymur-crd-multimedia: UFS_Validation => skip.
  • kbdev-glymur-crd-multimedia: Ethernet_Basic_Validation => skip.

Result: blocked because unexpected failures were found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants