Repository navigation
drm/apple: gate T6020 DCP S2R layouts on apple,sleep-tested and drop s2r_untested - #4243
DjDeveloperr wants to merge 2 commits into
Conversation
…s2r_untested On main, appledrm.s2r_untested defaults to true, so T6020's internal DCP sleep layout (DPMS off stops firmware and powers down display domains) and external USB-C dcpext layout (s2r_ext and ext-idle on s2idle) are enabled by default on every T602x board running firmware 27.x, including boards without apple,sleep-tested (J416s, J474s, T6021, T6022). Remove the appledrm.s2r_untested module parameter and replace hw.s2r_untested with two declarative hw_data fields: - s2r_v27_only: restrict the static layout to firmware 27.x (used by T6020 and T8142, keeping T8142 J813/J815 behavior unchanged on 27.x and off on 26.x/H17P). - s2r_sleep_tested_compat: require an available sleep-controller node matching this compatible with apple,sleep-tested in the device tree (via apple_sleep_tested() in linux/soc/apple/sleep.h), matching sleep.c's per-board gate for SoCs with .untested = true. Set s2r_sleep_tested_compat = "apple,t6020-sleep" on apple_dcp_hw_t6020 and apple_dcp_hw_t6020_dcpext so J414s (which carries apple,sleep-tested) keeps the layouts on firmware 27.x while untested T602x boards keep internal DPMS backlight-only and external dcpext out of ext-idle. Add KUnit coverage in dcp_s2r_test.c verifying internal, external S2R, and ext-idle gating for tested vs untested T6020 boards, non-v27 firmware, and T8142. Signed-off-by: DjDeveloperr <hey@djdev.me>
dcp-s2r-primary-ext-tests.py copies dcp_s2r_ext_capable() out of dcp.c and builds it against a small prelude. That function now calls dcp_s2r_static_layout_allowed(), and the prelude still declared s2r_untested, so the host test no longer compiled. Copy dcp_s2r_sleep_tested() and dcp_s2r_static_layout_allowed() as well, give the prelude the new hw fields and an apple_sleep_tested() stub, and add a case for a T6020-style external DCP: no external S2R on a board without apple,sleep-tested, external S2R on one with it. A new drop-sleep-tested mutation removes the gate and must fail; run-host-tests.py runs it with the others. Signed-off-by: DjDeveloperr <hey@djdev.me>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Review, one round.
Verdict: the change is right. I pushed one fix (e6297d8) for a host test it broke. Merge after the J414s peer row and green CI.
What I checked
- J414s on firmware 27.x: no change.
t6020-j414s.dtsenables&sleepwithapple,sleep-tested, soapple_sleep_tested("apple,t6020-sleep")is true and both layouts stay on. One caveat: a J414s booted with a DTB from before #4228 (noapple,sleep-tested) now loses the layouts. Our kernels ship with their own DTBs, so this only matters if someone boots this kernel with an old DTB. - T8142 (J813/J815): no change. On main the gate was "firmware 27.0", because the parameter defaulted on.
s2r_v27_onlygives the same answer at probe and indcp_s2r_ext_capable(), and T8142 sets no sleep compat. The new KUnit case checks both T8142 tables. - Other firmware: no change. The static-layout gate still lets only 27.0 through. T6020 never reaches the H17P branch of
dcp_s2r_ext_capable(), because only the T8140 and T8142 tables and the T8122 dcpext report H17P. - Other SoCs: no change.
dcp_s2r_static_layout_allowed()returns true when neither new field is set, so the rewritten probe condition gives the same result for every table that doesn't set them. - Boards that lose the layouts: J416s and J474s, plus T6021/T6022, which have no
apple,t6020-sleepnode at all. They go back to what they had before #3999 landed today: DPMS turns off the backlight only, the dcpext doesn't enter ext-idle, and no S2R PM notifier is registered on the dcpext. None of these boards has run the layouts on hardware, so this is a fix, not a regression. - A pre-existing bug this hides (not for this PR): for T6021 dcpext2/3,
dcp_s2r_layout()falls back todcp_s2r_t6020_ext[0], which is dispext0's power words, becausehw.s2r_layoutis still set. Main turns that on for M2 Max on 27.x today. It has to be fixed before any T6021 board getsapple,sleep-tested. - Probe order: no issue. The helper reads the unflattened DT, which exists before any driver probes. It doesn't need the sleep driver to be bound, built in or loaded, and appledrm gets no symbol dependency on it.
- Org rules: the PR removes a runtime module parameter, which Ryan's rule asks for. The new field is per-SoC data in a per-SoC table, the same table that already holds T6020's power words. The per-board answer comes from the DT, the same way as sleep.c's
.untested. I don't see a smaller shape. A phandle from each DCP node to&sleepneeds a binding change and edits in t602x-die0/dieX for the same result. Asking the sleep driver adds probe ordering and a module dependency.
Fixed on the branch (e6297d8)
- host-tests went red at 46245a6 (6 jobs failed).
tools/asahi/dcp-s2r-primary-ext-tests.pycopiesdcp_s2r_ext_capable()out of dcp.c into a small C prelude. The prelude had neitherdcp_s2r_static_layout_allowed()nor the new fields, so it stopped compiling. The commit:- copies the two helpers as well and updates the prelude;
- adds a T6020-style dcpext case: off without
apple,sleep-tested, on with it; - adds a
drop-sleep-testedmutation and registers it in run-host-tests.py.
Small things, not blocking
- On T6020 dcpext,
dcp_s2r_ext_capable()now walks the whole DT on every call.dcp_ext_idle_capable()calls it from the HPD, audio and suspend paths. The cost is small and only on those events, but the answer can't change after boot, so latching it at probe would be tidier. apple_sleep_tested()isapple_t6050_sleep_property()with the compat as a parameter. The T6050 helper could call it.- The
apple,sleep-testeddescription in apple,t6020-sleep.yaml could add one line saying that the DCP sleep layouts follow it too.
Tested on pc
- W=1 build of
drivers/gpu/drm/apple/(clang, CONFIG_WERROR=y) over the warm DCP KUnit tree, with KUnit on and with it off: 0 warnings either way. - checkpatch --strict: both commits are clean.
- DCP host-test subset, 250 jobs in the ubuntu2404 container: all pass except 4
--refcontrol jobs that need git history. My source tree was agit archive, so they had none, and those jobs don't touch this code.--only dcp-s2r: 23/23, including the new mutation. - KUnit: CI's
KUnit dcp-fabric dcp-topology dcp-displayjob at e6297d8 passes, includingapple-dcp-s2r/dcp_s2r_t6020_gated_by_sleep_testedandapple-dcp-firmware/dcp_ext_idle_audio_dma_pin. I did not get a local UML run: pc's build slot stayed taken for the 40 minutes I allowed. - CI at e6297d8: apple-build, host-tests, KUnit, pr-text and readiness all pass. Main has moved 16 commits since a0e5cf1. The only overlap is one added line in the T8122 table in dcp.c, and the PR is still mergeable.
Rows before merge
- J414s 27.2 peer row, both arms:
- Head with the shipped DT: DPMS off/on, a USB-C display through ext-idle, s2idle and one deep sleep. Everything should behave as on main.
- Head with
apple,sleep-testedremoved from&sleep: DPMS turns off the backlight only, no "firmware stop enabled" line, the dcpext stays out of ext-idle, and there are no DCP errors.
- Second-gen row for the shared code: one DPMS cycle and one deep sleep at head on one of our own 27.2 Macs (J516s or J773g). Their tables don't set the new fields, so the result should match main.
- T8142 (J813/J815): the KUnit case covers its truth table, so a peer row is optional.
|
J516s (M3 Pro, T6030, OS firmware 27.2) second-gen module-only A/B hardware verification for Builds & boots
Results (1x DPMS off/on + 1x committed 20 s deep sleep per arm)
|
|
J414s peer kit for this head ( It is a no-regression row: the J414s has Please post the verdict and a tarball of |
What
Follow-up to
#3999removing theappledrm.s2r_untestedruntime module parameter and tying T6020's DCP S2R layouts to the board's per-boardapple,sleep-testedDT state, matching howsleep.cgatest6020_sleep_soc.untested.Confirmed on
main(a0e5cf151159):appledrm.s2r_untesteddefaulted totrue, enabling T6020 internal DCP firmware stop/domain drop on DPMS off and external USB-Cdcpexts2r_ext/ext-idle(including ons2idle) across all T602x boards on firmware 27.x even when&sleeplackedapple,sleep-tested(J416s, J474s, T6021, T6022).Changes:
apple_sleep_tested(const char *compat)toinclude/linux/soc/apple/sleep.h(sibling ofapple_t6050_sleep_property()/apple_sleep_smc_policy_described()).hw.s2r_untestedand theappledrm.s2r_untestedmodule parameter withhw.s2r_v27_only(T6020 + T8142) andhw.s2r_sleep_tested_compat = "apple,t6020-sleep"(T6020 internal + external DCP), checked viadcp_s2r_static_layout_allowed()at both internal DCP probe anddcp_s2r_ext_capable()(which also gatesdcp_ext_idle_capable()).dcp_s2r_t6020_gated_by_sleep_testedindrivers/gpu/drm/apple/dcp_s2r_test.ccovering untested T6020 (internal, external S2R, andext-idleall off), sleep-tested T6020 on fw 27.x (all on), non-v27 firmware (off), and T8142 (v27-only unchanged).Tested
scripts/checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks.make ARCH=arm64 LLVM=1 W=1 drivers/gpu/drm/apple/dcp.owithCONFIG_DRM_APPLE_DISPLAY_KUNIT_TEST=n: 0 warnings.make ARCH=arm64 LLVM=1 W=1 drivers/gpu/drm/apple/dcp.owithCONFIG_DRM_APPLE_DISPLAY_KUNIT_TEST=y(includesdcp_s2r_test.canddcp-firmware-test.c): 0 warnings.dcp-displayruns in GitHub Actions (apple-build-kunit.yml).s2idle+ DPMS PEER arm harness prepared offline (work/peer-j414s-dcp-s2r-gate-20261203,--check2/2 ok,judge.py selftest7/7).Risk
Two-way.
apple,sleep-tested;present on&sleepsince#4228) with firmware 27.x: behavior is unchanged (internal DCP firmware stop and externaldcpextS2R/ext-idle remain enabled).dcpextstays out ofext-idleuntil the board earnsapple,sleep-tested;.t8142_sleep_soc.untestedis alreadyfalse): behavior is unchanged on firmware 27.x and off on 26.x/H17P.appledrm.s2r_untestedkernel module parameter.Not yet
dcp-display) green and a J414s 27.2s2idle+ DPMS peer row (tested and untested-DT arms).