Skip to content

pmdomain: apple: pmgr-pwrstate: enable auto-managed domains early at boot (T6041) - #2175

Draft
AxxzyWasTaken wants to merge 3 commits into
aurora-silicon:integration/aurorafrom
AxxzyWasTaken:pr/t6041-sleep-mem-auto
Draft

AxxzyWasTaken wants to merge 3 commits into
aurora-silicon:integration/aurorafrom
AxxzyWasTaken:pr/t6041-sleep-mem-auto

Conversation

@AxxzyWasTaken

@AxxzyWasTaken AxxzyWasTaken commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Reworked per review to be completely standalone (rebased directly onto integration/aurora 606d37ec77a5, decoupled from #1664) and driven purely from DT PMGR power-state nodes via apple,auto-managed (zero module parameters, zero hardcoded physical address tables):

  1. dt-bindings: power: apple,pmgr-pwrstate: add apple,auto-managed: adds boolean apple,auto-managed with mutual-exclusion constraints against apple,no-auto-pm, apple,firmware-owned, and apple,inherited-on.
  2. pmdomain: apple: pmgr-pwrstate: enable auto-managed domains early at boot: adds arch_initcall(apple_pmgr_ps_auto_init) walking available apple,auto-managed PMGR power-state nodes via their parent syscon regmap before PMP starts, switching forced-on domains to AUTO_ENABLE while skipping fused-off/reset/already-auto words cleanly. At probe, inactive (fused-off) domains return -ENODEV silently and active ones register as GENPD_FLAG_ALWAYS_ON without rewriting registers, refusing power-off/reset and skipping suspend_noirq/resume_noirq so firmware wake never rewrites AUTO_ENABLE while PMP is running. Includes 3 KUnit tests and pmgr-inherited.py coverage.
  3. arm64: dts: apple: t6041: describe auto-managed DCS and fabric power states: adds t6041-pmgr.dtsi with all 44 ADT-verified T6041 DCS (32) and fabric (12) PMGR nodes (36 active on binned 24-channel J616c; all 44 active on 32-channel J614c; drops duplicate disabled ps_fab5_soc from t6041-j614-j616-j575-scaler.dtsi).

Verification

  • Head 5726722abcad, 3 bisectable commits on 606d37ec77a5.
  • All 44 PMGR domains verified 1:1 against live J616c ADT (/arm-io/pmgr).
  • dt_binding_check (apple,pmgr-pwrstate.yaml): PASS.
  • CHECK_DTBS=y across t6041-j616c.dtb, t6041-j614c.dtb, t6041-j575c.dtb: 0 errors/warnings.
  • W=1 build of drivers/pmdomain/apple/pmgr-pwrstate.o: 0 warnings.
  • tools/testing/selftests/drivers/apple/pmgr-inherited.py: 5/5 PASS.
  • scripts/checkpatch.pl --strict: 0 errors (only new-file MAINTAINERS notice on Commit 3).
  • Hardware test scope: boot verification on exact head 5726722abcad (confirming apple-pmgr-pwrstate: 36 auto-managed domains enabled, 0 failed on J616c) is queued for our next idle test boot; J575c is untested and J614c 44/44 was previously tested on the earlier table prototype.

Assisted-by: LLM (Google:Gemini 4 Neon)

@AxxzyWasTaken
AxxzyWasTaken force-pushed the pr/t6041-sleep-mem-auto branch from a0ab1c8 to 42443cc Compare November 17, 2026 22:02
@joske

joske commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Tested on the J614c (16-core CPU / 40-core GPU M4 Max, the full T6041 with 32 memory channels), on top of #1664.

The full part has eight DCS channels that the J616c list doesn't cover: dcs_24-27 and dcs_28-31. On the J614c, iBoot leaves them forced on like the other 24, so with only the 36 words from the PR they stay on. I added them after the others in each block:

	0x502800210, 0x502800220, 0x502800230, 0x502800240,	/* dcs_16-19 */
	0x502800250, 0x502800260, 0x502800270, 0x502800530,	/* dcs_24-27 (full part) */
	...
	0x502280320, 0x502280328, 0x502280330, 0x502280338,	/* dcs_20-23 */
	0x502280340, 0x502280348, 0x502280350, 0x502280358,	/* dcs_28-31 (full part) */

dcs_27 isn't next to dcs_26: it's at main +0x530, and +0x280 is amcc27. It's the same word as the dcs_27 line I suggested on #1664. I don't know macOS's order for these eight. I used the ADT order, since I have no J614c ApplePMGR trace.

Result:

  • The boot says memory and fabric power management: 44 words on AUTO, 0 late, with no new errors. All eight were forced on and got switched.
  • A lid sleep and wake afterwards works, with the same wake log as without the change.
  • I didn't measure power.

On the J616c the eight extra words should be fused off, so your check skips them and the count stays at 36. I can't test that here. Could you confirm it on yours, if you add them?

🤖 Generated with Claude Code

AxxzyWasTaken added a commit to AxxzyWasTaken/linux that referenced this pull request Nov 18, 2026
… too

The full T6041 has 32 memory channels, the binned one 24. The words put
on AUTO at boot come from a binned J616c, so on a full part iBoot's
forced-on dcs_24-31 stayed forced on.

Add their eight power-state words after the other DCS words of each
PMGR group: dcs_24-27 in the main group, where dcs_27 is at +0x530, as
+0x280 is amcc27, and dcs_28-31 in the East group. They go in ADT
order, as there is no macOS trace from a full part. On the binned part
they are fused off, so the existing check skips them: the binned part
puts 36 words on AUTO, the full part 44.

The full part's eight DCS words and their order come from joske's J614c
test on aurora-silicon#2175.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
@AxxzyWasTaken

Copy link
Copy Markdown
Contributor Author

Thanks for testing it on the full part, and for the words.

I've added them as a new commit on top, "soc: apple: t6041-sleep: the full part's DCS channels on AUTO at boot too", as you wrote them: dcs_24-27 after dcs_16-19, with dcs_27 at main +0x530, and dcs_28-31 after dcs_20-23, in ADT order. The comment above the list now says that the full part's words are in ADT order and that the binned part skips them. The commit message credits your J614c test.

On this J616c (binned: 24 channels, 6 AMCCs), one boot of my daily kernel with only this commit added:

  • The boot line: t6041-sleep: memory and fabric power management: 36 words on AUTO, 0 late.
  • All eight words read 0x0f000300 after that boot (target 0, actual 0, auto 0): fused off on the binned part, so the check skips them. That includes dcs_27 at +0x530, which hadn't been read on the J616c before.
  • No warnings or errors in the first 120 s that the daily boot doesn't have (the only differing line is which out-of-tree module printed the taint notice first).

Seven of the eight (dcs_24-26 and dcs_28-31) already read 0x0f000300 here when I looked at them for #1664 on 13 Nov. dcs_27 at +0x530 wasn't among the words I read then.

So the count stays at 36 here, and it's 44 on your J614c.

Disclosure: prepared with an AI tool (the commits carry Assisted-by: LLM); tested as described.

AxxzyWasTaken added a commit to AxxzyWasTaken/linux that referenced this pull request Nov 20, 2026
… too

The full T6041 has 32 memory channels, the binned one 24. The words put
on AUTO at boot come from a binned J616c, so on a full part iBoot's
forced-on dcs_24-31 stayed forced on.

Add their eight power-state words after the other DCS words of each
PMGR group: dcs_24-27 in the main group, where dcs_27 is at +0x530, as
+0x280 is amcc27, and dcs_28-31 in the East group. They go in ADT
order, as there is no macOS trace from a full part. On the binned part
they are fused off, so the existing check skips them: the binned part
puts 36 words on AUTO, the full part 44.

The full part's eight DCS words and their order come from joske's J614c
test on aurora-silicon#2175.

Assisted-by: LLM
Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
@AxxzyWasTaken
AxxzyWasTaken force-pushed the pr/t6041-sleep-mem-auto branch from f207e78 to 4c4ebec Compare November 20, 2026 14:13
@AxxzyWasTaken

Copy link
Copy Markdown
Contributor Author

Restacked on the rebased #1664 (integration/aurora 391fac6; head 4c4ebec), and it's no longer conflicting. Both commits applied unchanged.

On my J616c, the head boots with "memory and fabric power management: 36 words on AUTO, 0 late" and 24 memory channels. One deep sleep and wake on it went cleanly: GPU, Wi-Fi and Bluetooth all came back, with 0 GPU fault lines. Host tests are 449/450, the same as the base; the details are on #1664.

@RyanTheTide

Copy link
Copy Markdown
Contributor

This PR adds a t6041_mem_auto= kernel command-line parameter in drivers/soc/apple/t6041-sleep.c and, behind it, a fixed table of physical PMGR register addresses written at arch_initcall when of_machine_is_compatible("apple,t6041"). Those domains are described in the device tree; the AUTO_ENABLE step should be driven from the PMGR power-state nodes (their reg and a property marking them auto-managed), with no command-line switch. The SMC pre-commit writes in apple_smc_sleep_commit() and dcp_t6041_s2r_all() are likewise chosen by the SoC compatible instead of the device's own node, and the display sleep path relies on fixed msleep() values documented only as measured; these should become bounded polls on the state they wait for. Until then this should stay a draft.

@AxxzyWasTaken
AxxzyWasTaken force-pushed the pr/t6041-sleep-mem-auto branch from 4c4ebec to 9b996dd Compare November 21, 2026 09:48
AxxzyWasTaken added a commit to AxxzyWasTaken/linux that referenced this pull request Nov 21, 2026
… too

The full T6041 has 32 memory channels, the binned one 24. The words put
on AUTO at boot come from a binned J616c, so on a full part iBoot's
forced-on dcs_24-31 stayed forced on.

Add their eight power-state words after the other DCS words of each
PMGR group: dcs_24-27 in the main group, where dcs_27 is at +0x530, as
+0x280 is amcc27, and dcs_28-31 in the East group. They go in ADT
order, as there is no macOS trace from a full part. On the binned part
they are fused off, so the existing check skips them: the binned part
puts 36 words on AUTO, the full part 44.

The full part's eight DCS words and their order come from joske's J614c
test on aurora-silicon#2175.

Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
@AxxzyWasTaken
AxxzyWasTaken force-pushed the pr/t6041-sleep-mem-auto branch from 9b996dd to 5726722 Compare November 22, 2026 00:46
@AxxzyWasTaken AxxzyWasTaken changed the title soc: apple: t6041-sleep: memory and fabric power management at boot, as macOS pmdomain: apple: pmgr-pwrstate: enable auto-managed domains early at boot (T6041) Nov 22, 2026
@AxxzyWasTaken

Copy link
Copy Markdown
Contributor Author

Pushed standalone DT-driven rework 5726722abcad on 606d37ec77a5 (decoupled from #1664, dropped t6041_mem_auto= and physical address tables, added apple,auto-managed PMGR binding + early arch_initcall + suspend_noirq/resume_noirq skip + 44 ADT-verified T6041 PMGR nodes in t6041-pmgr.dtsi). Boot verification row on exact head 5726722abcad on J616c is queued for our next idle window.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the rework. At 5726722 the command-line parameter and the address table are gone, and the AUTO_ENABLE switch is driven by apple,auto-managed on the PMGR power-state nodes, walked at arch_initcall from the parent syscon. The SMC and display sleep points from the last review no longer apply here, since this PR no longer carries #1664.

Before this leaves draft:

  • drivers/pmdomain/apple/pmgr-pwrstate.c:1015-1020: an auto-managed node that reads off at probe returns -ENODEV. That fits the fused-off DCS channels, but t6041-pmgr.dtsi also marks the always-on fabrics auto-managed, including &ps_fab3_soc and &ps_fab6_soc (t6041-pmgr.dtsi:249, 410), which are parents of other domains (t604x-pmgr.dtsi:76, 167, 177, 206; t6040-pmgr.dtsi:299, 495; the scaler dtsi:37). This branch replaces the always-on path just below it, which turns on an always-on domain the boot loader left off. If a fabric is ever off at boot, it is now not registered, and everything under it defers forever with only a dev_dbg. Please skip only words that are off and not always-on (or match the fused-off pattern), and turn on or loudly fail an always-on auto-managed domain that is off.
  • apple_pmgr_ps_node_is_auto_managed() leaves out every apple,t8132-pmgr-pwrstate node, but the binding only forbids apple,auto-managed together with apple,inherited-on there, and probe still treats such a node as auto-managed. Either forbid the property for that compatible in the binding or drop the compatible check, since the inherited-on check already covers it.
  • apple_pmgr_ps_resume_noirq() now skips these domains. Please show that the words are still on AUTO after a deep-sleep wake, so the firmware does not leave them forced on until the next boot.
  • t6041-j614-j616-j575-scaler.dtsi had ps_fab5_soc disabled; it is now enabled through t6041-pmgr.dtsi. Please say in the commit why it was disabled and why it is safe now.

Rows wanted at this head: on the J616c and the J614c, the boot line (36 and 44 enabled, 0 failed), a dump of the words after boot and after a deep-sleep wake, an empty /sys/kernel/debug/devices_deferred, and 0 new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

@AxxzyWasTaken
AxxzyWasTaken force-pushed the pr/t6041-sleep-mem-auto branch from 5726722 to 5bc6f6c Compare November 22, 2026 03:31
@AxxzyWasTaken

Copy link
Copy Markdown
Contributor Author

Pushed 5bc6f6ca2d68 addressing the code, binding, and commit-message review points:

  • apple,pmgr-pwrstate.yaml + pmgr-pwrstate.c: forbid apple,auto-managed on apple,t8132-pmgr-pwrstate consistently across binding, arch_initcall, and probe.
  • pmgr-pwrstate.c: in probe(), fail loudly with -EIO (dev_err_probe) if an apple,always-on auto-managed domain (such as ps_fab3_soc / ps_fab6_soc) reads off at boot, while still skipping non-always-on fused-off channels (dcs_24-31) with -ENODEV.
  • Commit 3 message: documented why ps_fab5_soc was originally disabled in t6041-j614-j616-j575-scaler.dtsi (commit db5f2eefb35c) and why enabling it as apple,always-on + apple,auto-managed in t6041-pmgr.dtsi is safe.

Validated with dt_binding_check, CHECK_DTBS=y apple/t6041-j616c.dtb, W=1 build of pmgr-pwrstate.o, pmgr-inherited.py (5/5), and checkpatch --strict (0 errors). Boot + deep-sleep wake AUTO verification rows on J616c remain queued before leaving draft.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks. At 5bc6f6c:

  • The always-on case is handled: an auto-managed domain with apple,always-on that reads off now fails with -EIO and an error line (drivers/pmdomain/apple/pmgr-pwrstate.c:1015-1021). Every fabric node in t6041-pmgr.dtsi carries apple,always-on, including fab3/fab6 through t604x-pmgr.dtsi, so only the DCS channels take the quiet -ENODEV path. Fixed.
  • t8132: the binding now forbids apple,auto-managed for that compatible and probe rejects it (pmgr-pwrstate.c:976-978), matching the initcall. Fixed.
  • ps_fab5_soc: the explanation is fine, but it cites the wrong commit. db5f2ee doesn't touch ps_fab5_soc. The disabled node came from 30f87ea ("arm64: dts: apple: describe both disabled M4 Max scalers"). Please fix the reference in the third commit's message.
  • Resume still skips these domains (pmgr-pwrstate.c:645-647), so the after-wake word dump is still the proof for that.

Rows wanted at this head: on the J616c and the J614c, the boot line (36 and 44 enabled, 0 failed), the words after boot and after a deep-sleep wake, an empty /sys/kernel/debug/devices_deferred, and 0 new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

@AxxzyWasTaken
AxxzyWasTaken force-pushed the pr/t6041-sleep-mem-auto branch from 5bc6f6c to 5c074c7 Compare November 22, 2026 07:17
@AxxzyWasTaken

Copy link
Copy Markdown
Contributor Author

Pushed 5c074c7e9065 fixing the commit reference in commit 3's message from db5f2eefb35c to 30f87ea48eaa ("arm64: dts: apple: describe both disabled M4 Max scalers"). Tree is bit-identical to 5bc6f6ca2d68. J616c boot + post-deep-sleep AUTO verification rows remain queued before leaving draft.

@AxxzyWasTaken

Copy link
Copy Markdown
Contributor Author

J616C (M4 Max 16c/32g, 6-MCC) exact-head boot & s2idle verification (tree-identical to 5c074c7e9065, 7.3.0-j616c-pr2175+, Stage 2 1.0.0b14-g6ac0495f):

  • Early boot auto-managed PMGR init (dmesg):
    • apple-pmgr-pwrstate: 36 auto-managed domains enabled, 0 failed (44 apple,auto-managed nodes described in DT; 36 active on 6-MCC J616C).
  • pm_genpd_summary: dcs_00..23, fab0_soc..fab7_soc, fab_afr, fab_gw_0, fab_gw_1, nub_fabric all on.
  • s2idle check: rtcwake -d /dev/rtc1 -m freeze -s 5 exited 0, clean resume.
  • Health: FAILED_UNITS=0, aurora GPU loaded, wlan0 UP.

(Keeping Draft until the companion #1664 v2 deep-sleep soak confirms post-deep-sleep AUTO state on J616C.)

@AxxzyWasTaken
AxxzyWasTaken force-pushed the pr/t6041-sleep-mem-auto branch from 5c074c7 to da4ddab Compare November 22, 2026 15:10
@AxxzyWasTaken

AxxzyWasTaken commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebased onto integration/aurora (00cbc67d1a0c → 9e68dccbc8fb) to resolve the EOF conflict in arch/arm64/boot/dts/apple/t6041.dtsi after #2778 (ave1) and #2266 (ave). Zero semantic changes (pmgr-pwrstate.o + t6041-{j616c,j614c,j575c}.dtb W=1 clean, 44 apple,auto-managed properties intact, pmgr-inherited.py 5/5 pass). Keeping Draft pending the paired #1664 v2 post-deep-sleep AUTO row on J616c.

Add the apple,auto-managed boolean property for hardware-managed power
domains (such as DRAM channel slices and memory fabrics) that the boot
loader may leave forced on and that must be switched to hardware
automatic power management (AUTO_ENABLE) early at boot, before the PMP
firmware starts.

Disallow combining apple,auto-managed with apple,no-auto-pm,
apple,firmware-owned, apple,inherited-on, or apple,t8132-pmgr-pwrstate.

Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
…boot

Early at boot, before the PMP starts, hardware-managed power domains left
forced on by iBoot must be switched to automatic power management (write
target 0xf, wait for actual 0xf, then set AUTO_ENABLE). On Apple Silicon
systems where iBoot leaves memory channel or fabric domains forced on,
enabling AUTO_ENABLE after PMP is running freezes the SoC.

Walk available apple,auto-managed PMGR power-state nodes at arch_initcall
via their parent syscon regmap and switch forced-on words to AUTO_ENABLE,
leaving fused-off, reset, or already auto-managed words untouched. At
probe time, reject apple,t8132-pmgr-pwrstate consistently with the
binding, fail loudly with -EIO if an apple,always-on auto-managed domain
is off at boot, skip non-always-on off (fused-off) auto-managed domains
with -ENODEV, and register active ones as always-on without re-writing the
register after PMP may have started, refusing power-off and reset
operations and skipping them in suspend_noirq and resume_noirq so firmware
wake never rewrites AUTO_ENABLE while PMP is running.

Add KUnit tests for apple_pmgr_ps_auto_enable() and cover the inherited-on
conflict in pmgr-inherited.py.

Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
…states

Add t6041-pmgr.dtsi describing the 32 DCS channel power states (dcs_00-31,
with dcs_27 at pmgr_aux +0x530) and 12 fabric power states (fab0-7_soc,
fab_gw_0/1, fab_afr, nub_fabric) verified against the J616c ADT, and mark
them apple,auto-managed so the PMGR driver switches forced-on words to
AUTO_ENABLE early at boot before PMP starts.

On binned 24-channel parts (J616c), dcs_24-31 read fused off and are
skipped cleanly (36 active words switched); on full 32-channel parts
(J614c), all 44 words are switched. Drop the duplicate disabled
ps_fab5_soc node from t6041-j614-j616-j575-scaler.dtsi now that
t6041-pmgr.dtsi provides and enables it: it was originally added disabled
alongside the rest of the placeholder scaler power-domain providers in
commit 30f87ea ("arm64: dts: apple: describe both disabled M4 Max
scalers"), not because ps_fab5_soc was unsafe, and enabling it as
apple,always-on with apple,auto-managed switches the boot-active fabric to
AUTO_ENABLE before PMP starts and registers it read-only as always-on.

Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
@AxxzyWasTaken
AxxzyWasTaken force-pushed the pr/t6041-sleep-mem-auto branch from da4ddab to 9e68dcc Compare November 22, 2026 15:15
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.

3 participants