Skip to content

FROMLIST: PCI: qcom: Add D3cold support#939

Merged
krishnachaitanya-linux merged 5 commits into
qualcomm-linux:tech/bus/pci/allfrom
ziyuezhang-123:talos
May 14, 2026
Merged

FROMLIST: PCI: qcom: Add D3cold support#939
krishnachaitanya-linux merged 5 commits into
qualcomm-linux:tech/bus/pci/allfrom
ziyuezhang-123:talos

Conversation

@ziyuezhang-123
Copy link
Copy Markdown

@ziyuezhang-123 ziyuezhang-123 commented Apr 14, 2026

Add support for transitioning PCIe endpoints under host bridge into D3cold by integrating with the DWC core suspend/resume helpers.

Implement PME_TurnOff message generation via ELBI_SYS_CTRL and hook it into the DWC host operations so the controller follows the standard PME_TurnOff-based power-down sequence before entering D3cold.

When the device is suspended into D3cold, fully tear down interconnect bandwidth, OPP votes. If D3cold is not entered, retain existing behavior by keeping the required interconnect and OPP votes.

Use dw_pcie::skip_pwrctrl_off to avoid powering off devices during suspend to preseve wakeup capability of the devices and also not to power on the devices in the init path.

Drop the qcom_pcie::suspended flag and rely on the existing dw_pcie::suspended state, which now drives both the power-management flow and the interconnect/OPP handling.

Link: https://lore.kernel.org/all/20260407-d3cold-v4-5-bb171f75b465@oss.qualcomm.com/
CRs-Fixed: 4504416

shashim-quic
shashim-quic previously approved these changes Apr 17, 2026
@krishnachaitanya-linux krishnachaitanya-linux dismissed shashim-quic’s stale review May 4, 2026 06:21

The merge-base changed after approval.

@ziyuezhang-123 ziyuezhang-123 force-pushed the talos branch 4 times, most recently from b2cc385 to 43a31c1 Compare May 7, 2026 10:41
@qcomlnxci qcomlnxci requested review from a team, krishnachaitanya-linux and meleung and removed request for a team May 7, 2026 10:52
@ziyuezhang-123 ziyuezhang-123 force-pushed the talos branch 4 times, most recently from 79ba71a to 2cca9a0 Compare May 14, 2026 05:55
@sgaud-quic
Copy link
Copy Markdown
Contributor

@ziyuezhang-123 / @krishnachaitanya-linux please rebase topic branch to 7.1-rc2, to match base of qcom-next to resolve merge conflicts during sync.

…d eligibility

Add a common helper, pci_host_common_d3cold_possible(), to determine
whether PCIe devices under host bridge can safely transition to D3cold.

This helper is intended to be used by PCI host controller drivers to
decide whether they may safely put the host bridge into D3cold based on
the power state and wakeup capabilities of downstream endpoints.

The helper walks all devices on the all bridge buses and only allows
the devices to enter D3cold if all PCIe endpoints are already in
PCI_D3hot. This ensures that we do not power off the host bridge while
any active endpoint still requires the link to remain powered.

For devices that may wake the system, the helper additionally requires
that the device supports PME wake from D3cold (via WAKE#). Devices that
do not have wakeup enabled are not restricted by this check and do not
block the devices under host bridge from entering D3cold.

Devices without a bound driver and with PCI not enabled via sysfs are
treated as inactive and therefore do not prevent the devices under host
bridge from entering D3cold. This allows controllers to power down more
aggressively when there are no actively managed endpoints.

Some devices (e.g. M.2 without auxiliary power) lose PME detection when
main power is removed. Even if such devices advertise PME-from-D3cold
capability, entering D3cold may break wakeup. So, return PME-from-D3cold
capability via an output parameter so PCIe controller drivers can apply
platform-specific handling to preserve wakeup functionality.

Link: https://lore.kernel.org/r/20260429-d3cold-v5-1-89e9735b9df6@oss.qualcomm.com
Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
Signed-off-by: Ziyue Zhang <ziyue.zhang@oss.qualcomm.com>
For older targets like sc7280, we see reading DBI after sending PME
turn off message is causing NOC error.

To avoid unsafe DBI accesses, introduce qcom_pcie_get_ltssm() to retrieve
the LTSSM state. For newer platforms, the LTSSM state is read from the
PARF_LTSSM register, while older platforms continue to retrieve it from
ELBI_SYS_STTS.

This helper is used in place of direct DBI-based link state checks in
the D3cold path after sending PME turn-off message, ensuring the LTSSM
state can be queried safely even after DBI access is no longer valid.

Link: https://lore.kernel.org/r/20260429-d3cold-v5-2-89e9735b9df6@oss.qualcomm.com
Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
Signed-off-by: Ziyue Zhang <ziyue.zhang@oss.qualcomm.com>
…g rails/clocks

Some Qcom PCIe controller variants bring the PHY out of test power-down
(PHY_TEST_PWR_DOWN) during init. When the link is later transitioned
towards D3cold and the driver disables PCIe clocks and/or regulators
without explicitly re-asserting PHY_TEST_PWR_DOWN, the PHY can remain
partially powered, leading to avoidable power leakage.

Update the init-path comments to reflect that PARF_PHY_CTRL is used to
power the PHY on. Also, for controller revisions that enable PHY power
in init (2.3.2, 2.3.3, 2.4.0, 2.7.0 and 2.9.0), explicitly power the PHY
down via PARF_PHY_CTRL in the deinit path before disabling clocks or
regulators.

This ensures the PHY is put into a defined low-power state prior to
removing its supplies, preventing leakage when entering D3cold.

Link: https://lore.kernel.org/r/20260429-d3cold-v5-3-89e9735b9df6@oss.qualcomm.com
Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
Signed-off-by: Ziyue Zhang <ziyue.zhang@oss.qualcomm.com>
Previously, the driver skipped putting the link into L2/device state in
D3cold whenever L1 ASPM was enabled, since some devices (e.g. NVMe) expect
low resume latency and may not tolerate deeper power states. However, such
devices typically remain in D0 and are already covered by the new helper's
requirement that all endpoints be in D3hot before the devices under host
bridge may enter D3cold.

So, replace the local L1/L1SS-based check in dw_pcie_suspend_noirq() with
the shared pci_host_common_d3cold_possible() helper to decide whether the
devices under host bridge can safely transition to D3cold.

In addition, propagate PME-from-D3cold capability information from the
helper and record it in skip_pwrctrl_off. Some devices (e.g. M.2 cards
without auxiliary power) may lose PME detection when main power is
removed, even if they advertise PME-from-D3cold support. This allows
controller power-off to be skipped when required to preserve wakeup
functionality.

Update the suspended flag in dw_pcie_resume_noirq() only after the PCIe
link resumes successfully, to avoid marking the controller active when
link resume fails.

Link: https://lore.kernel.org/r/20260429-d3cold-v5-4-89e9735b9df6@oss.qualcomm.com
Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
Signed-off-by: Ziyue Zhang <ziyue.zhang@oss.qualcomm.com>
Add support for transitioning PCIe endpoints under host bridge into
D3cold by integrating with the DWC core suspend/resume helpers.

Implement PME_TurnOff message generation via ELBI_SYS_CTRL and hook it
into the DWC host operations so the controller follows the standard
PME_TurnOff-based power-down sequence before entering D3cold.

When the device is suspended into D3cold, fully tear down interconnect
bandwidth, OPP votes. If D3cold is not entered, retain existing behavior
by keeping the required interconnect and OPP votes.

Use dw_pcie::skip_pwrctrl_off to avoid powering off devices during suspend
to preserve wakeup capability of the devices and also not to power on the
devices in the init path.

Drop the qcom_pcie::suspended flag and rely on the existing
dw_pcie::suspended state, which now drives both the power-management
flow and the interconnect/OPP handling.

Link: https://lore.kernel.org/r/20260429-d3cold-v5-5-89e9735b9df6@oss.qualcomm.com
Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
Signed-off-by: Ziyue Zhang <ziyue.zhang@oss.qualcomm.com>
@ziyuezhang-123 ziyuezhang-123 force-pushed the talos branch 3 times, most recently from dc1764d to d44b21f Compare May 14, 2026 09:31
@krishnachaitanya-linux krishnachaitanya-linux merged commit c266573 into qualcomm-linux:tech/bus/pci/all May 14, 2026
5 of 6 checks passed
@sgaud-quic
Copy link
Copy Markdown
Contributor

PR #939 — validate-patch

PR: #939

Verdict Issues Detailed Report
⚠️ 0 Full report
Verdict: ⚠️ — click to expand

🔍 Patch Validation Report

PR: PR #939 — PCI: qcom: Add D3cold support (5-patch FROMLIST series, v5)
Upstream commits:

Verdict: ⚠️ PARTIAL

Note: Network access was unavailable in this environment. Lore patches could not be fetched for direct diff comparison. The analysis below is based on internal consistency checks of pr.patch, commit message vs. diff alignment, authorship hygiene, and series ordering. Upstream acceptance status and qcom-next presence could not be verified — mark both as ⏭️ Skipped.


Commit Message Checks

Patch 1/5 — FROMLIST: PCI: host-common: Add helper to determine host bridge D3cold eligibility

Check Status Note
Subject matches upstream Subject consistent with lore message-ID slug
Body preserves rationale Detailed description of helper logic, D3hot requirement, PME-from-D3cold output param
Fixes tag N/A New feature, no Fixes tag expected
Authorship (FROMLIST:) From: = lore sender (same @oss.qualcomm.com); original author's Signed-off-by: present
Backport note N/A Not a backport
Co-developed-by misuse Not used

Patch 2/5 — FROMLIST: PCI: qcom: Add .get_ltssm() helper

Check Status Note
Subject matches upstream Consistent with lore slug
Body preserves rationale Explains NOC error on sc7280, PARF vs ELBI distinction
Fixes tag N/A New feature
Authorship (FROMLIST:) Same author/SOB pattern
Backport note N/A
Co-developed-by misuse Not used

Patch 3/5 — FROMLIST: PCI: qcom: Power down PHY via PARF_PHY_CTRL before disabling rails/clocks

Check Status Note
Subject matches upstream Consistent with lore slug
Body preserves rationale Explains PHY leakage risk, lists affected IP revisions (2.3.2, 2.3.3, 2.4.0, 2.7.0, 2.9.0)
Fixes tag N/A New feature / preventive fix
Authorship (FROMLIST:) Same author/SOB pattern
Backport note N/A
Co-developed-by misuse Not used

Patch 4/5 — FROMLIST: PCI: dwc: Use common D3cold eligibility helper in suspend path

Check Status Note
Subject matches upstream Consistent with lore slug
Body preserves rationale ⚠️ Body claims "Update the suspended flag in dw_pcie_resume_noirq() only after the PCIe link resumes successfully" — but this change is absent from the diff. Patch 4 only touches dw_pcie_suspend_noirq and pcie-designware.h. The dw_pcie_resume_noirq change (if it exists upstream) is not present here.
Fixes tag N/A
Authorship (FROMLIST:) Same author/SOB pattern
Backport note N/A
Co-developed-by misuse Not used

Patch 5/5 — FROMLIST: PCI: qcom: Add D3cold support

Check Status Note
Subject matches upstream Consistent with lore slug
Body preserves rationale Covers PME_TurnOff, interconnect teardown, skip_pwrctrl_off, dropping qcom_pcie::suspended
Fixes tag N/A New feature
Authorship (FROMLIST:) Same author/SOB pattern
Backport note N/A
Co-developed-by misuse Not used

Diff Checks

Patch 1/5

File Status Notes
drivers/pci/controller/pci-host-common.c Renames pci_host_common_can_enter_d3coldpci_host_common_d3cold_possible, adds pme_capable output param, expands endpoint type check to include LEG_END/RC_END, adds inactive-device bypass, uses PCI_HOST_D3COLD_ALLOWED/PCI_HOST_PME_D3COLD_CAPABLE flags
drivers/pci/controller/pci-host-common.h Declaration updated to match new signature

Patch 2/5

File Status Notes
drivers/pci/controller/dwc/pcie-qcom.c Adds ELBI_SYS_STTS register + mask, get_ltssm op, qcom_pcie_2_1_0_get_ltssm(), wires into ops_2_1_0/ops_1_0_0; removes pm_domain.h; refactors suspend/resume to intermediate state (manual link-up check, local suspended flag); removes broken_l1ss_resume and pme_turn_off hook (restored in patch 5)

Patch 3/5

File Status Notes
drivers/pci/controller/dwc/pcie-qcom.c ⚠️ PHY power-down blocks added correctly to deinit_2_3_2, deinit_2_4_0, deinit_2_3_3, deinit_2_7_0, deinit_2_9_0; init-path comments updated. Minor style: two added comments read /* Force PHY to lowest power state*/ — missing space before */ (lines +499, +521)

Patch 4/5

File Status Notes
drivers/pci/controller/dwc/pcie-designware-host.c ⚠️ Correctly replaces pci_host_common_can_enter_d3cold with pci_host_common_d3cold_possible, adds skip_pwrctrl_off assignment. However, the commit body claims a dw_pcie_resume_noirq() change that is not present in this diff
drivers/pci/controller/dwc/pcie-designware.h Adds skip_pwrctrl_off field to dw_pcie_rp

Patch 5/5

File Status Notes
drivers/pci/controller/dwc/pcie-qcom.c Restores pme_turn_off hook and dw_pcie_suspend/resume_noirq calls; drops qcom_pcie::suspended in favour of dw_pcie::suspended; adds skip_pwrctrl_off guards around pci_pwrctrl_* calls; error handling in resume changes from -ETIMEDOUT to -ENODEV/-EIO (semantic change, but consistent with the new D3cold flow where no endpoint is a valid state)

Upstream Patch Status

Commit Community Verdict
All 5 patches ⏭️ Skipped — network unavailable; lore.kernel.org unreachable

Dependency Check

  • Series is self-contained (patches 1–5 applied in order produce a coherent result)
  • Patch 4 depends on patch 1 (pci_host_common_d3cold_possible) — ordering correct
  • Patch 5 depends on patches 2, 3, 4 — ordering correct
  • No external prerequisite patches referenced in commit bodies
  • ⚠️ Patch 2 leaves the driver in a deliberate intermediate state (removes pme_turn_off, dw_pcie_suspend_noirq call) that is only restored by patch 5. This is acceptable for a series but means patches 2–4 alone would regress D3cold functionality.

qcom-next Presence

Commit Status
All 5 patches ⏭️ Skipped — no local kernel repo with qcom-next found; network unavailable

Issues Found

  1. Patch 4 — Commit body / diff mismatch (⚠️ WARNING): The commit body states "Update the suspended flag in dw_pcie_resume_noirq() only after the PCIe link resumes successfully, to avoid marking the controller active when link resume fails." However, dw_pcie_resume_noirq() in pcie-designware-host.c is not modified by patch 4's diff. If this change exists in the upstream lore patch, it is missing from the PR. If it was intentionally deferred to patch 5 (which calls dw_pcie_resume_noirq from qcom_pcie_resume_noirq), the commit body paragraph should be removed or moved to patch 5.

  2. Patch 3 — Missing space before */ in two comments (⚠️ STYLE):

    • + /* Force PHY to lowest power state*/ (in qcom_pcie_deinit_2_3_2)
    • + /* Force PHY to lowest power state*/ (in qcom_pcie_deinit_2_4_0)
      Should be /* Force PHY to lowest power state */ — the other added comments in the same patch correctly include the space.

Verdict

The series is structurally sound and the lore links are present and correctly formatted for all 5 FROMLIST: commits. Two issues require attention before merge: (1) the stray paragraph in patch 4's commit body describing a dw_pcie_resume_noirq() change that does not appear in its diff — either the change is missing or the paragraph belongs in patch 5; (2) two /* ... */ comments in patch 3 are missing the space before */. Resolve issue (1) (either add the missing hunk or drop the paragraph) and fix the comment style in patch 3, then the series is ready to merge.

@sgaud-quic
Copy link
Copy Markdown
Contributor

PR #939 — checker-log-analyzer

PR: #939
Checker run: https://github.com/qualcomm-linux/kernel-config/actions/runs/25852850665

Checker Result Summary
Checker Result Summary
checkpatch Merge conflict during sync — checker never ran
dt-binding-check Merge conflict during sync — checker never ran
dtb-check Merge conflict during sync — checker never ran
sparse-check Merge conflict during sync — checker never ran
check-uapi-headers Merge conflict during sync — checker never ran
check-patch-compliance Merge conflict during sync — checker never ran
tag-check All 5 commits carry FROMLIST: prefix
qcom-next-check ⏭️ Network unavailable — cannot fetch qcom-next; manual check required

Detailed report: Full report

Checker analysis — click to expand

🤖 CI Checker Analysis (checker-log-analyzer)

PR: #939 — PCI D3cold support series (5 commits, all FROMLIST:)
Source: https://github.com/qualcomm-linux/kernel-config/actions/runs/25852850665

Checker Result Summary
checkpatch Merge conflict during sync — checker never ran
dt-binding-check Merge conflict during sync — checker never ran
dtb-check Merge conflict during sync — checker never ran
sparse-check Merge conflict during sync — checker never ran
check-uapi-headers Merge conflict during sync — checker never ran
check-patch-compliance Merge conflict during sync — checker never ran
tag-check All 5 commits carry FROMLIST: prefix
qcom-next-check ⏭️ Network unavailable — cannot fetch qcom-next; manual check required

❌ All Checkers — Merge Conflict in Sync Step

Root cause: The CI sync step failed to auto-merge topic/tech/bus/pci/all into the integration branch (based on tag 4e0b0df1c84f9b81089bf478c63d635cc97040a1), producing content conflicts in 4 PCI files; every checker job aborted before running any analysis.

Failure details:

CONFLICT (content): Merge conflict in drivers/pci/controller/dwc/pcie-designware-host.c
CONFLICT (content): Merge conflict in drivers/pci/controller/dwc/pcie-qcom.c
CONFLICT (content): Merge conflict in drivers/pci/controller/pci-host-common.c
CONFLICT (content): Merge conflict in drivers/pci/controller/pci-host-common.h
Automatic merge failed; fix conflicts and then commit the result.
Merge failed, manual merge
##[error]Process completed with exit code 1.

The same 4-file conflict appears in every checker log (checkpatch, check-patch-compliance, dt-binding-check, dtb-check, sparse-check, check-uapi-headers). The baseline tag used was 4e0b0df1c84f9b81089bf478c63d635cc97040a1.

Conflicting files (all in drivers/pci/controller/):

  • dwc/pcie-designware-host.c — modified by patch 4/5 (FROMLIST: PCI: dwc: Use common D3cold eligibility helper)
  • dwc/pcie-qcom.c — modified by patches 2/5, 3/5, 5/5
  • pci-host-common.c — modified by patch 1/5 (FROMLIST: PCI: host-common: Add helper to determine host bridge D3cold eligibility)
  • pci-host-common.h — modified by patch 1/5

Root cause analysis: The baseline tag (4e0b0df1c84f9b81089bf478c63d635cc97040a1) in qualcomm-linux/kernel has diverged from the base of this PR's topic branch. The same files touched by this PR have been modified in the baseline since the topic branch was created, causing irreconcilable auto-merge conflicts.

Fix options:

  1. Rebase the topic branch onto the current baseline (preferred):

    git fetch origin
    git rebase 4e0b0df1c84f9b81089bf478c63d635cc97040a1
    # resolve conflicts in the 4 files, then:
    git rebase --continue
    git push --force-with-lease
  2. Re-trigger CI after rebase — once the topic branch is rebased and conflicts resolved, re-run the checker workflow. All 6 checkers will then execute against the actual patch content.

Reproduce locally:

git clone https://github.com/qualcomm-linux/kernel kernel
cd kernel
git fetch origin topic/tech/bus/pci/all
git checkout -b integ 4e0b0df1c84f9b81089bf478c63d635cc97040a1
git merge origin/topic/tech/bus/pci/all
# Observe conflicts in the 4 files listed above

✅ tag-check

All 5 commits carry the FROMLIST: prefix — subject-prefix requirement satisfied for branch tech/bus/pci/all:

  • FROMLIST: PCI: host-common: Add helper to determine host bridge D3cold eligibility
  • FROMLIST: PCI: qcom: Add .get_ltssm() helper
  • FROMLIST: PCI: qcom: Power down PHY via PARF_PHY_CTRL
  • FROMLIST: PCI: dwc: Use common D3cold eligibility helper
  • FROMLIST: PCI: qcom: Add D3cold support

⏭️ qcom-next-check

All 5 commits are FROMLIST: and require a qcom-next presence check, but network access is unavailable in this environment.

⚠️ qcom-next-check — SKIPPED (could not fetch qcom-next)
Manually verify for each commit subject (strip the "FROMLIST: " prefix):
  git log qcom-linux/qcom-next --grep="PCI: host-common: Add helper to determine host bridge D3cold eligibility"
  git log qcom-linux/qcom-next --grep="PCI: qcom: Add .get_ltssm() helper"
  git log qcom-linux/qcom-next --grep="PCI: qcom: Power down PHY via PARF_PHY_CTRL"
  git log qcom-linux/qcom-next --grep="PCI: dwc: Use common D3cold eligibility helper"
  git log qcom-linux/qcom-next --grep="PCI: qcom: Add D3cold support"

Verdict

All 6 checker failures are CI infrastructure failures, not patch defects. The topic branch tech/bus/pci/all has merge conflicts with the current baseline tag in qualcomm-linux/kernel across 4 PCI driver files. The PR author must rebase the topic branch onto the current baseline to resolve the conflicts, then re-trigger CI. No patch content changes are required based on these logs — the actual checker results (checkpatch, compliance, sparse, etc.) are unknown until the merge conflict is resolved and CI re-runs successfully.

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.

4 participants