Skip to content

drm/apple: J716c external displays and display sleep on firmware 27.2 - #2187

Open
erikwb wants to merge 3 commits into
integration/aurorafrom
j716c/dcpext-27-2
Open

erikwb wants to merge 3 commits into
integration/aurorafrom
j716c/dcpext-27-2

Conversation

@erikwb

@erikwb erikwb commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Firmware 27.2 renumbered the IOMobileFramebufferAP methods (A4xx and A500 up by 50). The build-selected method tables already carry those IDs for table-driven calls, but three paths on T6050 display engines still assumed 27.0:

  • Paired mode sets (dcp_peer_video_call_stream() and peer_setup_test_store()) sent 27.0 IDs; the first call (A411) panicked both engines on 27.2.
  • Other firmware 27 paths named literal 27.0 IDs (A413, A484, A408, A500, display stage calls, and out-of-band wake A442); on 27.2 several collided with other methods, leaving the second engine of a paired 4K240 mode dark and sending 0xaa filler bytes that 27.2's wake call rejects.
  • The firmware 27 display sleep transport (dcp_v27_sleep_transport_supported()) gated on the J716c board compatible and a "27.0.0" compat string, refusing deep sleep on 27.2 ("display 0: no provider").

Change

  • Explicit method tables and fail-closed tag translation: record every paired-mode and sleep method ID in dcp_methods_27_0 and dcp_methods_27_2 (the shifted IDs plus the unchanged paired/DSC hand-off calls A360..A373 and sleep A115), keeping those entries optional for single-engine boot admission in iomfb_v27_missing_method(). iomfb_v27_tag() translates through the engine's table with no arithmetic fallback: 27.0 (including the J714s copy) stays unchanged, while a NULL or renumbered table missing an entry returns -EOPNOTSUPP.
  • Fail-closed callers and wake payload: every direct-ID caller (dcp_peer_video_call_stream(), peer_setup_test_store(), dcp_peer_probe_power(), dcp_peer_probe_modeset(), dcp_peer_queue_background(), iomfb_v27_rpc(), iomfb_v27_call(), and the out-of-band wake call in iomfb_v27_sleep_start()) refuses the call instead of sending an unmapped tag. On renumbered builds, iomfb_v27_sleep_start() zeros the internal wake A442 filler bytes. The J714s A407 swap path keeps its ID and refuses pairs with mismatched swap forms.
  • Data-driven sleep transport admission: dcp_v27_sleep_transport_supported() admits any T6050 DCP or DCPEXT whose build table names every sleep method (iomfb_v27_sleep_methods_complete()), removing the J716c board compatible and firmware version string list while refusing 27.3 until its table is complete.
  • Host tests: update t6041-v27-admission for the extracted table helpers and add v27-tag-translation to tools/testing/selftests/drivers/gpu/apple-dcp covering table translation, fail-closed refusal on unrecorded/27.3 IDs, and board-agnostic sleep transport admission.

Testing

Still to run

  • Re-run the J716c 27.2 and 27.0 hardware validation (paired 4K240 + deep sleep, default command line, 0 AVC / 0 failed units / 0 new kernel errors) on the rebased head 7375b71bfadf.
  • Verify another T6050 board (J714s on 27.0: paired mode and deep sleep unchanged) and, if a 27.3 stub is available, clean refusal of paired 4K240 on 27.3 with no engine panic.

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

@RyanTheTide

Copy link
Copy Markdown
Contributor

Blockers: 2.

The table-first translation is the right shape, and 27.0 is unchanged: iomfb_v27_methods_renumbered() is false for the 27.0 table and for the J714s copy, so every caller sends the same ID as before. Checked: the peer power/mode-set/swap callers, the sleep RPC, the stage calls, the out-of-band wake call, and the transport gate.

  1. drivers/gpu/drm/apple/iomfb_v27.c:279-305: iomfb_v27_tag() fails open. On a renumbered build other than 27.2 (the 27.3 table today), an ID the table does not name is sent as its 27.0 ID, and the PR itself shows that an ID the firmware does not know panics the engine. Record every ID these paths use in each build's table: on 27.2 the shifted ones, plus the paired DSC hand-off calls that were proven unchanged. Then make iomfb_v27_tag() return an error for a renumbered table with no entry, and have the callers (dcp_peer_video_call_stream(), dcp_peer_probe_power(), dcp_peer_probe_modeset(), iomfb_v27_rpc(), iomfb_v27_call(), and the wake call in iomfb_v27_sleep_start()) refuse the call instead of sending it. That also replaces the arithmetic +50 fallback, so no ID goes out because of an inferred numbering.
  2. drivers/gpu/drm/apple/dcp.c:5782-5805: the sleep transport is admitted by of_machine_is_compatible("apple,j716c") plus a firmware version string list, and this PR adds "27.2.0" to that list. The same decision can come from data: admit a T6050 DCP/DCPEXT when iomfb_v27_methods(compat) returned a table that has an ID for every call the sleep sends. Then other T6050 boards on 27.2 are covered without a board check, and 27.3 is refused until its table is complete.
  3. drivers/gpu/drm/apple/iomfb.c:894-908: on 27.2 the out-of-band wake call now goes out under its renumbered ID, but its 92-byte block is still the 0xaa-filled 27.0 layout. On drm/apple: T6050: refuse deep sleep at .prepare where the firmware 27 display sleep is not known #2070, a 27.2 M5 Pro run reported that this call rejects the 0xaa filler in its index-count and block-size fields and accepts zeros. Please show this call's reply status from the J716c 27.2 wake log, or zero the filler for the renumbered build.
  4. This conflicts with drm/apple: T6050: refuse deep sleep at .prepare where the firmware 27 display sleep is not known #2070: that PR refuses at .prepare every T6050 firmware 27 deep sleep except the J714s on 27.0, which would refuse the J716c 27.2 sleep this PR enables. One of the two has to be rebased onto the other.
  5. The commits carry "Developed with Claude Code."; drop that line from the commit messages. The PR body should end with Assisted-by: LLM (<Vendor>:<Model>) instead of "Generated with Claude Code".

HW row: the J716c rows from the body on the rebased branch, plus one other T6050 board (J714s on 27.0: paired mode and deep sleep unchanged); if a 27.3 stub is available, a paired 4K240 mode on 27.3 is refused cleanly with no engine panic; 0 AVC / 0 failed units / 0 new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

@axboe

axboe commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Erik, a heads-up from rebasing #2201 (which carries these three commits) onto integration/aurora a84637d: host-tests fails there in apple-dcp, t6041-v27-admission:

host.c:383:55: error: call to undeclared library function 'isdigit' with type 'int (int)'
  383 |         if (methods != dcp_methods_27_2 || tag[0] != 'A' || !isdigit(tag[1]) ||

The test extracts the function that now calls isdigit(), and its fixture has no <ctype.h>. CI here is green from a run before the tip moved; a rebase will show it.

axboe added a commit to axboe/linux that referenced this pull request Nov 21, 2026
dcp_check_firmware_version() calls isdigit() since "drm/apple: send the
firmware 27 calls named by ID in the engine's build", and
t6041-v27-admission compiles a host copy of it without <ctype.h>:

  host.c:383:55: error: call to undeclared library function 'isdigit'

Include it. Belongs with that commit (aurora-silicon#2187) and leaves this series when
it is fixed there.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
… build

The paired mode set (a mode too wide for one engine, run on two) sends its IOMFB calls through dcp_peer_video_call_stream() (and the opt-in peer setup diagnostic through peer_setup_test_store()), naming them by their 27.0 IDs. Firmware 27.2 renumbered the IOMobileFramebufferAP methods, and an ID the firmware does not know panics it: on a 27.2 stub the paired prepare's set_display_device went out as A411 and crashed both engines.

Record every paired-mode and sleep method ID in each firmware 27 build's table (the shifted IDs on 27.2, plus the unchanged paired/DSC hand-off and sleep calls) while keeping them optional for single-engine boot admission in iomfb_v27_missing_method(). Translate each call's ID through iomfb_v27_tag(): on 27.0 (including the J714s copy) every ID is sent unchanged; on a renumbered build every ID must come from the build's table, returning -EOPNOTSUPP instead of sending an unmapped ID. Update the t6041-v27-admission host test fixture for the table helpers it extracts.

Signed-off-by: Erik Bourget <erik@ebourget.net>
Besides the paired video calls, the firmware 27 paths name several calls by their 27.0 IDs: the primary's paired mode set (A413) and power step (A484), the paired background swap (A408), the sleep's power and A500 steps, the display stage calls and the out-of-band wake call (A442). On 27.2, which renumbered IOMobileFramebufferAP, several of those IDs are other methods: the paired mode's power step ran one and failed, and the second engine of a 4K240 mode never started.

Translate each of them through iomfb_v27_tag() and refuse the call instead of sending it when the build's table lacks an entry. Zero the internal wake A442 payload's filler bytes on renumbered builds, where 27.2 rejects the 0xaa filler as an index count and block size. The J714s's A407 swap keeps its ID, which only its 27.0 table names, and its diagnostic now refuses a pair whose engines take different swap forms. 27.0 sends what it sent.

Signed-off-by: Erik Bourget <erik@ebourget.net>
The T6050 display processors take part in a deep sleep through the firmware 27 endpoint transport, which previously gated on the J716c board compatible and a 27.0.0 compatibility string. On a 27.2 stub no processor registered for the sleep, and every deep sleep was refused ("display 0: no provider").

Admit a T6050 DCP or DCPEXT to the firmware 27 sleep transport whenever its build's method table has an ID for every call the sleep sends (iomfb_v27_sleep_methods_complete()). That covers 27.0 and 27.2 across T6050 boards without a board check while refusing 27.3 until its sleep methods are known. Add the v27-tag-translation host selftest covering table translation, fail-closed refusal on missing/unrecorded IDs, and data-driven sleep transport admission.

Signed-off-by: Erik Bourget <erik@ebourget.net>
@erikwb

erikwb commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Note

🤖 Gemini 4 Neon responding on behalf of erikwb

Rebased onto integration/aurora (606d37ec77a5) at 7375b71bfadf and addressed all review points and the host-test failure:

  • Fail-closed iomfb_v27_tag() (iomfb.h, iomfb_v27.c, peer/sleep callers): recorded all paired-mode (A360..A373, A449) and sleep (A115, A442/A492) IDs explicitly in dcp_methods_27_0 and dcp_methods_27_2 (leaving them optional in iomfb_v27_missing_method() so they do not block single-engine boot). Removed the +50 arithmetic fallback; iomfb_v27_tag() now returns -EOPNOTSUPP on a NULL or renumbered table with no entry, and dcp_peer_video_call_stream(), peer_setup_test_store(), dcp_peer_probe_power(), dcp_peer_probe_modeset(), dcp_peer_queue_background(), iomfb_v27_rpc(), iomfb_v27_call(), and the out-of-band wake call in iomfb_v27_sleep_start() refuse the call instead of sending an unmapped ID.
  • Data-driven sleep transport admission (dcp.c, iomfb_v27.c): dcp_v27_sleep_transport_supported() now checks iomfb_v27_sleep_methods_complete(dcp->v27_methods) on apple,t6050-dcp / apple,t6050-dcpext, dropping both of_machine_is_compatible("apple,j716c") and the version-string list. 27.0 and 27.2 are admitted by data across T6050 boards; 27.3 stays refused until its sleep methods are populated.
  • Wake A442/A492 filler (iomfb.c): zeroed bytes 16..91 of the internal wake payload on renumbered builds (iomfb_v27_methods_renumbered()), leaving 27.0 unchanged.
  • Coordination with drm/apple: T6050: refuse deep sleep at .prepare where the firmware 27 display sleep is not known #2070: with complete sleep method tables on 27.0 and 27.2 and iomfb_v27_sleep_methods_complete() exported, drm/apple: T6050: refuse deep sleep at .prepare where the firmware 27 display sleep is not known #2070 can key v27_sleep_known on the same table check once rebased onto this series so 27.0 and 27.2 stay admitted and 27.3 is refused at .prepare.
  • Commits and PR metadata: dropped "Developed with Claude Code." from all three commits (keeping human Signed-off-by only) and updated the PR body to end with Assisted-by: LLM (Google:Gemini 4 Neon).
  • Host tests (@axboe): removing the +50 arithmetic dropped isdigit() from iomfb_v27.c, and t6041-v27-admission now includes <errno.h> and ARRAY_SIZE for the extracted helpers. Added v27-tag-translation to tools/testing/selftests/drivers/gpu/apple-dcp verifying 27.0/27.2 translation, fail-closed -EOPNOTSUPP on unrecorded/27.3 IDs, and board-agnostic sleep transport admission (--group boot passes 4/4; arm64 W=1 compile-check of dcp.o, iomfb.o, iomfb_v27.o passes with CONFIG_APPLE_SOC_SLEEP=y and =n).

Hardware re-runs on the rebased head are noted under Still to run in the PR body.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-checked at 7375b71.

  • Fail-open translation: fixed. iomfb_v27_tag() (iomfb_v27.c:311-332) refuses a NULL table and any ID a renumbered table does not name, with no arithmetic left, and both tables now name every paired-mode and sleep ID. I checked every caller that names an ID directly (peer power, mode set, setup, background swap, video calls, sleep RPC, display stage, A115 and the out-of-band wake): each one refuses instead of sending.
  • Sleep transport admission: fixed. dcp.c:5845-5859 admits a T6050 DCP/DCPEXT by iomfb_v27_sleep_methods_complete(), and that list matches the calls the sleep sends. The J714s stays admitted without its shortcut. Note that the J714c and J716s now get the transport at boot as well.
  • Wake filler: fixed in code (iomfb.c:909-912). Please include the A492 reply status from the J716c 27.2 wake log in the re-run.
  • drm/apple: T6050: refuse deep sleep at .prepare where the firmware 27 display sleep is not known #2070: still open: it has not been rebased, and as it stands it refuses the J716c 27.2 sleep this PR enables. One of the two needs rebasing onto the other.
  • Commit trailers and the host-test build: fixed. run.py --group boot passes 4/4 here.

Nits:

  • iomfb_v27.c:335-338: iomfb_v27_methods_renumbered() lists the 27.2 and 27.3 tables by pointer, so a table added later to iomfb_v27_methods() but not to this list would be translated as 27.0 again. Treating every table other than the 27.0 table and the J714s copy as renumbered would fail closed.
  • iomfb.c:899-900: a failed A442 lookup skips the wake call without logging anything. That can't happen today, but a dev_warn would make it visible.

Rows still needed at this head: J716c on 27.2 and 27.0 (paired 4K240, 30 s RTC deep sleep and resume, default command line, 0 AVC / 0 failed units / 0 new kernel errors); the J714s on 27.0 with paired mode and deep sleep unchanged; a boot and a deep sleep on a J714c or J716s, which this now admits; and, if a 27.3 stub is available, a clean refusal of the paired mode.

Assisted-by: LLM (Claude:Opus 5.5)

@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.

Review of 7375b71bfadf78bc86f6c897f34d01618e45922f

0 code/policy/attribution blockers. Holding APPROVE only for §5 hardware re-runs on the live head (plus merge coordination with #2070 / #2201).

Checklist summary

  • §1 No model gating: Pass. dcp_v27_sleep_transport_supported() (drivers/gpu/drm/apple/dcp.c:5845-5859) drops of_machine_is_compatible("apple,j716c"), dcp->v27_j714s, and the "27.0.0" compat-string list, admitting any apple,t6050-dcp/apple,t6050-dcpext whose table satisfies iomfb_v27_sleep_methods_complete(dcp->v27_methods). The new v27-tag-translation selftest enforces at compile time that no of_machine_is_compatible() call can creep back in. (Minor cosmetic: the PR title still says J716c, whereas commit 3 generalizes admission across T6050.)
  • §2 Hygiene & §3 Correctness: Pass.
    • Arithmetic +50 inference is removed; iomfb_v27_tag() (drivers/gpu/drm/apple/iomfb_v27.c:311-332) fails closed (-EOPNOTSUPP) on a NULL table or any unmapped ID in a renumbered table.
    • Cross-checked all direct-ID callers across dcp-peer-*-v27.inc, dcp-v27-sleep.inc, and iomfb.c against dcp_methods_27_0 and dcp_methods_27_2: all 58 entries match 1:1 with zero missing or duplicate tags, every caller refuses on error, and dcp_peer_probe_power()/dcp_peer_probe_modeset() pre-validate peer->v27_methods before pushing to the primary engine.
    • Confirmed probe initialization order in dcp.c: dcp->v27_methods is populated (:7145-7154) before dcp_v27_sleep_transport_supported() runs (:7245), and iomfb_v27_sleep_methods[] covers all 8 methods used by firmware 27 sleep.
    • Non-blocking nits:
      1. iomfb_v27.c:335-338: iomfb_v27_methods_renumbered() allowlists dcp_methods_27_2 || dcp_methods_27_3 by pointer; treating anything other than 27.0 (and the J714s copy) as renumbered would fail closed automatically if a future dcp_methods_27_4 table is added.
      2. iomfb.c:899-900: a failed A442 tag lookup returns silently without logging; a dev_warn_once() would make any future misconfiguration visible.
  • §4 Attribution & clean-room: Pass. All 3 commits (ba959978b738, 86a98ff3ed71, 7375b71bfadf) carry human author/committer and Signed-off-by only (Developed with Claude Code. removed); PR body includes Assisted-by:.
  • §6 Naming: Pass.
  • CI / Mergeability: MERGEABLE / CLEAN against integration/aurora; CI host-tests SUCCESS on 7375b71bfadf.
  • Cross-PR coordination:
    • Overlaps with open PR aurora-silicon/linux#2070 (currently CONFLICTING), which refuses T6050 firmware 27 deep sleep at .prepare unless v27_sleep_known (J714s 27.0 only) is set; #2070 will need rebasing onto #2187 (keying on iomfb_v27_sleep_methods_complete()).
    • aurora-silicon/linux#2201 currently carries the earlier pre-refactor versions of these 3 commits plus the ctype.h host-test workaround and can drop them once #2187 merges.

Remaining items (§5 evidence on live head 7375b71bfadf)

  1. J716c (M5 Max) on firmware 27.2 and 27.0 at 7375b71bfadf: paired 4K240 external displays + 30 s RTC deep sleep & resume on the default command line (including A492 wake reply status from the 27.2 wake log), with 0 AVC / 0 failed units / 0 new kernel errors.
  2. J714s on firmware 27.0: paired mode and deep sleep unchanged.
  3. J714c or J716s (newly admitted by removing the apple,j716c gate): boot + deep sleep check, plus clean refusal of paired 4K240 on 27.3 without engine panic if a 27.3 stub is available.

Assisted-by: LLM (Gemini 4 Neon)

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.

4 participants