Skip to content

soc: apple: pmp: carry T6030 firmware data across deep sleep - #3812

Merged
DjDeveloperr merged 2 commits into
mainfrom
feat/t6030-pmp-sram-restore
Dec 2, 2026
Merged

DjDeveloperr merged 2 commits into
mainfrom
feat/t6030-pmp-sram-restore

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

What: Add the T6030 PMP firmware profile and keep its __DATA SRAM segment across deep sleep. Map the full SRAM aperture in the static tree and both overlays. Use the RTKit held-receive path from the parent PR for the firmware handoff.

Tested: All 24 PMP host runs passed. The AArch64 build compiled the PMP Rust and C objects, J516s DTB, and both overlays. Strict checkpatch and whitespace checks passed.

J516s, integrated kernel af2647f710fd, direct-t357h-02: PMP recovered its 0xbaadf1ac context marker after each firmware restart, and both wake windows added zero priority 0–3 kernel records.

J516s at exact head f6f16ec2f262 (boot_id=26dabcc4-5c46-43b3-bde1-45279e688760, 2x 20 s physical deep S2R resumes 0 -> 1 -> 2): PMP report running: 1, PTD request (0x3503c1180) == ACK (0x3503c11c0) == 0x10080 pre-sleep and after both cycles, all 15 active SoC/die/battery/NVMe thermal sensors valid, aurora-g16 M4 cooling ramped backstop=8..0 (limit=S1..S8), and post-Cycle-2 gpubench-vk render.mdi passed (crc 06f8412a, effective S8, health: failed 0). J714s peer-control S2R row also passed at 5ae7d67e (kernel code unchanged at f6f16ec2).

Risk: Two-way door. The new profile and SRAM size apply to T6030. The firmware idle and restart helpers are shared.

Not yet: Nothing

Use the T6030 registry and power acknowledgements and idle PMP at
commit without polling the ASC CPU. Keep the firmware data segment
when the sleep engine reloads its text. Extend the mapped range in
the T6030 device tree and both PMP overlays so it covers the data.

Signed-off-by: Diljit Singh <hey@djdev.me>
@DjDeveloperr
DjDeveloperr marked this pull request as ready for review December 1, 2026 17:02
@DjDeveloperr
DjDeveloperr requested review from a team as code owners December 1, 2026 17:02
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

J516s t358b-01, integrated kernel 88015f7de308: stock command line and read-write root, 180.08 s physical RTC deep sleep. PMP restarted with the saved 0xbaadf1ac context marker, and stock 7.3.0 handback passed. The second systemctl suspend -i attempt was denied by logind before entering the kernel sleep path. Hardware testing at the PR head and on a peer PMP generation remains open.

@github-actions github-actions Bot added area:platform Area from CODEOWNERS (bot) blast:m3 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Merge readiness at f6f16ec2: not ready yet

Check Detail
CI at head running running: apple-build, KUnit plan
Review ok approved by satchlj
Requested changes ok none
Hardware row at head ok comment at f6f16ec2
Conflicts ok none
PR text ok Risk: two-way · . The new profile and SRAM size apply to T6030. The firmware idle and restart helpers are shared.
Hold no labelled hold by a maintainer

Areas: area:gpu, area:platform

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@github-actions github-actions Bot removed the ci-failing A check failed at the PR head (bot) label Dec 1, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

J516s (T6030, M3 Pro) hardware qualification PASS for exact head 5ae7d67e54e00346449c8377193febed12768707 (qualified unchanged inside the integrated #3818 T6030 S2R candidate e9ce12c1c2381a20e24ea1ed3ebf19a02ae7f24f, run pr3818-qual-03, 7.3.0-t6030s2r #64, boot=e8c203da-da14-410c-9946-25636a7b8481):

  • 2 consecutive same-boot zero-flag production deep-sleep cycles: resumes 0 -> 1 -> 2 (90.06s + 59.31s, NUB.SPMI0.SW3, MBSE 0x10650, 0 suspend/resume priority 0–3 kernel errors, all 5 PMU scratch regions byte-identical to stock boot).
  • Scoped verification: PMP data SRAM preservation across deep sleep (PMP wake 0x4d0 6us / 0x4c8 8us on both cycles, zero PMP wake errors).
  • Clean stock handback: verified back on stock 7.3.0 (boot=428632eb-f34e-427f-8014-cd7167d9cea1, both ESPs efab68fa..., empty grubenv, 0 failed units). Non-T6030 shared-driver peer hardware rows remain tracked separately before merge.

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 1, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

J714s (M5 Pro, T6050) second-generation peer-control S2R row at exact unchanged head 5ae7d67e54e00346449c8377193febed12768707: PASS.

Candidate: refs/aurora/m3-lead/shared-control-batch-20261202-v2 (59b414a7cbe3d97067e2b7c2d76359be8cc29af5 on main cf03d96bf209, all 13 PR heads included unchanged as merge parents).

  • Kernel: 7.3.0-m5-s2rbatch-59b414a7 (boot_id 158c330e-c583-4032-a79d-f092b07c7828, 16 SLC planes, SEP writes ENABLED, 0 GPU/MMU/DART/IOMMU/DCP/ISP/RTKit/BCM4377 faults).
  • Physical PMU RTC deep sleep/wake: rtcwake -d /dev/rtc1 -m mem -s 30 exited 0, suspend_stats 0 -> 1 (fail 0), firmware boot object resumes 0 -> 1 (AP 76 NUB.SPMI0Sw3IRQ / rtc), elapsed 30.492 s, same boot_id pre/post.
  • Handback: clean return to stock 7.3.0-m5-pr67 (boot_id 6c48d997-34de-4cbd-abe5-b8ecd12b4a7d, 13/13 slot+Stage2 hashes, 71/71 ICD hashes, pacman -Qkk mesa 0 altered).
  • Subsystem evidence: apple_pmp 284500000.pmp + apple-pmp-report 284240000.pmp-report (PMP running (status 0x1), PTD boot entries written (60 steps), all 6 report@* devices + debugfs intact pre/post) resumed cleanly (RTKit: sleep return: ASC control 0x0, setting RUN); 0 PMP/CLPC errors.

Base automatically changed from feat/apple-sio-rtkit-held-rx to main December 2, 2026 08:53
satchlj
satchlj previously approved these changes Dec 2, 2026

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at 5ae7d67e54e00346449c8377193febed12768707
Blockers: none
Checked: no Apple material, no inappropriate model gating, default command-line compatibility, t6030.dtsi and PMP overlays SRAM sizing, pmp.rs HW_CFG_T6030 profile, pmp-export.c commit-stop / hold_rx / resume_rx / wake_err paths, rtkit.c cpu_control == NULL handling, CI checks, J516s and J714s exact-head hardware receipts, PR text

Evidence
  • arch/arm64/boot/dts/apple/t6030.dtsi, drivers/soc/apple/t6030-j516s-pmp.dtso, and drivers/soc/apple/t6030-pmp.dtso: widen the PMP SRAM reg window from 0x80000 to 0xc0000 consistently (0x3a000 + 0x66000 = 0xa0000 <= 0xc0000).
  • drivers/soc/apple/pmp.rs: adds register_ack_index and commit_cpu_down flags to PmpHwConfig (defaulting true on all existing profiles, false on HW_CFG_T6030) and passes null_mut() for stop.control when !commit_cpu_down.
  • drivers/soc/apple/pmp-export.c & drivers/soc/apple/rtkit.c: verified apple_rtkit_sleep_idle_polled() skips CPU_STATUS polling safely when cpu_control == NULL; apple_pmp_commit_stop_fn() reads apple_rtkit_mailbox_status() once when !c->control; apple_rtkit_hold_rx() is properly paired with apple_rtkit_resume_rx() on both refused-sleep branches, cleared before apple_pmp_wake() on firmware resume, and bypassed cleanly if wake_err != 0 leaves PMP power words off.
  • Non-blocking nit: drivers/soc/apple/pmp-export.c:52 mentions an internal capture slug in a comment; fine to trim in a follow-up.
  • Readiness & hardware rows at exact head 5ae7d67e54: pr-readiness green (7 checks passed, MERGEABLE, zero conflicts); J516s (T6030, #issuecomment-7324095094) 2-cycle physical deep sleep with PMP SRAM restore and J714s (T6050, #issuecomment-7339042545) second-generation peer-control physical deep sleep both passed.

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 2, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Local CI at head 5ae7d67e54e0 on current main: one host test breaks. Not merged.

Hosted apple-build, dt-checks and host-tests never ran at this head, because the base moved to main after #3806 merged. I ran them on pc on main d8eed40924b7 + #3920 + #3805 + this PR (git merge-tree --write-tree --merge-base=a1c854e15930, clean).

  • apple-build (make LLVM=1 W=1 ... drivers/soc/apple/ apple/t6030-j514s.dtb apple/t6030-j516s.dtb): rc 0; pmp.o, pmp-export.o and both overlays rebuilt; the W=1 warning set is identical to main.
  • dt-checks (scripts/dtc/apple-dt-check.sh and the coverage, DART power-domain and drift steps): 0 new warnings, every step rc 0.
  • KUnit plan selects sep; kunit.py build --arch=arm64 --kunitconfig=drivers/soc/apple/sep.kunitconfig builds (not run: no QEMU on pc).
  • host-tests: display26-tests fails with this PR and passes without it (main, and main + drm/asahi: g17: copy and prepare VM_BIND batches in kvmalloc memory #3920 + soc: apple: select T6030 interrupt, GPIO and ANS sleep profiles #3805). The test compiles drivers/soc/apple/pmp-export.c against mock headers. Its mock linux/soc/apple/rtkit.h and linux/soc/apple/sleep.h don't declare the calls this PR adds, so -Werror stops on implicit declarations of apple_rtkit_mailbox_status, apple_rtkit_hold_rx, apple_rtkit_resume_rx and apple_sleep_coproc_wake_error.

Adding four asserting stubs to the mocks in tools/asahi/display26-tests.py makes it pass on the same tree (1/1). This is a test-only change, so the hardware rows at this head still hold:

               'static inline void apple_rtkit_mailbox_recv_off(struct apple_rtkit *r) { assert(!"no system sleep here"); }\n'
+              'static inline u32 apple_rtkit_mailbox_status(struct apple_rtkit *r) { assert(!"no system sleep here"); return 0; }\n'
+              'static inline void apple_rtkit_hold_rx(struct apple_rtkit *r) { assert(!"no system sleep here"); }\n'
+              'static inline void apple_rtkit_resume_rx(struct apple_rtkit *r) { assert(!"no system sleep here"); }\n')
...
               'static inline bool apple_sleep_commit_stops_coprocs(void) { assert(!"no system sleep here"); return false; }\n'
+              'static inline int apple_sleep_coproc_wake_error(struct device *d) { assert(!"no system sleep here"); return -EIO; }\n')

The other three host-test failures in the combined run (qspi-nvram-tests, apple-dcp case 90, t6030-pmp-graph-tests --mutations) were runner timeouts under host load, and all three pass on a rerun with this PR in the tree. After the fix is pushed, this needs a fresh approval at the new head. Not yet also still lists PMP ACK and cooling rows. The J516s and J714s rows here show PMP SRAM restore and a clean PMP resume, but neither names the ACK and cooling parity check.

@DjDeveloperr DjDeveloperr added the hold Held on purpose; skipped by the PR digest label Dec 2, 2026
pmp-export.c now calls apple_rtkit_mailbox_status(),
apple_rtkit_hold_rx(), apple_rtkit_resume_rx() and
apple_sleep_coproc_wake_error(). The display26 host test compiles it
against mock rtkit.h and sleep.h headers that lack these declarations,
so -Werror stops on implicit declarations. Add asserting stubs like the
existing ones; the display test never reaches system sleep.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

I pushed f6f16ec2, a test-only commit on top of 5ae7d67e. It adds the four asserting stubs from 7345435740 to the display26-tests mocks (apple_rtkit_mailbox_status, apple_rtkit_hold_rx, apple_rtkit_resume_rx, apple_sleep_coproc_wake_error), which makes the host test pass on main + this PR. No kernel code changed, so the J516s and J714s rows at 5ae7d67e still apply. This needs a fresh non-author approval at f6f16ec2. hold stays until then and until the PMP ACK/cooling item under Not yet is either covered by a row or shown to be covered by the existing ones.

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MERGE (re-approved at f6f16ec2f262, subject to hosted CI / the existing hold note on the PMP ACK/cooling item).

  • Independently verified the interdiff 5ae7d67e...f6f16ec2 (ahead: 1, behind: 0): touches only tools/asahi/display26-tests.py, adding the four asserting mock stubs (apple_rtkit_mailbox_status, apple_rtkit_hold_rx, apple_rtkit_resume_rx, apple_sleep_coproc_wake_error) so the host test builds and passes against current main.
  • Zero kernel or DTS code changes relative to previously approved 5ae7d67e54e0; the J516s and J714s S2R PASS rows at 5ae7d67e54e0 and local CI receipt (#issuecomment-7345435740, #issuecomment-7345509328) carry over cleanly.

@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) and removed ready-to-merge Meets the merge policy: merge it (bot) labels Dec 2, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

J516s (T6030, M3 Pro) deep-S2R PMP ACK and cooling parity check at exact head f6f16ec2f2622bd01953f0172b4b45b2f8ac6c21 (merged unchanged into j516s-s2r-window -> c5875994b0a4, kernel 7.3.0-m3-dchid-m3-pr3812, boot_id=26dabcc4-5c46-43b3-bde1-45279e688760, stock cmdline, mem_sleep=s2idle [deep]): PASS.

  • 2 consecutive physical deep-sleep cycles (rtcwake -d rtc0 -m mem -s 20 x2): resumes 0 -> 1 -> 2 (NUB.SPMI0.SW3, MBSE 0x10650), PMP wake before/saved/active/after: 0x4d0 ... 6us, 0x4c8 ... 8us, apple_pmp 350500000.pmp: RTKit: sleep return: ASC control 0x0, setting RUN on both cycles, 0 PMP errors.
  • PMP report & PTD ACK parity (pre-sleep, post-Cycle 1, post-Cycle 2): /sys/kernel/debug/apple-pmp-report/3503c0000.pmp-report stayed running: 1, start: ready, start_result: 0, enabled: 1; PTD request (0x3503c1180) == ACK (0x3503c11c0) == 0x10080 on attempt 1 at all three checkpoints (and post-render).
  • Thermal & GPU cooling parity: cooling_device0 (aurora-g16g, cur=0, max=8) and all 15 active SoC/die/battery/NVMe sensors (thermal_zone0/1, macsmc_hwmon x10, macsmc_soc_die, macsmc_battery, nvme) read valid temperatures (33.2–54.3 °C) across both cycles (tas2764 speaker-amp hwmon channels return ENODATA while idle/runtime-suspended post-wake, which explains the earlier direct-t357h-02 script failure). aurora-g16 M4 cooling ramped cleanly through backstop=8..0, limit=S1..S8 post-Cycle 2 (mc=48295 sensor=None), and GB_VERIFY=1 gpubench-vk --test render.mdi passed at depth 1 and 4 (crc 06f8412a, valid: true, health: failed 0 errno 0 degraded 0, effective S8, temperature_mc 50220, updates 27).
  • Stock ESP restored: /boot/efi/m1n1/boot.bin restored and verified efab68fa0457a177220d75ba50aa92bc6d93bbd757a0e42ff8c2332ec92f9fe7.

@DjDeveloperr DjDeveloperr removed the hold Held on purpose; skipped by the PR digest label Dec 2, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Local CI receipt

Tested PR head f6f16ec2f2622bd01953f0172b4b45b2f8ac6c21 merged into main at bf2931e5704505cae7f73c550a4e0d16e2f2e802. The tested tree is 4180490fd2d1aca6174c7e54048958792ddc2ac9. git merge-tree --write-tree --merge-base=a1c854e159307af0f127ff9919d86a8a0116da87 <main> <head> merged cleanly.

  • apple-build — On the warm arm64 build on pc, make ARCH=arm64 LLVM=1 rustavailable, make ARCH=arm64 LLVM=1 defconfig, scripts/kconfig/merge_config.sh -m -O <out> <out>/.config arch/arm64/configs/asahi.config, and make ARCH=arm64 LLVM=1 olddefconfig passed. All workflow config assertions passed, including an added check for CONFIG_APPLE_PMP=m. With the corrected bindgen and O=<out>, make -j8 ARCH=arm64 LLVM=1 W=1 modules_prepare and make -j8 ARCH=arm64 LLVM=1 W=1 drivers/soc/apple/ apple/t6030-j514s.dtb apple/t6030-j516s.dtb passed. Both PMP objects, the two overlays, and both DTBs rebuilt. The same build on main and the merge tree produced identical device-tree warnings.
  • KUnit plan — python3 -I scripts/ci/apple-kunit.py plan passed and selected SEP through the shared drivers/soc/apple/*.rs rule. SEP does not exercise PMP, and PMP has no KUnit suite.
  • PMP and display host tests — python3 -I tools/asahi/run-host-tests.py --jobs 4 --work <work> --only pmp passed 24/24 in the pinned Ubuntu host-test container. The same command with --only display26 passed 1/1, including the mock that failed at the previous head. These runs also cover the T6030 PMP device-tree and graph tests.
  • pr-text — The canonical bash pr-text.sh check rejected the empty-body control and passed for both the current PR and the proposed Not yet edit, with both commits included.
  • readiness — DRY_RUN=1 REPO=aurora-silicon/linux PR=3812 python3 pr-readiness.py passed with zero writes. It confirmed the approval, hardware row, PR text, and clean merge. Hosted CI was the only remaining item.
  • Patch checks — git diff --check HEAD^ HEAD passed on the local merge tree. git format-patch --stdout -1 <commit> | scripts/checkpatch.pl --strict --no-tree - passed for both PR commits with zero warnings or errors.

@DjDeveloperr
DjDeveloperr merged commit 07686fb into main Dec 2, 2026
15 of 22 checks passed
@DjDeveloperr
DjDeveloperr deleted the feat/t6030-pmp-sram-restore branch December 2, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:m3 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants