Repository navigation
soc: apple: sleep: T6030: GP PCIe wake from the loader's ADT tables - #4234
Conversation
The ADT's /arm-io/apcie reg[2] (0x59e004000, 0xc000) is the window the loader's apple,tunable-phy records are relative to. The DT so far only named the phy-common and phy-shared parts of it. Add it to pcie0 as "phy-block", as other Apple PCIe hosts already do, so the T6030 sleep driver can apply that table after a deep sleep. pcie-apple maps its windows by index and doesn't use the new one. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The T6030 wake replayed about 450 register writes of the GP PCIe AXI bridge, CIO3 PLL, clock generator, PHY, PHY PLL and lanes that were captured from a macOS wake. Those are the values the ADT holds in /arm-io/apcie's apcie-*-tunables, the same tables aura applies when it brings the block up at boot. On every other Apple PCIe block Linux gets them from the loader as apple,tunable-* properties. Do the same on T6030: read apple,tunable-axi2af, -cio3pll, -clkgen, -phy, -phy-ip-pll and -phy-ip-auspma from the PCIe host and apply them during the existing wake steps, writing only registers whose value differs, like macOS does. The sequence around them (clock generator start, PHY clock requests, reset, run enables, ready, root complex) is the same as T6040's in apple_sleep_raise_apcie(). Only the PHY reset and up bits differ (7 and 9). When the loader didn't publish all six tables, apple_sleep_undescribed() keeps s2idle the default and T6030 refuses deep sleep, as it does for ANS without its tunables. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
J615 no-regression row (T8122, 27.2) at 9835b8d, booted with its own J615 DTB through aura-try (production aura b18, Stage 2 unchanged). The only shared change here is a T6030-only flag in sleep.c.
Still owed: the J516s row (aura#665 + this head, |
|
J516s row kit for this head is sealed; the M3 lead runs it.
|
|
Hardware verification on MacBook Pro 16-inch (M3 Pro, J516s, T6030, OS firmware 27.2) covering paired Stack
Result: PASS (all hardware & equivalence criteria met;
|
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
satchlj
left a comment
There was a problem hiding this comment.
Reviewed at head 9835b8d09b2f.
- Replacing the hardcoded 477-line
sleep-t6030-pcie-wake.htrace table with the six loader-publishedapple,tunable-*properties and thephy-blockDT window (0x59e004000 0xc000, matchingaura#665) is a clean win. - Missing-table / older-loader handling is thorough:
t6030_gp_map()markss->gp_pcie_undescribed, which keepss2idleas default viaapple_sleep_undescribed(), refuses deep sleep int6030_sleep_begin()with-EBUSY, and guardst6030_apcie_wake(). - Clock and PHY wake sequences cleanly apply changed tunables and poll each bring-up handshake with bounded timeouts; DT bindings and CI are green.
DjDeveloperr
left a comment
There was a problem hiding this comment.
Approve at 9835b8d. The ADT tables replace the captured constants, the wake runs in the same order as before, and deep sleep is refused cleanly when the tables are missing. Merge it after aura#667 and aura#665.
Wake path (sleep-t6030.h)
- At probe,
t6030_gp_map()parses all six tables throughapple_sleep_apcie_tunable(), which checks each one against its own DT window. It also needs every GP window mapped. A miss setsgp_pcie_undescribed. map_regsruns beforeapple_sleep_undescribed()in probe, and T6030 isn'tderived, so s2idle stays the default unless deep is asked for by name. Thent6030_sleep_begin()returns -EBUSY before touching anything.- The tables are only read at wake, and only when all six exist, so nothing can be half-applied.
- Order against the old sequence:
- Clocks: the axi2af, cio3pll and clkgen tables, then clkgen START go and the OFF bits cleared. That is the old
t6030_gp_clocks_wake()and T6040'sapple_sleep_raise_apcie(). - PHY:
- RC +0x4 zeroed and the phy table applied.
- phy-common bit 31 (reference clock), then the CLK0 and CLK1 request/ack.
- Reset bit 7 cleared, then the run enable.
- The PLL table, then the AUSPMA table, then run enable 2.
- Ready, common enable, and up bit 9.
- RC ready.
- I lined this up against the old 447-step capture and it's the same order. Bit 7 is the same T6030 reset bit aura's
pcie.cuses at boot (regs_t8122). gp_equiv EQUIVALENT on the J516s confirms the values.
- Clocks: the axi2af, cio3pll and clkgen tables, then clkgen START go and the OFF bits cleared. That is the old
- Other Macs: the changes are in the T6030 provider, plus one bool in
struct apple_sleepand one line inapple_sleep_undescribed(). That bool is never set on any other SoC. J514s gets only the DT window, and its sleep node stays disabled. rttdevsbot's J615 (T8122) no-regression row is above. - Org rules: no ADT-carried value is left in the driver.
- The remaining literals are the RC ready value 0x140, the same one T6040's path and aura use, and register bit positions.
- No module param or runtime switch.
- No board gate: the code is reached through the
apple,t6030-sleepcompatible.
Checks
- W=1 on pc, GCC 16.2.0, in a reflink copy of the warm kernel-r4234 output: only
drivers/soc/apple/sleep.orebuilt, 0 warnings. - Interactions:
- Merges cleanly on main a0e5cf1 (tree e0f806b5).
- Main moved 12 files since this PR's base 7303d70. They are DRM, cpufreq, tas2764 and tools; none is under
drivers/soc/apple,include/, the binding or the DTS, so the build result holds on main. - #4238 856939b (
pmp.rs) and #4243 46245a6 (DCP andinclude/linux/soc/apple/sleep.h) merge cleanly on top. They share no file with this PR.
- DT, on pc with LLVM=1 and dtschema:
dt_binding_checkonapple,pcie.yamlpasses at the base and the head.CHECK_DTBSoft6030-j514sandt6030-j516sgives the same 102 messages at the base and the head. None is new, and none is onpcie@580000000.- Control: the head DTS against the old binding fails with
reg ... is too longandreg-names ... is too longonpcie@580000000. So the binding change is needed, and it is enough.
- checkpatch, including
--strict, gives two warnings and nothing else:- DT_SPLIT_BINDING_PATCH: the binding and the DTS are in one commit.
- FILE_PATH_CHANGES: the deleted header. MAINTAINERS lists
sleep*.c, so there's nothing to update. Nothing else includes the header.
- Host tests at the head pass:
tools/asahi/t6030-sleep-qblk-tests.py,t8122-apcie-wake-tests.py,t8132-sleep-refuse-tests.pyandsio-engine-reset-tests.py.
Hardware: J516s (M3 Pro, fw 27.2) row at 9835b8d0: PASS, on aura main + #667 + #665 (receipt above):
- the published-tables line;
- gp_equiv EQUIVALENT (208/208 phy/phy-ip writes predicted, 12/12 axi2af/cio3pll/clkgen matched);
- 3/3 deep sleeps, 0 GP wake timeouts, 0 new errors.
Small things, none blocking:
- In
t6030_apcie_wake(),|| !t6030.gp_phy_blockadds nothing, becauset6030_gp_map()already setsgp_pcie_undescribedwhen that window is missing. It's harmless. - checkpatch would like the
apple,pcie.yamlchange in its owndt-bindings:commit. Fine to leave for this tree.
|
J516s (M3 Pro, T6030, OS firmware 27.2) hardware verification on Builds & boots
Key Arm B checks
|
Problem: #4067 brought T6030 (M3 Pro, J516s) deep sleep with a GP PCIe wake that replays about 450 register writes captured from a macOS wake:
sleep-t6030-pcie-wake.hand the constants int6030_gp_clocks_wake(). They are the AXI bridge, CIO3 PLL, clock generator, PHY, PHY PLL and lane tables that the ADT holds in/arm-io/apcieand aura applies at boot. Ryan's rule: nothing hard-coded; values come from the ADT, as M1/M2 and M4/M5 already do (the loader copies the ADT tables intoapple,tunable-*properties and the driver applies them).Change:
arm64: dts: apple: t6030: add the ADT reg[2] window (0x59e004000, 0xc000) to pcie0 asphy-block, the windowapple,tunable-phyis relative to. The binding now allows 19 entries for T6030. pcie-apple maps by index and doesn't use the new window.soc: apple: sleep: T6030: readapple,tunable-axi2af/-cio3pll/-clkgen/-phy/-phy-ip-pll/-phy-ip-auspmafrom the PCIe host and apply them during the existing wake steps. Like macOS, a register is only written when its value differs. The steps around the tables are the same as T6040'sapple_sleep_raise_apcie(): clock generator start, PHY clock requests, reset release, run enables, ready, phy-common enable, PHY up, root complex ready. Only the PHY reset and up bits differ (7 and 9).sleep-t6030-pcie-wake.his deleted. The power-word steps, PERST# handling and timings measured on our own Macs are unchanged.apple_sleep_undescribed()keeps s2idle the default andt6030_sleep_begin()refuses deep sleep: the same refusal model as ANS without its tunables.Needs aurora-silicon/aura#665, which publishes the tables. Merge order: aura#665, then the J516s runs it, then this PR. On an older aura the J516s loses deep sleep (refused; s2idle stays).
Tested: J615 (T8122) at 9835b8d, no regression: deep sleep stays the default, 2/2 deep cycles, Wi-Fi back (comment below). No J516s yet. W=1 build of
drivers/soc/apple/is clean (no new warnings). CHECK_DTBS withapple,pcie.yamlis clean on t6030-j514s and t6030-j516s; the same check without the binding change flags the 19-entry reg. dt_binding_check passes. The J516s ADT values are not posted anywhere.Risk: Two-way (plain revert). J516s (T6030) deep sleep only. J514s gets the DT window only; its sleep node stays disabled.
Still to run:
deep sleep is the default, nono GP PCIe tunableswarning.gp_equiv.pybelow must print EQUIVALENT (counts only). Then 2-3 committed deep sleeps with Wi-Fi, SD and Bluetooth back and no WARNING/SError.Prior art and offset match
pcie_init_controller()appliesapcie-axi2af/-common/-phy/-phy-ip-pll/-phy-ip-auspma-tunablesfrom the ADT at boot and re-runs it after a sleep. T6040/T8140: auradt_set_t6040_sleep_apcie()publishes the same six tables plus windows, andapple_sleep_map_apcie()/apple_sleep_raise_apcie()apply them. T8142:dt_set_t8142_sleep_apcie(). Post-M4 ANS:pcie_apcie_tables_fdt()./arm-io/apcie. The offsets the J516s capture touched match them: all 13 axi2af offsets and all 7 cio3pll offsets exactly. The clkgen write is its single record's masked bits, followed by START go and OFF2 clear (the T6040 sequence). The phy table's 0x800c/0x8010 are the capture's phy-shared +0xc/+0x10 reads. The PHY-IP writes run the PLL table first, then the per-lane AUSPMA tables, in table order. The capture's 7 remaining phy writes are the sequence steps above.gp_equiv.py: check the published tables against the old capture (J516s, counts only)
Self-check: tables built from the capture's own writes give EQUIVALENT; flipping one bit in one lane record gives DIFFERENT.