Repository navigation
PCI: apple: hold T6050 PCIe-C power domain across s2idle - #2739
Conversation
|
An adversarial read of 075bd14. The fix is right: T6050's PCIe-C host was the one tunnel host without One gap, the same shape as #2729: on a
These could go into the same Minor, non-blocking: Assisted-by: LLM (Claude:Opus 5.5) |
On T6050 PCIe-C tunnel hosts, the ps_atcN_pcie power domain is not always-on (power_retained is false) and the sibling DART is bound as cio_dart for native CIO sleep transactions. During suspend-to-idle (PM_SUSPEND_TO_IDLE), the NHI leaves the tunnel running and does not start a CIO sleep transaction, expecting the host to keep its link via apple_pcie_keep_link(). Because t6050_pciec_hw omitted .s2idle_hold_domain = true (unlike t8132_pciec_hw and t6040_pciec_hw), apple_pcie_keep_link() returned false without holding the domain, causing apple_pcie_suspend_noirq() to abort late with -EBUSY after endpoints had already entered D3hot. Set .s2idle_hold_domain = true on t6050_pciec_hw so s2idle vetoes GENPD_NOTIFY_PRE_OFF on ps_atcN_pcie and releases the hold on resume, leaving PM_SUSPEND_MEM (deep sleep) CIO transactions untouched. Factor the pre-suspend link-retention policy out of apple_pcie_keep_link() into apple_pcie_can_keep_link() (checking s2idle_keep_link, pm_suspend_no_platform(), kernel_init || tunnel_cold_init, !bus_stopped && !resume_failed, and power_retained || s2idle_hold_domain) and share it with apple_pcie_prepare() and apple_pcie_suspend_noirq(). That refuses early with -EBUSY before any endpoint suspends whenever a cio_dart host has no NHI sleep transaction and cannot retain its link, leaving only the domain hold and live link-health check to noirq. Extend tools/asahi/pciec-policy-tests.py to cover T6050 s2idle domain holding and release, deep-sleep pass-through, and every pre-suspend refusal term in apple_pcie_can_keep_link() / apple_pcie_prepare(), with negative controls. Signed-off-by: Diljit Singh <hey@djdev.me>
075bd14 to
aedd024
Compare
|
Thanks. Checked aedd024: One consequence to decide on deliberately: with the tunnel never brought up ( Assisted-by: LLM (Claude:Opus 5.5) |
|
Tested head 1. Why an undocked J714s does not refuse in
|
| Row | Configuration | Command | Result | Key evidence |
|---|---|---|---|---|
| A (Docked active PCIe-C) | 1c70000000.pcie bound, active TB5 dock tunnel (pciec_bound=1) |
rtcwake -d rtc1 -m freeze -s 15 |
PASS (rc=0) |
asleep=14.2 s (rtc_delta=20 s), macsmc-rtc IRQ 118 0 -> 1, pciec_ebusy=0, disp=3/3, usb=20, wifi=1, bt=1, nvme=1, 0 AER/link_err/oops/DART/AVC/gpu_lost |
B (Bound cio_dart + bus_stopped=true) |
echo 0 > /sys/bus/thunderbolt/devices/0-1/authorized (1c70000000.pcie still bound, quiesced) |
rtcwake -d rtc1 -m freeze -s 15 |
PASS (early .prepare -EBUSY) |
pcie-apple 1c70000000.pcie: no CIO sleep transaction from the NHI; refusing sleep -> device_prepare(): genpd_prepare returns -16, last_failed_errno=-16, last_failed_step=prepare, noirq_abort=0, 0 oops/DART/AVC/gpu_lost |
| C (Undocked / zero PCIe-C hosts bound) | 381ac0000.acio unbound via sysfs (pciec_bound=0; 2a9ac0000.acio idle-undocked; note dock stays physically plugged in remote lab so acio2 was unbound in software and cleanly rebound after wake) |
rtcwake -d rtc1 -m freeze -s 15 |
PASS (rc=0) |
unbind_rc=0, pciec_bound=0, asleep=16.0 s, macsmc-rtc IRQ 118 1 -> 2, suspend_stats success=2 -> 3, pciec_ebusy=0, refusal=0, bind_rc=0, 0 oops/DART/AVC/gpu_lost |
D (deep regression) |
Docked (pciec_bound=1) |
rtcwake -d rtc0 -m mem -s 15 |
PASS (rc=0) |
asleep=13.5 s (rtc_delta=23 s), disp=3/3, usb=20, wifi=1, bt=1, nvme=1, 0 AER/oops/DART/AVC/gpu_lost |
- Regression line: GPU
LIVE(vulkaninfo+ compute dispatch) before and after all 4 rows;0kernel oops/WARN,0DART faults,0SELinux AVCs,0new failed systemd units (only pre-existing offlinetailscaled.service).
Assisted-by: LLM (Gemini 4 Neon)
RyanTheTide
left a comment
There was a problem hiding this comment.
Re-reviewed at aedd024.
- The undocked case is answered: the
pcie-tunnel-Nnodes have nocompatible, so a PCIe-C host only exists afterapple_cio_populate_pcie_tunnel(), and an undocked machine has noapple,t6050-pciecdevice forapple_pcie_prepare()to refuse on. Row C exercises the same depopulate path through the ACIO unbind and sleeps cleanly; rows A, B and D cover the kept link, the early refusal and deep. apple_pcie_can_keep_link()now gives prepare and noirq the same answer, so the late noirq-EBUSYafter endpoints have suspended is gone for the static cases. The only thing left in noirq is the domain hold and the live link check, which is where it belongs.- Small follow-up, not blocking: the prepare warning still says "no CIO sleep transaction from the NHI" when the actual reason is
bus_stoppedorresume_failed(row B prints it after a de-authorised tunnel). Naming the reason would save the next person a detour.
Approve.
Assisted-by: LLM (Claude:Opus 5.5)
Summary
On T6050 PCIe-C tunnel hosts (
1c70000000.pcie),ps_atcN_pcieis not always-on (power_retainedis false) and the sibling DART is bound ascio_dartfor native CIO sleep transactions.During
PM_SUSPEND_TO_IDLE(s2idle), the NHI leaves the tunnel running and does not start a CIO sleep transaction, expecting the host to retain its link throughapple_pcie_keep_link(). Becauset6050_pciec_hwomitted.s2idle_hold_domain = true(unliket8132_pciec_hwandt6040_pciec_hw),apple_pcie_keep_link()returned false without holding the power domain, causingapple_pcie_suspend_noirq()to abort late with-EBUSY(genpd_suspend_noirq returns -16) after endpoints had already enteredD3hot.This PR:
.s2idle_hold_domain = trueont6050_pciec_hwindrivers/pci/controller/pcie-apple.csos2idlevetoesGENPD_NOTIFY_PRE_OFFonps_atcN_pcieand releases the hold on resume, leavingPM_SUSPEND_MEM(deep) CIO sleep transactions unchanged.apple_pcie_prepare()to refuse early with-EBUSYwhen acio_darthost without an NHI sleep transaction has neither a retained power domain nors2idle_hold_domain, matching the condition under whichapple_pcie_keep_link()cannot retain the link insuspend_noirq.tools/asahi/pciec-policy-tests.pyto cover T6050s2idledomain holding/release, deep-sleep pass-through, and early refusal inapple_pcie_prepare()with negative controls.Verification
Host checks (head
075bd14d3dec)scripts/checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks.python3 tools/asahi/pciec-policy-tests.py: PASS (including 6/6 negative controls killed).arm64build ofdrivers/pci/controller/pcie-apple.o: 0 warnings.Hardware row — Apple M5 Pro (J714s / T6050)
7.3.0-m5-sship7cc145705c592with active PCIe-C tunnel): 3/3rtcwake -m freezecycles aborted innoirqwithpcie-apple 1c70000000.pcie: PM: dpm_run_callback(): genpd_suspend_noirq returns -16.075bd14d3dec) on basecc145705c592+ minimal T6050s2idlestack (arm64: dts: apple: t6050: wire the PMIC RTC alarm interrupt #200736ef4f8b60cfincl. [Joshua's agent] spmi: apple: gen4 interrupts and the gen4 mask bank (draft) #1743, arm64: dts: apple: t6050: keep the ATC USB power domains on in system sleep #2592a142752404ed, PCI: apple: keep a boot-trained adopted link in D0 through suspend #2557f90f377c8c5e, phy: apple: atc-t6050: keep active combo PHY domains powered across s2idle #26646fb5e78f9b46, rebuiltt6050-j714s.dtbwith MTE enabled andno_console_suspend ignore_loglevelfor serial capture; Dell Thunderbolt dock attached on active PCIe-C tunnel):s2idle(rtcwake -d rtc1 -m freeze -s 15): 3/3 PASSrc=0, asleep14.5 s(rtc_delta=20 s),macsmc-rtcIRQ 1180 -> 1,pciec_ebusy=0,refusal=0,disp=3/3,usb=20,wifi=1,bt=1,nvme=1,aer=0,link_err=0,oops=0,dart=0,avc=0,gpu_lost=0.rc=0, asleep14.0 s(rtc_delta=20 s),macsmc-rtcIRQ 1181 -> 2,pciec_ebusy=0,refusal=0,disp=3/3,usb=20,wifi=1,bt=1,nvme=1,aer=0,link_err=0,oops=0,dart=0,avc=0,gpu_lost=0.rc=0, asleep14.6 s(rtc_delta=20 s),macsmc-rtcIRQ 1182 -> 3,pciec_ebusy=0,refusal=0,disp=3/3,usb=20,wifi=1,bt=1,nvme=1,aer=0,link_err=0,oops=0,dart=0,avc=0,gpu_lost=0.deepregression (rtcwake -d rtc0 -m mem -s 15): 1/1 PASSrc=0, asleep13.1 s(rtc_delta=23 s),pcie-apple 1c70000000.pcie: CIO PCIe-C stop (T6050 order)->PME_Turn_OffL2 reported ->CIO PCIe-C link and DMA restored,pciec_ebusy=0,refusal=0,disp=3/3,usb=20,wifi=1,bt=1,nvme=1,aer=0,oops=0,dart=0,avc=0,gpu_lost=0.suspend_statssuccess=0 -> 4,fail=0; GPULIVE(vulkaninfo+ compute dispatch) before and after all 4 cycles;0kernel oops/WARN,0DART faults,0SELinux AVCs,0new failed systemd units (only pre-existing offlinetailscaled.service).Assisted-by: LLM (Gemini 4 Neon)