Repository navigation
pmdomain: apple-pmc: resolve display interfaces via consumer-switched power-domains - #3297
Conversation
… 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]>
… 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]>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
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.
|
Updated the PR body with the J713 (M4 Air, 27.2 firmware) full hardware S2R run at |
|
@erikwb: one finding is left from the App review at
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]>
|
Fixed at
Tested at |
There was a problem hiding this comment.
Verdict: MERGE at 2617735d5df6
Blockers: None (wait for queued CI to finish green).
Checked:
- Commits
be7d6bee74a0and2617735d5df6indrivers/pmdomain/apple/pmgr-pwrstate.c,pmgr-pwrstate-test.c, and.kunitconfig.pmgr-pwrstateresolving all prior2b1bab10blockers: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 sharedapple_pmgr_ps_consumer_policy()helper (-EINVALfor missingapple,firmware-owned, invalid retention workarounds, or badapple,bridge-link), and defers (-EPROBE_DEFER) whenever a consumer-switched hop's platform device is missing or not yetdevice_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 balancedof_node_put()cleanup acrosscur,next,hop_pmc,seen_pmc[], andseen[]on all exit paths.
- Verification at
2617735d5df6:apple-pmgr-pwrstateKUnit 30/30 pass (including newCONFIG_OF_DYNAMICtests covering unbound, disabled, invalid-policy, and non-consumer-parent hops with zero-write assertions),LLVM=1 W=1arm64 build clean,checkpatch.pl --strict0/0/0,MERGEABLEonmain.
Evidence
- Verified
apple_pmgr_ps_probe()andapple_pmgr_ps_consumer_hop()shareapple_pmgr_ps_consumer_policy()so hops that probe refuses fail immediately with-EINVALinstead of deferring forever. - Verified
pmc_nrcannot exceedAPPLE_PMGR_PS_MAX_CHAINbecausehop_pmcis only collected whenseen_nr > 1(at mostAPPLE_PMGR_PS_MAX_CHAINhops). - 21 CI checks at
2617735d5df6are queued at review time (0failures); approve now so merge can proceed once CI goes green.
|
code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at |
|
2617735 3-family peer PASS (J316s T6000 + J615 T8122 + J700 T8140): combined guarded one-shot |
|
2617735 J473 (M2 Mac mini, T8112) 4th-family peer PASS: combined guarded one-shot |
Signed-off-by: Ryan Murray <[email protected]>
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]>
|
@erikwb CI at |
There was a problem hiding this comment.
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.
Signed-off-by: Erik Bourget <[email protected]>
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
|
Verified head
Exact-head hardware row on J713 (M4 MacBook Air, T8132, 27.2 firmware) at One item remains for the merge gate: the exact-head hosted CI run. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
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.
What: Resolve display-pipe PMC BWR/boost interfaces through firmware-owned consumer-switched PMGR
power-domainschains and switch direct PMC interface parents at the exact PMGR hop inapple_pmgr_ps_consumer_{check,off,on}()(CPU -> FE -> PMC -> SYSon off;SYS -> PMC -> FE -> CPUon resume/unwind), keeping saved PMC state intact if a partial off-path rollback fails.Tested: At head
0378182e01b8(mergesmain27284bfe9110and006f20f150fehost-test stub):apple-pmgr-pwrstateKUnit30/30andapple-pmcKUnit18/18passed on arm64 QEMU,tools/asahi/run-host-tests.py --only pmgr3/3passed (68/69across the69-suite run with the14pre-existing unrelatedapple-dcpTAP failures),LLVM=1 W=1arm64 builds clean (drivers/pmdomain/apple/pmc.o,drivers/pmdomain/apple/pmgr-pwrstate.o,drivers/gpu/drm/apple/iomfb_m4.o), fulllinux-j713arm64 kernel/DTB/modules build clean (7.3.0+),checkpatch.pl --strict --git origin/main..HEAD0errors (0/0/0on all four driver commits;1From:/Signed-off-by:email mismatch warning on006f20f150fe),git diff --check origin/main...HEADclean, andgit merge-tree --write-tree origin/main HEADclean (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 from429e7e15f122with0378182e01b8and241b8646ccdf(plus five other open PR heads) merged cleanly, one-shot Stage 2 with that tree's devicetree: boots with0failed units and0AppArmor denials; 4 internal-panel DPMS off/on cycles (each off returnsdpmsStatusfalse, each on re-initialises the DCP firmware and returns true), a 20 ss2idlecycle (PM: suspend entry (s2idle)toPM: suspend exit,suspend_statsfail0), a 25 s deep suspend/resume (PM: suspend entry (deep)toPM: suspend exit, no reset,fail0) and 4 more DPMS cycles after resume, withisp,vencandavddomainsoff-0anddispext*/pmc-dispext*-interfacedomainsonafterwards. The external display processors did not probe in this build (-ENODEV, "no IOMMU domain";maindoes 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:2617735d5df64-family peer boot/s2idle/Vulkan smoke on J316s (T6000), J615 (T8122), J700 (T8140), and J473 (T8112) (PMGR_ERR=0, 0 AVC, 0 failed units);2b1bab104938combined hardware rows on J713 (37edba02c535), J313 (5509a254a6bd, unaffected), and J716c (3e4078f656d5, unaffected) and 20/20 green CI (prior to the0378182e01b8forward-merge ofmain).Risk: two-way door · T8132 external display pipes (
dcpext0/dcpext1) and any Apple SoC consumer usingapple_pmc_interface_consumer_*()orapple_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); directapple_pmgr_ps_consumer_{check,off,on}()hardware exercise on26.6.2firmware (iomfb_m4.cpath, e.g.30ae00000.dcpdirect-MMIO /26.6.2externaliomfb_m4; lab J713 runs27.2firmware); external non-lab Macs.Details
6473c695a907): Validates directapple,pmc-interfacestrictly as a single phandle (sizeof(__be32)) targeting a consumer-switched PMC interface under a matchingapple,pmcparent, and when absent walks the consumer's firmware-owned consumer-switched PMGRpower-domainschain withof_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.2b1bab104938):apple_pmc_interface_pmgr_{check,off,on}()fromapple-pmcand calls them fromapple_pmgr_ps_consumer_{check,off,on}()right between the PMGR domain referencing the PMC interface and its parent (CPU -> FE -> PMC -> SYSoff;SYS -> PMC -> FE -> CPUon/unwind).apple_pmgr_ps_consumer_chain()to scan fullpower-domainslists independently of entry order, rejecting cycles, over-deep chains, malformed entries, branching PMGR parents, and PMC interfaces repeated across hops before touching hardware.dom->consumer_off = truewith saved boost/BWR bits inapple_pmc_interface_consumer_set()if boost rollback fails after a failed BWR clear, ensuring callers verify restoration before resuming the pipe.CONFIG_APPLE_PMC=noptional fallback for PMGR hops without a configured PMC parent while propagating-EOPNOTSUPPfor configured or malformed hops.be7d6bee74a0,2617735d5df6): Decides consumer-switched PMGR chain hops from DT (of_match_node+apple,consumer-switched) prior to device resolution, returning-EPROBE_DEFERwhen a hop is unbound,-ENODEVwhen disabled, and-EINVALwhenapple_pmgr_ps_consumer_policy()fails (shared withapple_pmgr_ps_probe()), all before any register write, withCONFIG_OF_OVERLAYKUnit coverage.6a3390285723,006f20f150fe,0378182e01b8): Mergesmain(27284bfe9110, including PMC deep-sleep interface restore) and stubsapple_pmgr_ps_consumer_policy()intools/testing/selftests/drivers/apple/pmgr-inherited.py.Evidence
0378182e01b8, composite with#3300241b8646ccdf): J713 (M4 MacBook Air, T8132, 27.2 firmware, default command line) at the exact head: Linux 7.3.0 built from429e7e15f122with0378182e01b8and241b8646ccdf(plus five other open PR heads) merged cleanly, one-shot Stage 2 with that tree's devicetree: boots with0failed units and0AppArmor denials; 4 internal-panel DPMS off/on cycles (each off returnsdpmsStatusfalse, each on re-initialises the DCP firmware and returns true), a 20 ss2idlecycle (PM: suspend entry (s2idle)toPM: suspend exit,suspend_statsfail0), a 25 s deep suspend/resume (PM: suspend entry (deep)toPM: suspend exit, no reset,fail0) and 4 more DPMS cycles after resume, withisp,vencandavddomainsoff-0anddispext*/pmc-dispext*-interfacedomainsonafterwards. The external display processors did not probe in this build (-ENODEV, "no IOMMU domain";maindoes 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. Kernelerrlines: the 3 present on the default boot (AFK[ep:20],unsupported DFB layout 2560x1664,apple_sepnotice), 2 external-DCP-ENODEVlines, andapple-sleepdcp isn't boundx2 /302600000.gpu stop reported 1after the deep sleep (the last also appears on the default kernel's deep sleep);0WARN/BUG/Oops.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-pmcKUnit (CONFIG_APPLE_PMC=y,CONFIG_APPLE_PMC_KUNIT_TEST=y) on arm64 QEMU:Ran 18 tests: passed: 18(includingapple_pmc_test_interface_resume).python3 tools/asahi/run-host-tests.py --only pmgr:3/3passed (pmgr-ppt-tests,pmgr-bus-tests,apple/pmgr-inherited). Fullrun-host-tests.py:68/69passed (apple-dcphad14/99pre-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:0errors,0new warnings (only pre-existing kernel-doc warnings onapple_pmc_domain).linux-j713arm64 kernel + DTBs + modules build:exit 0(7.3.0+).scripts/checkpatch.pl --strict --git origin/main..HEAD:0errors,0warnings,0checks on6473c695a907,2b1bab104938,be7d6bee74a0,2617735d5df6;0errors,1From:/Signed-off-by:email mismatch warning on006f20f150fe.git merge-tree --write-tree origin/main HEAD: clean (2e14fd6acb8b87114adbc576a6f42cdde059c9d4);git diff --check origin/main...HEADclean.0378182e01b8:46540206*/46540207*runs were cancelled after ~3h28m with0failures and need a re-run.2617735d5df6peer rows (prior to0378182e01b8forward-merge):7.3.0-aurora-peer1+onmain498d53fd(clean merge of2617735d5df6, default cmdline, saved Stage 2 unchanged): J316s (T6000), J615 (T8122), J700 (T8140), and J473 (T8112,PMGR_ERR=0, external displays) passed boot,s2idle1/1, and Vulkanapi.smoke8/8with0apple-pmgr/apple-pmcprobe or suspend errors, Enforcing,0AVC,0failed units.2b1bab104938combined hardware rows (prior tobe7d6bee74a0and0378182e01b8):27.2firmware, default cmdline +panic=10) in candidate37edba02c535(j713-dcpext/air-dcpext-272fd3dc16c121b+#32737f21093a0d31+#32972b1bab104938+#33004b09f0691c2d): clean boot (0failed units,0AppArmor denials, same 3errlines as default), 3+3eDP-1DPMS off/on cycles before and after deep sleep, 20 ss2idlePASS (PM: suspend exit), and full hardwaredeepsleep resume PASS (no reset; allisp,venc, andavd_sysdomainsoff-0,dispext*anddisp_*on).27.2firmware, default cmdline,j713-dcpext/air-dcpext-2727a8022a6d24d+#32972b1bab104938+#33006a84c1d95460+#3307eab8b5157340+#330805d728d91d68): both286e00000.dcpand48ae00000.dcpresolvedpmc-dispext0-interface/pmc-dispext1-interfacethroughdispext{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 acrosspm_test=devicesdeep suspend/resume in 1 ms, completed refused-sleep power-cycle recovery, and re-gated both pipes 5 s after resume with0errors/warnings and0failed systemd units.3840x2160@120external display ondcpext, default cmdline, default Stage 21.0.0b17-gf5ddfff2) in fleet candidate5509a254a6bd(mainfcb124279183+ unchanged#3220,#3221,#32972b1bab104938,#33004b09f0691c2d,#3329,#3332,#3333,#3274): boots cleanly, 3 DPMS off/on cycles ofeDP-1and external output, 2 deep sleeps ands2idleunaffected,0failed units,0AppArmor denials (unaffected row; T8103 display pipes use no PMC interface; one earlier full run hung ins2idleand did not reproduce on later runs or without#3329/#3332).3e4078f656d5(mainfcb124279183+ unchanged2b1bab104938and sibling PRs): boots cleanly to SDDM/Hyprland (eDP-13456x2234@120), Borealis GPU (7,940/7,940dEQP-VK.ssbo.*Pass,0GPU faults),2xDPMS off/on cycles, PMP/cpufreq/ANE/net up,0new failed units,0LSM denials,0new kernel errors — unaffected.