Repository navigation
soc: apple: t6041-sleep: restore GP PCIe ports 2/3 and display clusters - #3421
RyanTheTide merged 2 commits into
Conversation
T6041 desktops (J575c) expose GP PCIe ports 2 and 3 in addition to ports 0 and 1, and T6041 sleep commit powers down cluster +0x0c (DISP_INT) and +0x10 (DISP_EXT, backing DISPEXT_RAIL_V). Map optional port2/port3 and phy2/phy3 windows from apple,apcie while keeping ports 0/1 required, track which mapped GP ports had refclk requested (BIT(0)) before sleep, and restore clocks only for those active ports on wake. Save cluster +0x0c and +0x10 in t6041_save() and restore their low nibble on wake in t6041_sleep_return() when non-zero before sleep. Signed-off-by: Roberto Dantas <7robertodantas@gmail.com>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Code looks right at 3cfb4d07. One hardware row is still needed before merge, on a Mac that runs this driver. Thanks for working on this.
Missing row: t6041-sleep is enabled only on the M4 Max MacBook Pros: &t6041_sleep { status = "okay"; } is in t6041-j614c-j616c.dtsi. t6041-j575c.dts doesn't enable it, so the J575c s2idle run doesn't execute any changed line. On those laptops pcie0 already lists port2/port3 and phy2/phy3 in reg-names, so both changes run there:
- the driver now maps ports 2 and 3;
gp_updecides which ports get their clocks back;- the
+0x0c/+0x10cluster words are written on wake.
What's needed is one deep-sleep cycle (commit and wake) on a J614c or J616c at this head, with 0 SErrors/DART faults and PCIe (Wi-Fi, SD reader) back after wake. If you have one of those, that settles it. If not, we'll ask for it from a Mac that has one, so it isn't on you.
Nit, not blocking: the comment on t6041_ave_off() calls +0xc and +0x10 "the two AVE complexes", while the new comment in t6041_sleep_return() calls them DISP_INT and DISP_EXT (DISPEXT_RAIL_V). Whichever is right, it would help if the two comments agreed.
What I checked
- Ports 0/1: they stay required for
apcie_readyandgp_saved. Missingport2/port3stay NULL silently:t6041_map_name()returns an error pointer thatt6041_apcie_block()turns into NULL. - Which ports are restored:
gp_upcomes from the pre-sleep PHYREFCLK0REQbit.pcie-applesets it only on ports it sets up, and on the laptops that is ports 0 and 1, so their restore is unchanged there. - Cluster words:
t6041_save()runs beforet6041_ave_off()int6041_sleep_commit(), sopre_disp_cluster[]holds the boot-time state. The restore writes back only non-zero low nibbles and keeps the upper bits it reads. - Base: nothing on
mainsincecec0503atouchest6041-sleep.c.
|
Thanks for reviewing @DjDeveloperr. I only have the J575c Studio (no J614c or J616c), so I can't run the laptop S2R row here — routing that to a J614c/J616c tester would be appreciated. On the comment nit: in the J575c ADT ( |
|
Merge-train review at |
There was a problem hiding this comment.
Verdict: HOLD at 3cfb4d07 pending a deep-sleep row with the changed driver bound.
Blockers: Keep Dj's J614c or J616c request. Confirm deep-sleep commit and wake, resumed Wi-Fi and SD reader, and zero new SError or DART faults. The author has a J575c, so the requested row remains with a laptop tester.
Checked: The head is unchanged since Dj's source review. GP ports 0 and 1 stay required; newly mapped ports 2 and 3 remain conditional on the DT, and restoration is gated by the saved refclk state. The J575c s2idle result exercises a separate path because its DT leaves this driver disabled.
Evidence
Existing exact-head review: #3421 (review)
|
@7robertodantas: the DT half you mentioned as a follow-up is up as #3626. It turns the T6041 sleep node on at the SoC (no more "not qualified" board gate) and gives the J575c If you have time on your J575c, could you run a deep-sleep row with this PR + #3626 together (e.g. #3626's commit 09a077c on top of 3cfb4d0)?
If your combined 6/6 tree wired anything else into |
|
@RyanTheTide here is the J575c row with #3421 + #3626 together, on current main. Tested: Mac Studio J575c (M4 Max). Tree = main Result: no deep sleep, by design of the driver. The J575c stays on s2idle, and s2idle still works.
So #3626 is safe to land on the J575c as it is (no regression, s2idle unchanged), but it doesn't turn deep sleep on. To answer your question: yes, the 6/6 tree wired more than DT:
Driver (not on main):
One thing on ordering: please don't add the |
|
@7robertodantas: thank you, that's a thorough row and exactly the information that was missing.
|
|
@7robertodantas: we picked up your If you have time, could you run the deep-sleep row at #3666's exact head? Deep x3 with |
The T6041 sleep commit powers down the GP PCIe domains (apcie_phy_sw, apcie_sys_gp, apcie_gp) with the active links still up: no L2 entry and no PERST# before the power goes. The wake's GPIO restore then releases PERST# before the refclk is back. An endpoint that keeps its own power across the sleep sees both, like the J575c's 10 GbE controller on port 2, which pcie-apple notes is sensitive to PERST# released without its clock. Stop each active GP port in the commit path right after t6041_save(), in sleep-t6040.h's order: link interrupt masked, PME_Turn_Off to L2, PERST# asserted at its pin, 1 ms hold, PORT_PERST cleared under its guard bit, PHY and application clocks off. Record the asserted PERST# in gpio_pre so that the wake's t6041_gpio_restore() keeps the endpoint in reset until pcie-apple has set up its refclk and releases it, and leave refclk gating bit 31 clear on stopped ports in t6041_gp_pcie_clk(). On the J575c the controller on port 2 was lost on 4 of about 55 deep sleep wakes before, and on 2 of about 130 with this; it still happens and needs a restart (tracked separately). Signed-off-by: Roberto Dantas <7robertodantas@gmail.com>
|
New commit |
There was a problem hiding this comment.
Verdict: HOLD at 12de58f8
Blockers:
- Hosted
pull_requestCI workflows (Apple build and KUnit,Host tests,SEP source checks,pr-text) are allaction_requiredawaiting maintainer workflow approval for this fork PR. - Standalone hardware boot row at head
12de58f8on J575c is pending (noted as next in the latest comment; the PR body's standalone row is still from3cfb4d07).
Checked:
- GP PCIe port stop (
t6041_gp_ports_stop()): follows thesleep-t6040.hsequence (mask/clear link interrupts, disable appclk CG,APCIE_PORT_L2_ENTERpoll, assert endpoint PERST# GPIO and save asserted level intogpio_prewhen not skipped so wake's GPIO restore never deasserts PERST# ahead of refclk, clearAPCIE_PHY_LINK, hold 1 ms, clearAPCIE_PORT_PERSTunderPERST_GUARD, drop PHY enables/reset/clocks and port appclk). - GPIO bounds & wake clock restore (
t6041_map_apcie(),t6041_gp_pcie_clk()):gp_perst[]initializes to-1and is populated only whenargs.np == pin_npandargs.args[0] < s->npins, guaranteeings->gpioands->gpio_prebounds. Wake restore handles active ports0..3viagp_upand skips settingAPCIE_PHY_LINKwhengp_perst[i] >= 0sopcie-applebrings the link back cleanly after PERST# release. - Display cluster restore (
pre_disp_cluster[2]): saves+0x0c(DISP_INT) and+0x10(DISP_EXT) and restores only non-zero low nibbles on wake. - Combined-tree validation: deep x3 pass on J575c with
#3653at12de58f8, and 10 GbE wake-loss rate dropped from 4/~55 to 2/~130.
Evidence
- Diff scope:
+180/-17indrivers/soc/apple/t6041-sleep.conly; no defects found in the new12de58f8port-stop logic. - Ready condition: Upgradeable to
APPROVEonce hosted fork CI runs green and the standalone12de58f8boot row is posted.
There was a problem hiding this comment.
Verdict: MERGE at 12de58f865e5
Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.
Checked: - GP PCIe port stop (t6041_gp_ports_stop()): follows the sleep-t6040.h sequence (mask/clear link interrupts, disable appclk CG, APCIE_PORT_L2_ENTER poll, assert endpoint PERST# GPIO and save asserted level into gpio_pre when not skipped so wake's GPIO restore never deasserts PERST# ahead of refclk, clear APCIE_PHY_LINK, hold 1 ms, clear APCIE_PORT_PERST under PERST_GUARD, drop PHY enables/reset/clocks and port appclk).
- GPIO bounds & wake clock restore (
t6041_map_apcie(),t6041_gp_pcie_clk()):gp_perst[]initializes to-1and is populated only whenargs.np == pin_npandargs.args[0] < s->npins, guaranteeings->gpioands->gpio_prebounds. Wake restore handles active ports0..3viagp_upand skips settingAPCIE_PHY_LINKwhengp_perst[i] >= 0sopcie-applebrings the link back cleanly after PERST# release. - Display cluster restore (
pre_disp_cluster[2]): saves+0x0c(DISP_INT) and+0x10(DISP_EXT) and restores only non-zero low nibbles on wake. - Combined-tree validation: deep x3 pass on J575c with
#3653at12de58f8, and 10 GbE wake-loss rate dropped from 4/~55 to 2/~130.
Follow-ups (not blocking): fork CI approval; standalone J575c boot row
|
Merging at |
What: Update
drivers/soc/apple/t6041-sleep.cto save and restore optional GP PCIe ports 2/3 (when described and set up) and display cluster registers+0x0c(DISP_INT) and+0x10(DISP_EXT, backingDISPEXT_RAIL_V) across T6041 deep sleep.Tested: J575c (Mac Studio M4 Max, T6041) at
3cfb4d073b7c: standalone boot of7.3.0-1-132-ARCHwith unmodified head DTB, default Arch cmdline, and stockaura(HDMI-A-1andDP-2active at2560x1440,0failed units,0new kernel warnings/errors,s2idle1/1 viartc0with unchangedboot_id);checkpatch --strict0/0/0,LLVM=1 W=1 t6041-sleep.o0warnings.Risk: two-way door · T6041 (J575c, J614c, J616c). Boards without
port2/port3in DT keepgp_port[2..3]NULL and restore only active ports 0/1; display cluster restore only writes non-zero pre-sleep low nibbles back to+0x0c/+0x10.Not yet: a J614c/J616c peer deep-sleep run; live hardware deep-sleep commit/wake on J575c at this standalone commit (unmodified
t6041-j575c.dtsdoes not yet wire&t6041_sleep— deep-sleep DT enablement is a separate follow-up PR; the samet6041-sleep.cchanges were previously exercised across 6/6 J575c deep-sleep cycles in a combined development tree).Details
apple,apciein addition to ports 0 and 1. Expandgp_port[]/gp_phy[]and saved state arrays from 2 toT6041_GP_PORTS(4), map optionalport2/port3andphy2/phy3silently viat6041_apcie_block()while keepingport0/port1andphy0/phy1required forapcie_ready, track active ports (gp_phy_pre[i] & BIT(0)) ingp_upduringt6041_save(), and restore clocks int6041_gp_pcie_clk()only for ports set ingp_up.s->cluster + 0x0c(DISP_INT) and+0x10(DISP_EXT, backingDISPEXT_RAIL_V), whilet6041_sleep_return()previously restored only CPU clusters+0x0,+0x4, and+0x8. Save+0x0cand+0x10intopre_disp_cluster[2]int6041_save()and restore their low nibble when non-zero int6041_sleep_return().Evidence
scripts/checkpatch.pl --strict --no-tree3cfb4d073b7c0 errors, 0 warnings, 0 checks)LLVM=1 W=1 drivers/soc/apple/t6041-sleep.o3cfb4d073b7c0warnings)Image+modules+dtbs(7.3.0-1-132-ARCH)3cfb4d073b7c43warnings = baseline)7.3.0-1-132-ARCH, unmodified head DTB, default Arch cmdline, stockaura)3cfb4d073b7cHDMI-A-1+DP-2active2560x1440,0failed units,0new warnings/errors,s2idle1/1 viartc0sameboot_id)