Skip to content

pmdomain: apple-pmc: resolve display interfaces via consumer-switched power-domains - #3297

Merged
DjDeveloperr merged 7 commits into
mainfrom
feat/apple-pmc-consumer-interface-chain
Dec 1, 2026
Merged

DjDeveloperr merged 7 commits into
mainfrom
feat/apple-pmc-consumer-interface-chain

Conversation

@erikwb

@erikwb erikwb commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

What: Resolve display-pipe PMC BWR/boost interfaces through firmware-owned consumer-switched PMGR power-domains chains and switch direct PMC interface parents at the exact PMGR hop in apple_pmgr_ps_consumer_{check,off,on}() (CPU -> FE -> PMC -> SYS on off; SYS -> PMC -> FE -> CPU on resume/unwind), keeping saved PMC state intact if a partial off-path rollback fails.
Tested: At head 0378182e01b8 (merges main 27284bfe9110 and 006f20f150fe host-test stub): apple-pmgr-pwrstate KUnit 30/30 and apple-pmc KUnit 18/18 passed on arm64 QEMU, tools/asahi/run-host-tests.py --only pmgr 3/3 passed (68/69 across the 69-suite run with the 14 pre-existing unrelated apple-dcp TAP failures), LLVM=1 W=1 arm64 builds clean (drivers/pmdomain/apple/pmc.o, drivers/pmdomain/apple/pmgr-pwrstate.o, drivers/gpu/drm/apple/iomfb_m4.o), full linux-j713 arm64 kernel/DTB/modules build clean (7.3.0+), checkpatch.pl --strict --git origin/main..HEAD 0 errors (0/0/0 on all four driver commits; 1 From:/Signed-off-by: email mismatch warning on 006f20f150fe), git diff --check origin/main...HEAD clean, and git merge-tree --write-tree origin/main HEAD clean (2e14fd6acb8b). J713 exact-head row: J713 (M4 MacBook Air, T8132, 27.2 firmware, default command line) at the exact head: Linux 7.3.0 built from 429e7e15f122 with 0378182e01b8 and 241b8646ccdf (plus five other open PR heads) merged cleanly, one-shot Stage 2 with that tree's devicetree: boots with 0 failed units and 0 AppArmor denials; 4 internal-panel DPMS off/on cycles (each off returns dpmsStatus false, each on re-initialises the DCP firmware and returns true), a 20 s s2idle cycle (PM: suspend entry (s2idle) to PM: suspend exit, suspend_stats fail 0), a 25 s deep suspend/resume (PM: suspend entry (deep) to PM: suspend exit, no reset, fail 0) and 4 more DPMS cycles after resume, with isp, venc and avd domains off-0 and dispext* / pmc-dispext*-interface domains on afterwards. The external display processors did not probe in this build (-ENODEV, "no IOMMU domain"; main does not carry the dock-display stack, and that stack conflicts with these two PRs), so the external-pipe consumer chain (dispext{0,1}_cpu -> _fe -> pmc-dispext{0,1}-interface) and the failure paths (power-on rollback, display DART drain unwind, s2r_start_stuck) were not exercised on hardware; those are covered by KUnit only. Earlier ancestor runs: 2617735d5df6 4-family peer boot/s2idle/Vulkan smoke on J316s (T6000), J615 (T8122), J700 (T8140), and J473 (T8112) (PMGR_ERR=0, 0 AVC, 0 failed units); 2b1bab104938 combined hardware rows on J713 (37edba02c535), J313 (5509a254a6bd, unaffected), and J716c (3e4078f656d5, unaffected) and 20/20 green CI (prior to the 0378182e01b8 forward-merge of main).
Risk: two-way door · T8132 external display pipes (dcpext0/dcpext1) and any Apple SoC consumer using apple_pmc_interface_consumer_*() or apple_pmgr_ps_consumer_*().
Not yet: the external display pipes' (dcpext0/dcpext1) consumer chain on J713 exact-head hardware (needs a tree carrying the dock-display stack, which conflicts with this PR and #3300); direct apple_pmgr_ps_consumer_{check,off,on}() hardware exercise on 26.6.2 firmware (iomfb_m4.c path, e.g. 30ae00000.dcp direct-MMIO / 26.6.2 external iomfb_m4; lab J713 runs 27.2 firmware); external non-lab Macs.

Details
  • Commit 1 (6473c695a907): Validates direct apple,pmc-interface strictly as a single phandle (sizeof(__be32)) targeting a consumer-switched PMC interface under a matching apple,pmc parent, and when absent walks the consumer's firmware-owned consumer-switched PMGR power-domains chain with of_for_each_phandle(..., "#power-domain-cells", -1), cell-aligned length checks, cycle/depth detection (-ELOOP), ambiguity/malformed rejection (-EINVAL), and unavailable provider reporting (-EPROBE_DEFER), while holding the PMC platform-device reference across each operation.
  • Commit 2 (2b1bab104938):
    • Exports direct-hop helpers apple_pmc_interface_pmgr_{check,off,on}() from apple-pmc and calls them from apple_pmgr_ps_consumer_{check,off,on}() right between the PMGR domain referencing the PMC interface and its parent (CPU -> FE -> PMC -> SYS off; SYS -> PMC -> FE -> CPU on/unwind).
    • Updates apple_pmgr_ps_consumer_chain() to scan full power-domains lists independently of entry order, rejecting cycles, over-deep chains, malformed entries, branching PMGR parents, and PMC interfaces repeated across hops before touching hardware.
    • Preserves dom->consumer_off = true with saved boost/BWR bits in apple_pmc_interface_consumer_set() if boost rollback fails after a failed BWR clear, ensuring callers verify restoration before resuming the pipe.
    • Preserves the CONFIG_APPLE_PMC=n optional fallback for PMGR hops without a configured PMC parent while propagating -EOPNOTSUPP for configured or malformed hops.
  • Commits 3–4 (be7d6bee74a0, 2617735d5df6): Decides consumer-switched PMGR chain hops from DT (of_match_node + apple,consumer-switched) prior to device resolution, returning -EPROBE_DEFER when a hop is unbound, -ENODEV when disabled, and -EINVAL when apple_pmgr_ps_consumer_policy() fails (shared with apple_pmgr_ps_probe()), all before any register write, with CONFIG_OF_OVERLAY KUnit coverage.
  • Forward-merges (6a3390285723, 006f20f150fe, 0378182e01b8): Merges main (27284bfe9110, including PMC deep-sleep interface restore) and stubs apple_pmgr_ps_consumer_policy() in tools/testing/selftests/drivers/apple/pmgr-inherited.py.
Evidence
  • Exact-head J713 row (0378182e01b8, composite with #3300 241b8646ccdf): J713 (M4 MacBook Air, T8132, 27.2 firmware, default command line) at the exact head: Linux 7.3.0 built from 429e7e15f122 with 0378182e01b8 and 241b8646ccdf (plus five other open PR heads) merged cleanly, one-shot Stage 2 with that tree's devicetree: boots with 0 failed units and 0 AppArmor denials; 4 internal-panel DPMS off/on cycles (each off returns dpmsStatus false, each on re-initialises the DCP firmware and returns true), a 20 s s2idle cycle (PM: suspend entry (s2idle) to PM: suspend exit, suspend_stats fail 0), a 25 s deep suspend/resume (PM: suspend entry (deep) to PM: suspend exit, no reset, fail 0) and 4 more DPMS cycles after resume, with isp, venc and avd domains off-0 and dispext* / pmc-dispext*-interface domains on afterwards. The external display processors did not probe in this build (-ENODEV, "no IOMMU domain"; main does not carry the dock-display stack, and that stack conflicts with these two PRs), so the external-pipe consumer chain (dispext{0,1}_cpu -> _fe -> pmc-dispext{0,1}-interface) and the failure paths (power-on rollback, display DART drain unwind, s2r_start_stuck) were not exercised on hardware; those are covered by KUnit only. Kernel err lines: the 3 present on the default boot (AFK[ep:20], unsupported DFB layout 2560x1664, apple_sep notice), 2 external-DCP -ENODEV lines, and apple-sleep dcp isn't bound x2 / 302600000.gpu stop reported 1 after the deep sleep (the last also appears on the default kernel's deep sleep); 0 WARN / BUG / Oops.
  • Local checks at head 0378182e01b8:
    • ./tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/pmdomain/apple/.kunitconfig.pmgr-pwrstate: Ran 30 tests: passed: 30.
    • apple-pmc KUnit (CONFIG_APPLE_PMC=y, CONFIG_APPLE_PMC_KUNIT_TEST=y) on arm64 QEMU: Ran 18 tests: passed: 18 (including apple_pmc_test_interface_resume).
    • python3 tools/asahi/run-host-tests.py --only pmgr: 3/3 passed (pmgr-ppt-tests, pmgr-bus-tests, apple/pmgr-inherited). Full run-host-tests.py: 68/69 passed (apple-dcp had 14/99 pre-existing unrelated TAP failures).
    • make ARCH=arm64 LLVM=1 W=1 drivers/pmdomain/apple/pmc.o drivers/pmdomain/apple/pmgr-pwrstate.o drivers/gpu/drm/apple/iomfb_m4.o: 0 errors, 0 new warnings (only pre-existing kernel-doc warnings on apple_pmc_domain).
    • Full linux-j713 arm64 kernel + DTBs + modules build: exit 0 (7.3.0+).
    • scripts/checkpatch.pl --strict --git origin/main..HEAD: 0 errors, 0 warnings, 0 checks on 6473c695a907, 2b1bab104938, be7d6bee74a0, 2617735d5df6; 0 errors, 1 From:/Signed-off-by: email mismatch warning on 006f20f150fe.
    • git merge-tree --write-tree origin/main HEAD: clean (2e14fd6acb8b87114adbc576a6f42cdde059c9d4); git diff --check origin/main...HEAD clean.
    • Hosted CI at 0378182e01b8: 46540206* / 46540207* runs were cancelled after ~3h28m with 0 failures and need a re-run.
  • Ancestor 2617735d5df6 peer rows (prior to 0378182e01b8 forward-merge):
    • 4-family peer PASS in combined one-shot 7.3.0-aurora-peer1+ on main 498d53fd (clean merge of 2617735d5df6, default cmdline, saved Stage 2 unchanged): J316s (T6000), J615 (T8122), J700 (T8140), and J473 (T8112, PMGR_ERR=0, external displays) passed boot, s2idle 1/1, and Vulkan api.smoke 8/8 with 0 apple-pmgr/apple-pmc probe or suspend errors, Enforcing, 0 AVC, 0 failed units.
  • Earlier 2b1bab104938 combined hardware rows (prior to be7d6bee74a0 and 0378182e01b8):
    • J713 (M4 MacBook Air, 27.2 firmware, default cmdline + panic=10) in candidate 37edba02c535 (j713-dcpext/air-dcpext-272 fd3dc16c121b + #3273 7f21093a0d31 + #3297 2b1bab104938 + #3300 4b09f0691c2d): clean boot (0 failed units, 0 AppArmor denials, same 3 err lines as default), 3+3 eDP-1 DPMS off/on cycles before and after deep sleep, 20 s s2idle PASS (PM: suspend exit), and full hardware deep sleep resume PASS (no reset; all isp, venc, and avd_sys domains off-0, dispext* and disp_* on).
    • J713 (M4 MacBook Air, 27.2 firmware, default cmdline, j713-dcpext/air-dcpext-272 7a8022a6d24d + #3297 2b1bab104938 + #3300 6a84c1d95460 + #3307 eab8b5157340 + #3308 05d728d91d68): both 286e00000.dcp and 48ae00000.dcp resolved pmc-dispext0-interface / pmc-dispext1-interface through dispext{0,1}_cpu -> dispext{0,1}_fe -> pmc-dispext{0,1}-interface, powered domains off in 1 ms (display domains off: CPU 0xf000300 FE 0x2300 SYS 0x2100), woke across pm_test=devices deep suspend/resume in 1 ms, completed refused-sleep power-cycle recovery, and re-gated both pipes 5 s after resume with 0 errors/warnings and 0 failed systemd units.
    • J313 (M1 Air, T8103, docked with Thunderbolt 5 dock and 3840x2160@120 external display on dcpext, default cmdline, default Stage 2 1.0.0b17-gf5ddfff2) in fleet candidate 5509a254a6bd (main fcb124279183 + unchanged #3220, #3221, #3297 2b1bab104938, #3300 4b09f0691c2d, #3329, #3332, #3333, #3274): boots cleanly, 3 DPMS off/on cycles of eDP-1 and external output, 2 deep sleeps and s2idle unaffected, 0 failed units, 0 AppArmor denials (unaffected row; T8103 display pipes use no PMC interface; one earlier full run hung in s2idle and did not reproduce on later runs or without #3329/#3332).
    • J716c (M5 Max, T6050, default cmdline, no external display attached) in candidate 3e4078f656d5 (main fcb124279183 + unchanged 2b1bab104938 and sibling PRs): boots cleanly to SDDM/Hyprland (eDP-1 3456x2234@120), Borealis GPU (7,940/7,940 dEQP-VK.ssbo.* Pass, 0 GPU faults), 2x DPMS off/on cycles, PMP/cpufreq/ANE/net up, 0 new failed units, 0 LSM denials, 0 new kernel errors — unaffected.

… power-domains

External display processors on T8132 do not carry an apple,pmc-interface
property directly; instead their PMC BWR and boost interface domain is a
parent of their firmware-owned, consumer-switched PMGR front-end power
domain (ps_dispextN_cpu -> ps_dispextN_fe -> pmc_dispextN).

Validate apple,pmc-interface strictly as a single phandle to a
consumer-switched PMC interface node, and when absent walk the complete
firmware-owned consumer-switched PMGR power-domains chain with
of_for_each_phandle(..., -1) (requiring provider #power-domain-cells and
cell-aligned property lengths). Reject cycles and over-deep chains with
-ELOOP, malformed or ambiguous topology with -EINVAL, and unavailable
configured PMC providers with -EPROBE_DEFER (keeping -ENODEV strictly for
pipes with no configured interface), while holding the PMC platform device
reference across each consumer check/off/on operation.

Because firmware-owned PMGR domains are registered always-on in genpd,
their parent PMC interface stays pinned on in genpd and does not race with
consumer-driven clear/restore transitions.

Signed-off-by: Erik Bourget <[email protected]>
@erikwb
erikwb requested review from a team as code owners November 26, 2026 18:41
@erikwb
erikwb requested review from Acelogic and malik-na November 26, 2026 18:41
… chain order

On T8132 external display pipes, the PMC BWR/boost interface domain sits
between the SYS and FE PMGR states (ps_dispextN_fe lists both
ps_dispextN_sys and pmc_dispextN in power-domains). Switching the PMC
interface outside apple_pmgr_ps_consumer_{off,on}() violates that ordering
by clearing PMC before FE/CPU go down or restoring PMC after FE/CPU come
back up.

Update apple_pmgr_ps_consumer_chain() to scan the full power-domains list
with of_for_each_phandle(..., "#power-domain-cells", -1) and strict
cell-alignment, cycle, depth, and ambiguity checks so parent resolution
does not depend on power-domains entry order and malformed or branching
chains fail before touching hardware.

Export direct-hop helpers apple_pmc_interface_pmgr_{check,off,on}() from
apple-pmc and call them from apple_pmgr_ps_consumer_{check,off,on}() at
the exact PMGR hop that references the interface:
- off: CPU -> FE -> PMC -> SYS
- on / unwind: SYS -> PMC -> FE -> CPU (skipping -EALREADY domains that
  stayed on during a partial-off rollback)

Pipes whose PMC interface is attached directly to the consumer node via
apple,pmc-interface (such as the internal T8132 display) have no direct
PMC parent on their PMGR nodes and are unaffected. When CONFIG_APPLE_PMC
is disabled, hops without a configured direct PMC interface keep working
while configured or malformed hops propagate -EOPNOTSUPP.

Signed-off-by: Erik Bourget <[email protected]>
@github-actions github-actions Bot added area:power Area from CODEOWNERS (bot) blast:m4 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 Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Merge readiness at 0378182e: ready to merge

Check Detail
CI at head ok 10 checks passed
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok in the PR body at 0378182e
Conflicts ok none
PR text ok Risk: two-way · T8132 external display pipes (dcpext0/dcpext1) and any Apple SoC consumer using applepmcinterfaceconsumer() or applepmgrpsconsumer().

Areas: area:power
Merge: gh pr merge 3297 --merge (Owners and Core through the bypass: add --admin).

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

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: Changes requested at 2b1bab104938.

Blocker: apple_pmgr_ps_consumer_chain() identifies a PMGR parent only after finding a bound platform device and its driver data. If the DT specifies a consumer-switched PMGR parent whose device is not yet bound, the walk can return the already-collected child prefix. consumer_off() then powers those children off and reports success without reaching or checking the missing parent. Detect qualifying PMGR nodes from their DT properties before resolving the provider and return -EPROBE_DEFER when a configured hop is unavailable, as the PMC lookup already does for a configured interface.

Please cover a bound child with an unavailable PMGR parent and verify that the operation performs no writes. The reported 27.2 combined pm_test=devices row does not exercise the direct 26.6.2 off/on path or full suspend and wake.

@erikwb

erikwb commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Updated the PR body with the J713 (M4 Air, 27.2 firmware) full hardware S2R run at 2b1bab104938 in candidate 37edba02c535 (j713-dcpext/air-dcpext-272 fd3dc16c121b + #3273 7f21093a0d31 + #3297 2b1bab104938 + #3300 4b09f0691c2d, default cmdline + panic=10): clean boot (0 failed units, 0 AppArmor denials, same 3 err lines as default), 3+3 eDP-1 DPMS off/on cycles before and after sleep, 20 s s2idle PASS, and full deep sleep resume PASS (no reset).

@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Nov 27, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

@erikwb: one finding is left from the App review at 2b1bab10, and once it is fixed this goes to the merge train, with #3300 after it. This is the full list:

  1. In apple_pmgr_ps_consumer_chain() (drivers/pmdomain/apple/pmgr-pwrstate.c), a power-domains hop whose PMGR device is not bound yet (!ps) is treated as "not consumer-switched", so the chain stops at the child prefix. consumer_off() then switches those children off and returns 0 without ever reaching the parent. Decide whether a hop is consumer-switched from the DT, before resolving the device: match the node against the driver match table and check apple,consumer-switched. If such a hop has no bound driver data, return -EPROBE_DEFER, the same as the PMC interface lookup does.
  2. Add a test for a bound child with an unbound consumer-switched parent: check/off/on return -EPROBE_DEFER and write no registers.
  3. The 26.6.2 direct iomfb_m4 path has no row: list it under Not yet, and we track it as a known gap. No lab Mac runs 26.6.2.

The rows you already have (J713 27.2 and J313) stay valid after this fix. If we hear nothing in 24 h, we push the fix ourselves.

… hop

apple_pmgr_ps_consumer_chain() took a power-domains hop into the chain
only once its PMGR device was bound with driver data. A consumer-switched
parent that had not bound yet looked like the end of the chain, so
apple_pmgr_ps_consumer_off() switched the children it had collected off
and returned 0 without ever reaching the parent.

Decide from the DT which hops belong to the chain: a node that matches
this driver and carries apple,consumer-switched. Resolve each such hop
before anything is switched and return -EPROBE_DEFER while it is not
bound yet, as the PMC interface lookup does for a configured interface.
A hop that is disabled, or whose PMGR is, never binds: return -ENODEV
for it instead of deferring. A hop without apple,firmware-owned is a
policy probe refuses: -EINVAL. The check, off and on callers return the
error before any register write. The internal display then stays
logically off, and an external display pipe refuses the deep sleep with
-EBUSY, nothing changed.

Add KUnit cases on a test tree with a bound child: an unbound
consumer-switched parent makes check, off and on return -EPROBE_DEFER,
a disabled one -ENODEV, both with no register write; a parent that is
not consumer-switched still leaves a one-hop chain that switches.

Signed-off-by: Erik Bourget <[email protected]>
The consumer chain lookup checked only apple,firmware-owned on a
consumer-switched hop before looking for its device. A hop whose
retention workaround probe refuses (a value outside its mask, a count
that is not whole triples or too many of them) or whose bridge link is
bad never binds, so the lookup deferred on every call.

Move the consumer-switched policy probe checks into one helper and use
it in both probe and the chain lookup: such a hop now returns -EINVAL,
before any register write.

In the KUnit fixture, give the child's device its node through
platform_device_set_of_node(), drop the reference each
of_changeset_create_node() returns, and register the changesets'
release before any assertion can end the setup. Add a case for a
parent with a retention workaround probe refuses: check, off and on
return -EINVAL with no register write.

Signed-off-by: Erik Bourget <[email protected]>
@erikwb

erikwb commented Nov 29, 2026

Copy link
Copy Markdown
Contributor Author

Fixed at 2617735d5df6 (two new commits on top of 2b1bab104938, no rebase).

  1. apple_pmgr_ps_consumer_chain() now decides from the DT which power-domains hops belong to the chain: a node that matches the driver's match table and has apple,consumer-switched. Each such hop is resolved before anything is switched. While its device has not finished binding (!ps, or bound but not yet device_is_bound()), check/off/on return -EPROBE_DEFER, as the PMC interface lookup does. Hops that can never bind don't defer. A disabled hop, or one under a disabled PMGR, returns -ENODEV. A hop whose consumer-switched policy probe refuses returns -EINVAL: missing apple,firmware-owned, a bad retention workaround or a bad bridge link. Probe and the lookup now share the same policy check. Two consumer-switched parents on one hop are still -EINVAL, checked before the lookup. Every error comes back before the first register write. The internal display then stays logically off, and an external pipe refuses the deep sleep with -EBUSY and nothing changed.
  2. New KUnit cases build a test tree with the child bound to the driver. An unbound consumer-switched parent gives -EPROBE_DEFER from check/off/on, with zero register writes and the child's state word unchanged. A disabled parent gives -ENODEV and an invalid retention workaround gives -EINVAL, both with zero writes. A parent that is not consumer-switched still gives a one-hop chain that switches off and back on. The deferral and disabled cases fail on 2b1bab104938, and the invalid case fails on the first fix commit (be7d6bee74a0). All of them pass at 2617735d5df6. .kunitconfig.pmgr-pwrstate now enables CONFIG_OF_OVERLAY for the test tree.
  3. The 26.6.2 direct iomfb_m4 path is under Not yet as a known gap.

Tested at 2617735d5df6: apple-pmgr-pwrstate KUnit on arm64 QEMU, 30/30 pass. LLVM=1 W=1 arm64 builds of pmgr-pwrstate.o (driver and KUnit configs), pmc.o and iomfb_m4.o add no new warnings. drivers/pmdomain/apple/ and drivers/gpu/drm/apple/ build clean. checkpatch.pl --strict 0/0/0, git diff --check clean, and it merges cleanly with main. No new hardware row: with every hop bound, the walk returns the same chain as before.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: MERGE at 2617735d5df6

Blockers: None (wait for queued CI to finish green).

Checked:

  • Commits be7d6bee74a0 and 2617735d5df6 in drivers/pmdomain/apple/pmgr-pwrstate.c, pmgr-pwrstate-test.c, and .kunitconfig.pmgr-pwrstate resolving all prior 2b1bab10 blockers:
    • apple_pmgr_ps_is_consumer_node() determines consumer-switched chain hops from DT (of_match_node + apple,consumer-switched) prior to device resolution.
    • apple_pmgr_ps_consumer_hop() checks node/parent availability (-ENODEV), runs the shared apple_pmgr_ps_consumer_policy() helper (-EINVAL for missing apple,firmware-owned, invalid retention workarounds, or bad apple,bridge-link), and defers (-EPROBE_DEFER) whenever a consumer-switched hop's platform device is missing or not yet device_is_bound() — ensuring zero register writes on any incomplete or invalid chain.
    • apple_pmgr_ps_consumer_chain() enforces cycle detection (-ELOOP), chain length cap (APPLE_PMGR_PS_MAX_CHAIN), single consumer-switched parent per hop (-EINVAL), unique PMC interface per hop/chain (-EINVAL), and balanced of_node_put() cleanup across cur, next, hop_pmc, seen_pmc[], and seen[] on all exit paths.
  • Verification at 2617735d5df6: apple-pmgr-pwrstate KUnit 30/30 pass (including new CONFIG_OF_DYNAMIC tests covering unbound, disabled, invalid-policy, and non-consumer-parent hops with zero-write assertions), LLVM=1 W=1 arm64 build clean, checkpatch.pl --strict 0/0/0, MERGEABLE on main.
Evidence
  • Verified apple_pmgr_ps_probe() and apple_pmgr_ps_consumer_hop() share apple_pmgr_ps_consumer_policy() so hops that probe refuses fail immediately with -EINVAL instead of deferring forever.
  • Verified pmc_nr cannot exceed APPLE_PMGR_PS_MAX_CHAIN because hop_pmc is only collected when seen_nr > 1 (at most APPLE_PMGR_PS_MAX_CHAIN hops).
  • 21 CI checks at 2617735d5df6 are queued at review time (0 failures); approve now so merge can proceed once CI goes green.

@RyanTheTide

Copy link
Copy Markdown
Contributor

code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at 2617735d. App approved (NEON-PR-REVIEW2), KUnit 30/30. The only hardware row ran inside a combined candidate kernel, not this head, and the pmgr consumer-chain change is shared. I need an exact-head row on the J713 (DCP/dcpext power-up as today) plus one other family that boots through the same chain (J616s or J413), with 0 new probe errors. Merges under the 6-point rule after that, unless you object.

@RyanTheTide

Copy link
Copy Markdown
Contributor

2617735 3-family peer PASS (J316s T6000 + J615 T8122 + J700 T8140): combined guarded one-shot 7.3.0-aurora-peer1+ on main 498d53fd (clean merge of 2617735d5df6, default cmdline, saved Stage 2 unchanged); boot + s2idle 1/1 + Vulkan api.smoke 8/8 ok on all 3 families with 0 apple-pmgr/apple-pmc probe or suspend errors, Enforcing, 0 AVC, 0 failed units; restored saved 7.3.0-aurora-edge on all 3 Macs. (J713 T8132 target row pending its active Mesa slot.)

@RyanTheTide

Copy link
Copy Markdown
Contributor

2617735 J473 (M2 Mac mini, T8112) 4th-family peer PASS: combined guarded one-shot 7.3.0-aurora-peer1+ on main 498d53fd (clean merge of 2617735d5df6, default cmdline, saved Stage 2 unchanged); PMGR_ERR=0, s2idle 1/1 (rtc1), external displays + VK api.smoke 8/8 ok, Enforcing, 0 AVC, 0 failed units; restored saved 7.3.0-aurora-m2combo30.

After the merge of main, apple_pmgr_ps_probe() calls
apple_pmgr_ps_consumer_policy(), which the host harness neither extracts
nor stubs, so the harness no longer compiles. Its nodes carry no
consumer-switched policy, so a stub that reports no retention words and
no bridge link keeps every case unchanged.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor

@erikwb CI at 2617735d was red from main-side breakage, so I merged main in (6a339028, no conflicts). On the merged tree, main's reworked pmgr-inherited host harness (#2317) didn't compile: apple_pmgr_ps_probe() now calls your apple_pmgr_ps_consumer_policy(), which the harness neither extracts nor stubs. 006f20f1 adds a stub that reports no retention words and no bridge, which matches the harness's nodes, so every case is unchanged. run-host-tests.py --only pmgr passes 3/3. Driver code is unchanged from 2617735d, so the four-family peer rows still apply. It merges once CI is green and the review app has re-reviewed. #3300 can retarget after. @DjDeveloperr code-owner notice: I'll merge under the 6-point rule no earlier than 1 h from now.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: HOLD at 006f20f1 for hosted CI and the outstanding J713 target row.

Checked: The host stub matches the fixture’s no-retention, no-bridge nodes. The previously reviewed consumer-chain logic and PMC implementation are intact. The forward merge also inherits a change in apple_pmgr_ps_probe(): when the platform handoff is enabled, T8132 nodes without explicit status now fail probe on more firmware paths. The four peer boots remain useful. Exercise external DCP/PMC bring-up on J713 on the current integration tree and check for missing-policy probe errors as well as DPMS and suspend.

@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) ci-failing A check failed at the PR head (bot) and removed ci-failing A check failed at the PR head (bot) labels Nov 30, 2026

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The forward merge keeps the PMGR consumer-chain implementation and the host-stub fix. Current hosted checks are pending. The existing hardware results cover the shared chain checks. The outstanding targeted evidence is the consumer off/on path on supported firmware, with no broader board matrix requested.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: MERGE at 0378182e01b8

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: Code reviewed in the earlier App review at this head (6122660591).

Follow-ups (not blocking): hosted checks; consumer off/on row on supported firmware

@erikwb

erikwb commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Verified head 0378182e01b8 locally after the main forward-merge (27284bfe9110) and host-test stub (006f20f150fe):

  • apple-pmgr-pwrstate KUnit: 30/30 passed on arm64 QEMU (drivers/pmdomain/apple/.kunitconfig.pmgr-pwrstate); apple-pmc KUnit: 18/18 passed on arm64 QEMU (CONFIG_APPLE_PMC_KUNIT_TEST=y).
  • Host tests (tools/asahi/run-host-tests.py --only pmgr): 3/3 passed (pmgr-ppt-tests, pmgr-bus-tests, apple/pmgr-inherited); full run-host-tests.py passed 68/69 (apple-dcp has 14/99 pre-existing unrelated TAP failures).
  • LLVM=1 W=1 arm64 build (drivers/pmdomain/apple/pmc.o, drivers/pmdomain/apple/pmgr-pwrstate.o, drivers/gpu/drm/apple/iomfb_m4.o): 0 errors, 0 new warnings; full linux-j713 arm64 kernel + DTBs + modules build clean (7.3.0+).
  • git merge-tree --write-tree origin/main HEAD: clean (2e14fd6acb8b).

Exact-head hardware row on J713 (M4 MacBook Air, T8132, 27.2 firmware) at 0378182e01b8, built together with #3300 241b8646ccdf on main 429e7e15f122, default command line: boots clean (0 failed units, 0 AppArmor denials), 4 + 4 internal-panel DPMS off/on cycles before and after a 20 s s2idle and a 25 s deep suspend/resume (both suspend_stats fail 0, no reset). The external display processors did not probe in that build (main lacks the dock-display stack, which conflicts with these PRs), so the external-pipe consumer chain was not exercised on hardware.

One item remains for the merge gate: the exact-head hosted CI run.

@github-actions github-actions Bot removed needs-hw-row No hardware row at the PR head (bot) ci-failing A check failed at the PR head (bot) labels Dec 1, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed the DT chain lookup, provider deferral, PMC ordering, and saved state on off failure. The J713 smoke did not bind the external display pipes. Merge still needs a live consumer-chain row and a hosted build and KUnit run on the landing candidate.

@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 1, 2026
@DjDeveloperr
DjDeveloperr merged commit 645b086 into main Dec 1, 2026
14 of 36 checks passed
@DjDeveloperr
DjDeveloperr deleted the feat/apple-pmc-consumer-interface-chain branch December 1, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:power Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants