Skip to content

T6050: display coprocessor DART and power helpers for its restart after a wake - #2027

Merged
DjDeveloperr merged 3 commits into
integration/aurorafrom
j714s/display-restart-helpers
Nov 16, 2026
Merged

DjDeveloperr merged 3 commits into
integration/aurorafrom
j714s/display-restart-helpers

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

On the J714s (MacBook Pro 14", M5 Pro, T6050), each firmware 27 display coprocessor has to be stopped and restarted once more during the wake from a deep sleep, outside the system sleep itself, before the internal panel lights (the display driver's part is in the follow-up PRs). For that restart the coprocessor's DART and power domains go down and come back. These are the three helpers the display driver calls for it.

  • soc: apple: rtkit: after a strict warm restart, the crash log endpoint's buffer request is served as at the first boot. The firmware asks for that buffer only when it crashes, so it is never set up before a restart, and a crash after one ended the boot with -EPROTO instead of giving its crash log.
  • iommu/apple-dart: apple_dart_m5_display_cycle() stops and starts a display coprocessor's DART around its restart (error interrupts masked and cleared, streams 23 and 24 disabled, a TLB flush, the GAPF slice to its off value; and back); apple_dart_m5_display_snapshot() / _rewrite() keep the internal display pipe DART's Linux-owned streams across the display domain's power cycle. Without the rewrite, the firmware's first scan-out after the restart faults on the framebuffer stream's cleared context entry.
  • soc: apple: sleep: apple_sleep_m5_display_power() and apple_sleep_m5_dispext_power() lower and raise the internal or one external display coprocessor's power words (from the T6050 profile's ps.disp[]) and its core gate pair or PMC boost and bandwidth bits, with the values and in the order macOS uses for these restarts. Without the power cycle, a stopped display coprocessor gives no HELLO after its run bit.

T6050 only: the DART helpers accept only T8110-type DARTs and know only the J714s's display coprocessors' DARTs, and the power helpers refuse unless the T6050 sleep profile is the one running. The sleep's own entry and exit don't call any of them. On their own these commits change nothing at run time.

Known limitations

  • apple_dart_m5_display_rewrite() writes back any unlocked stream whose remembered registers differ, and a stream that was invalid at the last snapshot keeps what was remembered for it before. A stream Linux detached between two snapshots could get its old table back; tracking which streams were valid at the snapshot would close that.
  • The helpers' register windows are mapped on first use and never unmapped (only a module reload would notice).

Dependencies

None (base integration/aurora). Used by the DCP wake PR (#2028) and the one-restart PR (#2029).

Testing

Run on the J714s as part of the private test stack whose public form this series is (with #2028, #2029 and #2030): three deep sleeps, panel lit 0.84 s after each wake, one restart of each display coprocessor per wake. That kernel had these commits with their diagnostics at info level; here they are at debug level.

Checks

  • A full cross build (make ARCH=arm64 LLVM=1 Image modules, the M5 kit's configuration) of this head: links (vmlinux, Image, 1774 modules), 0 warnings.
  • checkpatch (--strict): 0 errors; the warnings are the author name against the sign-off's and a few lines over 100 columns.

🤖 Generated with Claude Code

After a strict warm restart, as after a sleep or a stop and restart of a
coprocessor in place, every buffer request has to be answered from the
buffers kept from the first boot, and a request for one that was never
set up fails the boot with -EPROTO. The firmware asks for its crash log's
buffer only when it crashes, so that buffer is normally never set up
before a restart, and a crash after one ended the boot with -EPROTO
instead of giving its crash log.

Serve the crash log endpoint's buffer request after a strict restart as
at the first boot. Every other endpoint keeps the strict rule.

Signed-off-by: Diljit Singh <[email protected]>
On the T6050 (M5 Pro) each firmware 27 display coprocessor is stopped
and restarted once after a wake, outside the system sleep (the display
driver's part follows in the series). Its DART has to go down and come
back with it, and the internal display pipe's DART loses the streams
Linux owns when the display's power domain is cycled for that restart.

Three helpers for the display driver:

- apple_dart_m5_display_cycle(): at a stop, the error interrupts masked
  and cleared, the coprocessor's streams 23 and 24 disabled one write
  each, a TLB flush, then the DART's GAPF slice set to 0x2; before a
  start, the slice back to 0x12, the diagnostic lock and the error mask
  cleared and both streams enabled. These are the writes macOS makes
  around every stop and run bit of a display coprocessor. No translation
  table is touched. The display coprocessors' DARTs have no GAPF range
  in the J714s's tree, so each one's slice is found by the DART's
  address.
- apple_dart_m5_display_snapshot(): before the display's domain goes
  off, every stream with a valid context is remembered, with the enabled
  streams.
- apple_dart_m5_display_rewrite(): once the domain is back on, every
  stream that is not one of the firmware's locked ones and no longer
  reads as remembered is written back, and the TLB is flushed. Without
  it the firmware's first scan-out after the restart faults on the
  framebuffer stream's cleared context entry.

Only a T8110-type DART is accepted, and only the J714s's display
coprocessors' DARTs have a slice.

Signed-off-by: Diljit Singh <[email protected]>
…its restart

On the T6050 (M5 Pro) each firmware 27 display coprocessor is stopped
and restarted once after a wake, outside the system sleep. A stopped
display coprocessor starts again only if its power domains are cycled
between the stop and the start, as macOS does at that point: with the
domains left on, the firmware gives no HELLO after the run bit.

Two helpers for the display driver, both on the sleep profile's display
power words (ps.disp[]):

- apple_sleep_m5_display_power(): the internal display's CPU, FE and
  SYS words, lowered (CPU, the coprocessor core's gate pair, CPU, FE,
  SYS) or raised (SYS, FE, CPU, the gate pair, CPU), each step polled
  until its state has settled. The display pipe DART's own streams are
  remembered before the power-off and written back after the power-on
  (m5_disp_dart_rewrite=0 leaves them). The display driver makes the
  PMC requests around it.
- apple_sleep_m5_dispext_power(): the same for one external display
  coprocessor, found by its device, with its bits in the PMC's boost and
  bandwidth enable words cleared before the power-off and set after the
  power-on. The PMC's request word is left alone: the other external
  coprocessors stay on.

The values and the order are the ones macOS uses for these restarts.
The sleep's entry and exit don't call either; both refuse unless the
T6050 profile is the one running.

Signed-off-by: Diljit Singh <[email protected]>
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.

1 participant