Skip to content

drm/apple, iommu: apple-dart: drive the M4 MacBook Air's internal panel on macOS 27.2 (v27 backend) - #2590

Closed
RyanTheTide wants to merge 26 commits into
djdev/j773g-272-dcpext0from
j713-disp2/dcp272-internal
Closed

RyanTheTide wants to merge 26 commits into
djdev/j773g-272-dcpext0from
j713-disp2/dcp272-internal

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On the macOS 27.2 stub, the M4 MacBook Air's (J713) internal display processor runs the 26B123 image. The M4 26.6.2 backend refuses it, so the panel stayed on simpledrm. Admitting it to the firmware-27 backend was not enough: the IOMMU driver's borrowed J713 display path admits only the 26.6.2 layout. That left the DCP with no IOMMU domain, and its firmware was handed untranslated addresses.

Change

Stacked on #2541 (Dj's v27 backend for the J773g dcpext), which this reuses unchanged.

  • drm/apple: admit the J713 internal DCP with the 26B123 image and aura's firmware-27 clocks to the v27 backend (41-bit DMA, no DPTX, adopt the live session, as T6041's internal DCP gets on firmware 27).

  • iommu: apple-dart: on that handoff, don't borrow the two internal display DARTs. Keep their firmware's locked roots the way T6041's are kept (fw_mirror), and map the re-exported firmware segments with the protection their live leaves have, so the mirror check accepts them.

  • DT: the internal DCP's bandwidth slot, and an apple,panel node (eDP connector type + backlight range).

  • selftests: the admission case, plus readiness stubs (the readiness unit didn't compile on drm/apple, soc: apple: drive the M4 Mac mini's (J773g) HDMI from dcpext0 on macOS 27.2 (v27 backend) #2541's head).

  • drm/apple (follow-up): apple_dcp_usable() lets a T8132 internal DCP handed over this way join the DRM device on any board. It used the board-or-26.6.2 path check, so an M4 MacBook Pro handed over the same way would have probed and never bound.

Nothing changes for a DCP on its 26.6.2 handoff, or for a 27.2 handoff without the firmware-27 clocks. Nothing here needs a kernel or module parameter.

Testing

On the J713 (27.2 stub), lab one-shot kernels, boots 5b40e763 and 4d520ce7:

  • appledrm binds: "DCP booted", 2560x1600@60, card1-eDP-1.
  • apple-panel-bl 0-500 nits; SMC system power goes 3.98 -> 9.98 W across the range.
  • Pure-KMS pacing 60.001 Hz, median 16.666 ms, stdev 0.041 ms, 0 off-grid. Same as the J616s.
  • DPMS off/on x3; 0 DART faults.

Host: apple-dcp selftests 89/89 on this branch; KUnit (arm64 qemu) 225/226, the one skip unrelated, plus a new apple-dart case for the segment protection (apple-dart suites 28/28); W=1 build of the touched objects and both T8132 DTBs, no new warnings.

Tip-based J713 candidate (integration tip + the J713 PR heads incl. this PR at 2a3bb37, Stage 2 with aurora-silicon/aura#404, the one fleet cmdline, no display parameters): appledrm on eDP-1 2560x1600, backlight max 500, 0 DART faults, 0 "NOT locked", 0 failed units on 7 boots (gate first boot + warm 3/3, then warm 3/3 after it became the J713's configured default), s2idle 3/3 with the panel bound, and 3/3 with the panel lit on the configured default (after each wake eDP-1 connected, DPMS on, atomic page flips at 60.00 Hz).

Follow-up f4dccbe: host suite 89/89 (the admission unit now runs apple_dcp_usable() for the internal DCP and the dcpext on both paths, and fails against the previous apple_drv.c), W=1 clean. On the Airs it changes nothing (they are already on the path).

Still to run

  • The deep-sleep DCP quiesce (no firmware-27 sleep has run on this processor; not claimed).
  • External displays on the J713 stay off on 27.2 (separate).
Reviewer / agent detail
  • Root cause chain on 27.2 (J713):
    • apple_dart_dcp_validate() -> apple_dart_dcp_firmware() accepts 26.6.2 only, so 30ae00000.dcp had no iommu_group.
    • In the first trial, the firmware's crash log IOVA 0x100066b5000 could not be resolved (no domain, -ENOMEM), and dma-direct handed it PA 0x10032458000 as a DVA ("SID23 write STE invalid").
    • A read-only dump of the live SID23 tables shows the crash log inside the firmware's __DATA (root 3, leaves 260-462 -> PA 0x103e1874000).
    • The safety net for that failure mode is separate: drm/apple: dcp: refuse a processor its DART left without an IOMMU domain #2578.
  • Why not port the v27 backend to the borrowed APIs: the borrowed SID23 domain reserves its whole window for the M4 backend's own allocator, and SID16 accepts only the shared-buffer API. The v27 backend DMAs through ordinary domains (RTKit and IOMFB shared memory, AFK rings, allocate_buffer, PIODMA maps). The locked-root path is what T6041's DCP already runs on firmware 27.
  • Firmware segment protection: the live leaves are __TEXT flags 0x5 (read-only, cacheable), and __DATA plus the four other segments 0x1 (read-write, cacheable). The core maps iommu-addresses regions read-write, and uncached for this dma-noncoherent DCP, so apple_dart_fw_slot_mirrors() refused every segment until the regions take the leaves' protection. Boot log: firmware segment 0x10005bcc000+0x844000: protection 0x5 as its live leaves (asked 0x3) and 0x7 for the rest.
  • Live RTKit start on 27.2: protocol 12; crash log 0x100066b5000 -> PA 0x103e1b19000; host buffers 0x10fffffc000 / 0x10fffff8000; IOP power 0x0 -> 0x20.
  • Panel node values: 2560x1664 at 224 ppi -> 290 x 189 mm, 181 mm without the 64 notch rows (the same as J413), and the published 500 nits.
  • Evidence (our own logs, not tainted): traces/display/20261121-j713-d2-oneshot/ and traces/display/20261121-j713-dcp272-pt/ in the lab store.
  • Review items at 29701d0: 1, 2, 3, 6 and 7 are in 6323124 / 742e754 / 2ec7e53, and the internal DART selection is keyed on the processor's handoff in 2a3bb37 (no address keys, no global scan). Item 4: on the 27.2 path the apple_dart.j713_dcp / j713_display parameters no longer leave these DARTs alone; that is intended, the path needs no parameter. Item 5: the v27 path has no apple,clock-protection power gating; s2idle with the panel bound is covered by the rows above, deep sleep is not claimed.

Assisted-by: LLM (Claude:Opus 5.5)

DjDeveloperr and others added 16 commits November 20, 2026 02:22
The Mac mini (J773g) on macOS 27.2 (26B123) runs one DCP image,
UUID B3BA603C-3CA7-3E21-B393-44EB20BD2AEF, on dcp, dcpext0 and dcpext1
(its 27.2 ADT; the three share __TEXT). Its external processors are to be
driven through the firmware-27 backend as the T6041's 27.2 ones are, so
the display gate and the DCP driver need the same pinned admission the
T6041 helpers give: the image UUID, firmware version and compatibility
27.2.0.

Split the T6041 check into apple_dcp_image_v27_2(), which takes the
image UUID, and add apple_t8132_dcpext_v27_2() for a J773g dcpext. It is
limited to the J773g until another T8132 board's 27.2 trace shows the
same interface.

apple_t8132_dcpext_v27_2() is in linux/soc/apple/t8132.h, with the other
T8132 board helpers: its machine check stays out of display.h, whose
T6041 helpers key on the processor and its image alone (the apple-dcp
boot selftest builds them with no of_machine_is_compatible()).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Diljit Singh <hey@djdev.me>
The M4 backend (iomfb_m4.c, t8132_ext_drm.c) adopts T8132 display
processors on the 26.6.2 firmware path. The Mac mini's device tree is also
booted on macOS 27.2 firmware, where the boot loader leaves the main DCP
running idle and hands it to nobody, and where dcpext0 is to run the
firmware-27 backend instead. Make the M4 paths say so:

- dcp_check_firmware_version() refuses an M4 hw-data DCP off
  apple_t8132_firmware_path(), before the probe claims its IOMMU domain.
  iomfb_m4_init() refused such firmware already, but only later.
- apple_dcp_usable() leaves the main T8132 DCP out of the DRM device's
  components off that path, so a device tree that enables it (as the
  26.6.2 HDMI work does) does not hold the DRM device up waiting for it.
- dcp_is_t8132_ext() and the probe, remove and shutdown dispatch match
  only an M4-adopted dcpext (dcp_t8132_ext_m4_node()): a J773g dcpext
  with the 27.2 image (apple_t8132_dcpext_v27_2()) is neither routed
  through dcp_platform_probe_t8132_ext() nor caught by the T8132 Type-C,
  crossbar and tunnel special cases of the fabric and the DPTX service.

Nothing changes on the Airs (any firmware) or on any T8132 Mac on
26.6.2.

The host replays that extract dcp_is_t8132_ext() (tiled-split,
dcpext26-crossbar-union) take the new helper with it; the crossbar one
also checks that a J773g 27.2 dcpext takes the T6041 firmware-27 link.

The apple-dcp boot selftest checks the gate both ways: a T8132
processor of the M4 backend is the M4 backend's on its firmware path,
and nobody's off it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Diljit Singh <hey@djdev.me>
…able

On macOS 27.2 (26B123) the Mac mini's (J773g) external display
processors run the same image as its main DCP (UUID B3BA603C), and aura
hands them over the way it hands over the M4 Max Mac Studio's (J575c):
firmware memory in text/data/heap regions, apple,firmware-version and
-compat 27.2.0, the image UUID, and the dispextN provider clocks. Admit
such a dcpext the way the T6041 27.2 dcpext is admitted:

- dcp_check_firmware_version() returns firmware 27 for it, with the
  27.2 method table, before the M4 hw data is looked at. That the T8132
  26B123 image numbers its IOMFB methods as the T6041 and T8142 26B123
  images do is assumed, not traced; the comment says so. The method
  table check is now one helper, dcp_v27_method_table(), shared with
  the existing firmware-27 and T6041 cases.
- It gets apple_dcp_hw_t8132_dcpext_v27, whichever hw data its
  compatible matched: firmware_dma_bits 41 (the firmware DART window,
  1 TiB + 64 GiB, ADT dart-dcpext0 vm-base and vm-size-23),
  num_dptx_ports 2, adopt_live_session (iBoot leaves it running,
  pre-loaded = running = 1) and sink_metadata_edid, as T6041's dcpext
  gets on 27.2. No sleep support.
- It is a failsafe external processor and a component of the DRM device
  (apple_dcp_id_tbl, apple_dcp_usable()), unlike an M4-adopted dcpext.

The apple-dcp boot selftest (t6041-v27-admission) now also builds
dcp_v27_method_table() and the real apple_t8132_dcpext_v27_2(), with its
machine check as a flag. It checks:
- the J773g dcpext with the T8132 27.2 image runs the 27.2 table, on
  and off the M4 path;
- another M4 Mac's dcpext does not;
- the main DCP, the T6041 image, a missing or second UUID, and other
  releases are refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Diljit Singh <hey@djdev.me>
The T8132 device trees describe the PMC window that holds a DCP's
realtime bandwidth request slot as its last display window (disp-4, as
the ADT's dispN reg[4]), and apple,bw-scratch names that window's index
with the slot's node (dcpext0: 0x38282c000, 0x2c000 into it). The M4
backend reads it that way. The common path (dcp_get_disp_regs(), used by
the firmware-27 backend) only accepted a slot as a window of its own
right after the disp-N ones, so a firmware-27 T8132 dcpext failed to
bind with "Unexpected disp_reg value in 'apple,bw-scratch': 4".

Accept a slot whose index names an existing window when the slot lies
inside it: no window is added, and the scratch offset is taken relative
to that window, so map_reg hands the firmware the window it expects at
index 4 and the D003 reply carries the slot's address. Trees that
already worked are unchanged; they never named an existing index.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Diljit Singh <hey@djdev.me>
macOS 27.2 drives the Mac mini's HDMI port from DCPEXT0 alone (4K60
without DSC, 4K120 with DSC, FRL on the PS190 converter): the LPDPTX PHY
with source select = dcpext0's dcp-index 1, the converter's rails on SMC
GPIOs 15 (hdmi_pwr_en) and 26 (dp2hdmi_pwr_en), and no Type-C crossbar
route. That is the M4 Max Mac Studio's (J575c) HDMI port: the same
converter, rails and LPDPTX PHY ("dptx-phy,t8132" in both ADTs), which
its T6041 dcpext0 drives on 27.2 as a desktop external processor.

Make the J773g's firmware-27 dcpext a desktop external processor too
(dcp->desktop_external, now the one test dcp_desktop_external() reads),
so it takes the J575c's fixed-port path rather than porting the M4
backend's (dcp_t8132_fixed_hdmi on 26.6.2):

- its fixed dp-phy is initialised and powered at probe
  (dcp_desktop_probe_routes()), and the converter rails get their
  100 ms before the DCP asks for the link;
- a direct crossbar link request takes the T6041 path, not the T6050
  crossbar one (dcp_direct_crossbar_link()); with no crossbar or route
  described it has nothing to do.

The HPD line, the rails, the PHY and the connector type come from the
device tree, as on J575c.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Diljit Singh <hey@djdev.me>
The Mac mini (J773g) drives its HDMI port through the T8132's own LPDPTX
PHY (ADT /arm-io/dptx-phy, "dptx-phy,t8132", crossbar dfp-endpoint 4).
The M4 Max Mac Studio's HDMI PHY is the same block ("dptx-phy,t8132" in
its ADT too) and is described as the T6050 layout with the ADT's PLL
calibration. Allow apple,t8132-dptx-phy with the same fallback, and the
calibration's sixth value, RODCOROLEAKCOMP, which the driver reads
(apple,pll-rodcoroleakcomp) and the mini's ADT sets (0), where the
Studio's leaves it unset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Diljit Singh <hey@djdev.me>
On macOS 27.2 the Mac mini (J773g) is off the M4 26.6.2 firmware path,
so the display gate did nothing for it. aura hands it over as it hands
over the M4 Max Mac Studio (J575c): dcpext0's (and dcpext1's) firmware
memory and firmware clocks, the main DCP left running idle, and the
display subsystem and its DART enabled on iBoot's boot framebuffer, with
every dcpext node left disabled for this gate.

Add a J773g gate that does what gate_t6041_max_run() does for the J575c's
HDMI chain: once dcpext0 has its firmware memory, the display subsystem
is enabled and the image is the pinned 27.2 one
(apple_t8132_dcpext_v27_2()), enable the LPDPTX PHY, dcpext0's firmware
and display DARTs, its mailbox, its PIODMA child and dcpext0 in one
changeset. A chain that is not all there and disabled is left alone, as
there. It runs only off the M4 firmware path; on 26.6.2 the J713 dcpext
route handling runs instead, unchanged.

One difference from the J575c: the display subsystem's iommus become
dispext0's DART rather than having it appended. The main pipe's display
DART (disp0) belongs to the running main DCP, which nothing hands over on
this firmware and which apple-dart never probes there; left in the
iommus it would hold the display subsystem's probe forever. The main
DCP's own nodes are left as the device tree has them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Diljit Singh <hey@djdev.me>
… 27.2

On macOS 27.2 the Mac mini drives its HDMI port from DCPEXT0 alone,
through the LPDPTX PHY (source select = dcpext0's dcp-index 1) and the
PS190 DP-to-HDMI converter, whose rails are SMC GPIOs 15 and 26. It is
the M4 Max Mac Studio's HDMI port, so describe it in the J575c's style
(t6041-j575c-hdmi.dtsi), from the mini's 27.2 ADT:

- dcpext0's firmware memory as three disabled apple,asc-mem
  placeholders named text, data and heap, for aura to fill;
- the PHY (ADT /arm-io/dptx-phy, "dptx-phy,t8132", core and dptx banks
  at 0x39a700000/0x39a740000) in the T6050 layout with the ADT's PLL
  calibration, crossbar ufp-endpoint 0 (dispext0), disabled;
- dcpext0 as an HDMI-A port: that PHY at crossbar output 4, hdmi_hpd on
  AOP GPIO 41, hdmi_pwr_en and dp2hdmi_pwr_en on SMC gP0f and gP1a;
- no power domain on dcpext0, its mailbox and DARTs: no PMP runs off the
  M4 firmware path and iBoot leaves DISPEXT0 powered, as on the J575c
  (and as the 26.6.2 HDMI work found for this pipe).
- DISPEXT0_FE always on: only the boot framebuffer holds it (and
  DISPEXT0_SYS through it), so once the display driver removes that,
  genpd would power the front end off under the running dcpext0. The
  T8132 PMGR driver leaves its auto-enable bits alone either way.

Everything stays disabled: the display gate enables the chain on 27.2.
The main DCP, its DARTs and the display subsystem are left as they were,
so a 26.6.2 boot, whose main-DCP HDMI path enables them from the board
tree, keeps them. On 26.6.2 the M4 PMGR policy still decides whether
DISPEXT0_FE is Linux's at all; always-on only applies where it is and
the policy does not give it to the firmware.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Diljit Singh <hey@djdev.me>
…h slot

The firmware-27 DCP backend asks for apple,bw-scratch before it binds
("Incompatible devicetree!" without it). The T8132 internal DCP's slot is
in the PMC window it already has as disp-4: bandwidth agent 0, the one the
ADT's /arm-io/disp0 bw_req interrupt (BIRQ 0x35) names in the PMGR
bwr-agent table, 0x20000 into the window; agents are 0x4000 apart, which
puts the dcpexts' agents 3 and 4 at the pmgr_dcpext slots this tree
already has. Describe it the way the dcpexts' slots are described, inside
display window 4.

The M4 26.6.2 backend reads the same property and has run the internal
panel without a mailbox; keep it that way by taking the mailbox for an
external processor only, so nothing changes on 26.6.2.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…27.2 table

On the macOS 27.2 stub the M4 MacBook Air's (J713) internal display
processor runs the 26B123 image the J773g's processors run (UUID
B3BA603C), and the M4 backend refuses it ("unqualified firmware 26.6.2
handoff"), so the panel stays on simpledrm.

Admit an internal T8132 DCP that the boot loader handed over with that
image (firmware version and compatibility 27.2.0) and with the
firmware-27 clock metadata (apple,clock-ids, from /arm-io/disp0) to the
firmware-27 backend with the 27.2 method table, before the M4 hw data is
looked at. Requiring the clocks keeps out a main DCP that a boot loader
leaves running idle without a handoff, as on the Mac mini.

It gets apple_dcp_hw_t8132_v27: 41-bit firmware DMA (apple,dma-range
<0x100 0 0x10 0> ends at 1 TiB + 64 GiB), no DPTX port service, and
adoption of the live session iBoot leaves running. No sleep support.

That the T8132 26B123 image numbers its IOMFB methods as the T6041 and
T8142 26B123 images do is the assumption the J773g dcpext admission
makes too.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Build the real apple_t8132_dcp_v27_2() into the t6041-v27-admission unit
(of_property_present() mocked for apple,clock-ids) and check that the
internal processor handed over with the T8132 26B123 image and its
firmware-27 clocks runs the 27.2 table on either firmware path, and that
without the clocks, with the T6041 image, a missing UUID or another
release it is the M4 backend's on its path and nobody's off it.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
apple_dcp_usable() calls apple_t8132_firmware_path() and
apple_t8132_dcpext_v27_2() for T8132 processors since the M4 backend was
kept off firmware-27 ones. The readiness unit builds apple_dcp_usable()
without linux/soc/apple/t8132.h and failed to compile. It has no T8132
node, so stub both as unreachable, as the T6030 and T6041 helpers are.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…ots like T6041's

On the macOS 27.2 stub the M4 MacBook Air's internal display processor
runs the 26B123 image and the firmware-27 backend. That backend DMAs
through ordinary IOMMU domains: RTKit and IOMFB shared memory on SID23,
PIODMA maps on SID16, scan-out on SID0. The borrowed J713 display path
cannot serve it. It admits only the 26.6.2 layout, so the DCP is left
without any IOMMU domain, and it reserves the whole SID23 window from
generic DMA for the M4 backend's own allocators.

When the internal DCP was handed over with the 27.2 image and its
firmware-27 clocks (apple_t8132_dcp_v27_2()), do not borrow its two
display DARTs. Give them the locked-root handling T6041's display DARTs
get on firmware 27 (fw_mirror): the firmware's live slots are kept and
Linux's mappings go into the rest. Refuse the DART if it is not locked
as expected. Nothing changes for a DCP on its 26.6.2 handoff, or for a
27.2 one without the firmware-27 clocks (the default Stage 2 hands it
over without them).

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…s its leaves do

On the J713's 27.2 handoff the internal display DARTs keep their
firmware's locked roots (fw_mirror). A Linux table in a slot the firmware
holds must then mirror the firmware's leaves exactly, protection included
(apple_dart_fw_slot_mirrors()). The boot loader re-exports the firmware's
own segments as iommu-addresses, and the core maps those read-write, and
uncached for this non-coherent DCP. The live leaves differ: the
firmware's text is read-only, and all of its segments are cacheable
(SID23 dump on the 27.2 stub: __TEXT flags 0x5, __DATA and the four
other segments 0x1). As it stood, the DCP's attach would refuse every
segment and leave the processor without a domain.

For such a DART, give each translated region the protection the live
leaves give every one of its pages. A region whose pages are not mapped
there, map elsewhere or disagree keeps its protection, and the attach
then refuses it as before.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The firmware-27 DCP backend takes the internal connector type (eDP) and
the backlight range from the DCP's apple,panel child. The M4 26.6.2
backend never needed one, so the J713 has none, and on the 27.2 stub its
panel comes up as an 'Unknown' connector without a backlight device.

Describe the panel as on the other Airs: 2560x1664 at 224 ppi, 64 notch
rows above the desktop, and the published 500 nits maximum.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Split the region walk from its device lookup and test it on a fake
locked root: read-only text pages and read-write data pages take the
protection of the leaves that map them (cacheable), a region whose leaf
maps another page keeps what it asked for, and nothing changes on a DART
that is not a 27.2 J713 display DART.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>

@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 at 29701d0. I approve the code, but the merge is held, and the reason isn't the code. This PR is stacked on my draft #2541 (djdev/j773g-272-dcpext0):

  • No CI has run on this head (0 checks). host-tests and dt-checks only run for PRs into integration/aurora.
  • Merging here would land it on my draft branch, not on integration/aurora.
  • #2541's own host-tests is red in apple-dcp. Your readiness stub (a23ec50) should fix that.

Please don't merge this into djdev/j773g-272-dcpext0. Once #2541 lands I'll retarget this PR to integration/aurora. That cuts the diff down to your 8 commits and runs host-tests and dt-checks on this head. Then I'll merge with --match-head-commit.

Gates

This extends the existing gate pattern and doesn't break other boards.

  • apple_t8132_dcp_v27_2() (display.h:58) picks the backend from the handoff alone: image UUID, 27.2.0 and apple,clock-ids, with no board list. That's the direction we want, and it's better than the J773g board check in apple_t8132_dcpext_v27_2().
  • apple_t8132_internal_dcp_v27_2() (t8132.h:63) and j713_v27 add another firmware-version key on the DART side. They sit inside the existing apple_t8132_firmware_path() and res->start checks (apple-dart.c:5457-5471). That's fine as a step.
  • Other M4s on 27.2 are excluded by apple_t8132_firmware_path(). aura#404 also publishes apple,clock-ids on 27.2 only for the J713 (dt_set_m4_dcp_handoff() bails on any other board unless it runs 26.6.2).
    • If a later handoff gives another M4's DCP those clocks, that DCP would pick the v27 backend while its DARTs stay untouched.
    • With #2578 in the same tree, appledrm then refuses loudly. That's safe.

For the tracking issue, please cover all of these, not only the 26.6.2 check in apple_dart_dcp_validate() (apple-dart-dcp.h:1041, used at :1073):

  • apple_t8132_firmware_path() / apple_t8132_qualified_firmware() in the DART adoption.
  • The 0x30a300000 / 0x30a340000 address keys.
  • apple_t8132_internal_dcp_v27_2(). Key each DART on the handoff of the DCP node that uses it, not on a global scan.
  • The j713_v27 fw_mirror choice. Derive it from the locked root and the handoff.

None of this blocks.

Memory safety

The protection change is correct.

  • __apple_dart_j713_v27_fw_prot() changes a region's protection only when every page's live leaf maps exactly region->start + off, with the same protection on every page.
  • Any other region keeps its read-write, uncached protection and is refused at publish as before. That logs failed to publish host page-table entries at error level.
  • So the device never gets more than the firmware's own leaves give it:
    • TEXT loses write access.
    • CACHE comes only from a leaf that already has it.
    • In slots the firmware holds, the hardware keeps walking the firmware's leaves, so nothing the device sees changes.
    • Linux's own allocations for this dma-noncoherent DCP stay uncached.
  • Region bounds are the handoff's iommu-addresses, and the code checks their length and 16K alignment.

Non-blocking follow-ups:

  1. The root table (apple-dart.c:4597) and the leaf tables (:4620) are memremap'd write-back straight from TTBR and the root entry.
    • The rest of the driver validates firmware tables first: apple_dart_fw_table_decode() requires a table PTE with no stray bits, pointing into reserved RAM.
    • An entry that names MMIO would get a Normal-WB mapping here. Please reuse those helpers.
  2. The slot comes from masking DVA bits 14..35 (:4611), so a region outside the stream's 64 GiB window aliases into it.
    • The exact physical-address match makes this harmless, but please check region->dva against the window first.
  3. "NOT locked: refusing" (:5990) is logged with dev_info. Make it dev_err.
  4. On 27.2, j713_display is cleared before the j713_dcp / j713_display parameter check (:5502), so apple_dart.j713_dcp=0 no longer leaves these DARTs untouched. Please keep that escape hatch on the v27 path too, or say in 0bb4ac7 that it's gone.
  5. The v27 path also drops the preserve_display handling, including the apple,clock-protection power gating (apple_dart_dcp_power_off()). That matters for the sleep row you already list.
  6. KUnit: add a region whose two pages have different protections, and check that it stays unchanged.
  7. Nit: the new block in dcp_check_firmware_version() (dcp.c:5921-5933) sits between the J773g dcpext comment ("ASSUMED, NOT TRACED") and the code it describes (:5935). Please move it below that code.

Other SoCs

The other SoCs are unchanged.

  • T6041, T6050, T8140, T8142: the only change they see is || j713_display_v27, which is false for them, in the fw_mirror list (apple-dart.c:5982).
    • The new reserved-region hook returns early unless j713_v27 is set.
    • The dcp.c changes match only apple,t8132-dcp. The dcpexts' only compatible is apple,t8132-dcpext.
  • J713 on 26.6.2: it keeps the M4 backend and the borrowed DARTs.
    • bw_mailbox stays 0, because it's now set only for external DCPs (iomfb_m4.c:2677).
    • The M4 path never calls dcp_get_disp_regs().
  • DT:
    • The panel node matches the binding's pattern.
    • The binding requires apple,bw-scratch on an enabled t8132-dcp.
    • The pmgr_dcp slot lies inside disp-4, the same layout as pmgr_dcpext.
    • The panel sizes check out: 2560 px at 224 ppi is 290 mm, 1664 px is 189 mm, and 1600 px is 181 mm.

Evidence

Your 5 code commits are patch-identical to lab/j713-disp2-dcp272-b-20261121 (4bc6a6a). That lab tree differs from this PR, though:

  • It's based on integration/aurora, so it has #2578 and Erik's 3f59f0e.
  • It carries the lab-only "stop once RTKit is up (default on)" commit (051adf3).
  • It doesn't have the panel node commit (b73456c).

Boots 5b40e763 and 4d520ce7 aren't on GitHub. Please push them or name the trees they were built from, since the eDP-1 and 0-500 nit results depend on the panel node. Please also record the Mutter crash at handover from the lab boot, either here or in an issue.

Post-merge rows

After the retarget and merge:

  • J713 on 27.2, with aura#404, on the merged tip: appledrm binds, eDP-1 and the backlight work, DPMS off/on x3 passes, 0 DART faults, and no "NOT locked" line.
  • J713 on 26.6.2: the M4 backend and the borrowed DARTs are unchanged.
  • One fw_mirror board (Neo T8140 or M5 T6050): appledrm binds with 0 DART faults.
  • s2idle on 27.2 with the panel bound: already on your still-to-run list.

Revert: git revert -m 1 <merge commit>.

This PR does nothing until aura#404 publishes apple,clock-ids, so it's safe to land the kernel side first.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Tracking issue for the firmware-version and address keys, with every item from the review (DART adoption, the two address keys, apple_t8132_internal_dcp_v27_2(), the j713_v27 fw_mirror choice, plus #2596's predicate): #2621

DjDeveloperr and others added 2 commits November 20, 2026 19:28
…t its board

apple_t8132_dcpext_v27_2() also required of_machine_is_compatible(
"apple,j773g"). The firmware interface belongs to the coprocessor and the
image it runs, and both are already checked: an apple,t8132-dcpext node
with the T8132 27.2 (26B123) image UUID and firmware version and
compatibility 27.2.0. What differs between T8132 boards (the J773g's
fixed HDMI port, its LPDPTX PHY, converter rails and hot-plug line) is
described in each board's device tree, and the driver takes it from
there. RyanTheTide asked for this in the review of
#2541.

Drop the board check. The apple-dcp boot unit now asserts that the
admission has no machine check and that a T8132 dcpext on the 27.2 image
is admitted on either firmware path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Diljit Singh <hey@djdev.me>
apple_dcp_usable() calls apple_t8132_firmware_path() and
apple_t8132_dcpext_v27_2() since this series, and the readiness unit
extracts it without linux/soc/apple/t8132.h, so it no longer compiled.
No scenario there has a T8132 node: stub both as unreachable, like the
T6030 and T6041 helpers next to them.

The patch is RyanTheTide's, from the review of #2541.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Diljit Singh <hey@djdev.me>
…its tables, in its window

The live-leaf protection for a 27.2 J713 internal display DART's firmware
segments memremaps the stream's root straight from TTBR, and each leaf
table straight from its root entry, write-back. The rest of the driver
maps a firmware table only after apple_dart_fw_table_decode() has checked
it: a table entry with no stray bits, naming reserved RAM. An entry that
named a device's registers would get a Normal write-back mapping here.

The leaf slot also comes from DVA bits 14..35 alone, so a region outside
the stream's 64 GiB window aliases into it. The physical address match
made that harmless, but the region should not be looked up at all.

Map the root only when it is a firmware table in reserved RAM, decode
each leaf table entry with apple_dart_fw_table_decode(), and skip a
region that does not lie inside the stream's window (locked_window, the
DART's apple,dma-range until a domain attaches: 64 GiB at 1 TiB on the
display DARTs). A skipped region keeps the protection it asked for, and
the attach refuses it as before.

KUnit: the tables are now reserved pages; new cases for a region whose
two pages have different protections, a region 64 GiB above the window,
and a leaf table outside reserved RAM. All three stay unchanged.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
A 27.2 J713 internal display DART that the boot loader did not leave
locked is refused (-EINVAL), but the line saying so was logged with
dev_info() as one of two cases of the same message. Log the refusal with
dev_err() on its own.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The T8132 internal DCP's 27.2 case in dcp_check_firmware_version() sat
between the J773g dcpext comment ("ASSUMED, NOT TRACED") and the code
that comment describes. Move it below that code; the two predicates match
different compatibles, so the order changes nothing.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Follow-ups to the review at 29701d0, pushed as three new commits (no force push), head 2ec7e53:

  • 1 (tables) and 2 (window), 6323124: the root is mapped only when apple_dart_fw_table_ram() accepts the TTBR address, and each leaf table only through apple_dart_fw_table_decode(). A region outside the stream's window (locked_window, which is the DART's apple,dma-range until a domain attaches: 64 GiB at 1 TiB on disp0_dart) is skipped, so it keeps the protection it asked for.
  • 3, 742e754: the refusal now logs with dev_err as its own line.
  • 6 (KUnit), 6323124: the test tables are now reserved pages. New cases cover a two-page region with different protections, a region 64 GiB above the window (same slot bits), and a leaf table outside reserved RAM. All three stay unchanged.
  • 7, 2ec7e53: the 27.2 internal case now sits below the J773g dcpext code that the comment describes. The two predicates match different compatibles, so the order doesn't change behaviour.
  • 4 (j713_dcp escape hatch): it's gone on the v27 path, and I'm leaving it that way. Our rules now forbid module parameters as feature switches. The v27 path is selected only by the handoff, and a DART that isn't locked is refused. I can't reword 0bb4ac7 without a force push, so this comment and the PR body record it.
  • 5 (preserve_display / clock-protection power gating): this is handled in drm/apple: stop the M4 MacBook Air's internal DCP firmware on macOS 27.2 (DPMS off, deep sleep) #2660, which is stacked on this PR. It adds the J713 DCP DART's clock-protection slice as its gapf word, released after the DART's power-down flush. It shows DPMS off/on 3/3 and 10/10 deep sleeps with the panel lit at entry.

Testing on 2ec7e53:

  • KUnit apple-dart passes 28/28 (arm64, 16K pages, qemu). I also ran two mutants, one without the window check and one without the reserved-RAM check on the leaf table. Each fails the new cases (outside.prot and text.prot respectively).
  • tools/asahi/run-host-tests.py: 437/437.
  • W=1 build of apple-dart.o and drivers/gpu/drm/apple/ with the fleet78 config: no warnings.

Still to run: the J713 row is queued with the Air's owner. Kernel 7.3.0-bj713u2+ is the J713 default batch-7 plus these three commits, booted as a one-shot on the stock cmdline. It passes if it prints the same "firmware segment ... protection" lines as the default, eDP-1 is connected, DPMS off/on passes 3/3, there are 0 DART faults and no "NOT locked" line.

Assisted-by: LLM (Claude:Opus 5.5)

…2-internal

Resolve the conflict with the base's board-free dcpext check: keep this
branch's apple_t8132_internal_dcp_v27_2() beside the base's rewritten
apple_t8132_dcpext_v27_2() comment in t8132.h, and in the apple-dcp
boot selftest keep the internal DCP's 27.2 cases with the base's PASS
line, without the dropped machine_j773g flag.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
RyanTheTide added a commit that referenced this pull request Nov 21, 2026
…p272-j773g-dcpext

#2590 gained the review follow-ups (firmware-table and window checks in
the live-leaf protection, the refusal as dev_err) and a merge of its
base. Keep this branch's fw_live_prot name for the flag and the
function, with #2590's checks inside it and its dev_err split beside the
T8132 external display line; the KUnit case keeps the new name and
gains #2590's reserved tables, window and mixed/outside cases.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…s handoff

A T8132 DART took the firmware-27 path for the internal display when it
sat at one of the two J713 internal display DART addresses on the M4
firmware path and any available internal DCP anywhere was handed over
with the 27.2 image (apple_t8132_internal_dcp_v27_2(), a global scan).
The address list and the scan say nothing about whether this DART
belongs to that processor.

Ask the DART's own user instead: a T8132 DART is a 27.2 internal display
DART when an available apple,t8132-dcp that the boot loader handed over
with the 27.2 image (apple_t8132_dcp_v27_2(): image, firmware version
and its firmware-27 clocks) names it, in its own iommus (the firmware
DART) or in a child's (the PIODMA's display DART). Such a DART also
skips the "leave it untouched off the qualified firmware" refusal, which
is keyed on the same addresses: its processor was handed over.

On the J713 the same two DARTs qualify as before. Another M4 whose
internal DCP is handed over with the 27.2 image and its clocks now gets
its DARTs on the same path instead of the backend running on DARTs left
on the borrowed path. The 26.6.2 path and its address keys are
unchanged. apple_t8132_internal_dcp_v27_2() has no users left.

Link: #2621
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Blockers: 1.

The follow-ups since 29701d0 look right: the root is mapped only after apple_dart_fw_table_ram() (apple-dart.c:4600), leaf tables only through apple_dart_fw_table_decode() (:4632), and the window check (:4605-4620) is overflow-safe and skips every region if the window is unset, so a bad lookup fails closed. The dev_err split and the comment move change no behaviour, and the merge resolution keeps both predicates.

  1. apple-dart.c:5468-5482 selects the 27.2 internal display DARTs through j713_display, i.e. apple_t8132_firmware_path() (a J713/J715 machine check on 27.2) plus the 0x30a300000/0x30a340000 address match, and decides "v27" from a global scan of all apple,t8132-dcp nodes. Another T8132 with the same 27.2 handoff would get its DCP onto the v27 backend (apple_t8132_dcp_v27_2() has no board term) while its DARTs stay untouched and unmirrored, which is the no-domain failure this PR fixes. Please select these DARTs the way iommu: apple-dart: keep a 27.2 J773g dcpext's locked display DARTs like the J713's #2596 selects the dcpext ones: a locked apple,t8132-dart named in the iommus of an available node that passes apple_t8132_dcp_v27_2() (or of its PIODMA child), without the firmware-path or address terms, and drop apple_t8132_internal_dcp_v27_2(). This is the item already listed in T8132 display: key the DART and DCP firmware-layout choices on each DCP's handoff, not on version/address/board checks #2621; it should land with this PR rather than after it.

Rows: 6323124 changes the lookup that decides whether the firmware segments attach, and there is no J713 27.2 boot on 2ec7e53 or ff917b8 yet. Please add that row (segment protection lines, eDP-1 connected, DPMS off/on 3/3, 0 DART faults, no "NOT locked"), plus a J713 26.6.2 boot and one fw_mirror SoC (T8140 or T6050) to show the shared paths are unchanged.

RyanTheTide added a commit that referenced this pull request Nov 21, 2026
…p272-j773g-dcpext

#2590 now keys a 27.2 internal display DART on its processor's handoff
with apple_dart_serves_t8132_dcp_v27(), the internal twin of this
branch's apple_dart_serves_t8132_dcpext_v27(). Resolve them into one
helper, apple_dart_serves_v27_dcp(dart, compatible, predicate), used
with apple,t8132-dcp / apple_t8132_dcp_v27_2() for the internal
processor and apple,t8132-dcpext / apple_t8132_dcpext_v27_2() for the
external ones.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

J713 row for the follow-ups, plus one more commit, now pushed: 2a3bb37 "iommu: apple-dart: key a 27.2 internal display DART on its processor's handoff". This is item 3 of #2621. A T8132 DART takes the 27.2 internal path when an available apple,t8132-dcp that was handed over on 27.2 (apple_t8132_dcp_v27_2()) names it, either in its own iommus or in a child's (the PIODMA). That replaces the two internal DART addresses and the global scan on this path, and removes the now-unused apple_t8132_internal_dcp_v27_2().

Row: PASS. Run on the J713 (M4 Air) with the macOS 27.2 stub and the stock cmdline, as a kernel-only one-shot of 7.3.0-bj713u3+. That kernel is the J713 batch-7 tree plus the b7-based twins of 6323124, 742e754, 2ec7e53 and 2a3bb37. The configured Stage 2 (20ee8447) was unchanged.

  • Both internal display DARTs (30a340000 and 30a300000) log J713 internal display DART on the 27.2 image: locked roots kept (mirror). The handoff key finds them through the DCP's iommus and its PIODMA.
  • The internal DCP (30ae00000) gets the same six firmware-segment protections as on the default boot: TEXT 0x5, the rest 0x7. So the table and window checks keep every real region.
  • eDP-1 is connected at 2560x1600, and DPMS off/on passed 3/3.
  • 0 "NOT locked" lines and 0 DART fault or publish-failure lines, including during the DPMS cycles.
  • 0 failed units, Enforcing, 0 AVC.
  • The Air is back on its default and verified.

Before the push: KUnit apple-dart 28/28 (arm64, 16K pages), apple-dcp host suite 27/27, and a W=1 build of apple-dart.o and drm/apple with no warnings.

I also merged the new head forward into #2596 (906db1f). There, the internal and external lookups are now a single helper, apple_dart_serves_v27_dcp(dart, compatible, predicate).

Row files

traces/display/20261122-j713-2590-followups/ on our store (README, base.txt, u3.txt, u3-dmesg.txt). On the default the extra protection lines are the B8 tree's two external DCPs, which this b7-based kernel doesn't carry.

Assisted-by: LLM (Claude:Opus 5.5)

…oard

dcp_check_firmware_version() runs a T8132 internal DCP that the boot
loader handed over with the 27.2 image and its firmware-27 clocks on the
firmware-27 backend wherever it is (apple_t8132_dcp_v27_2(): processor,
image and handoff). apple_dcp_usable() still kept every apple,t8132-dcp
out of the component match unless apple_t8132_firmware_path() held,
which off 26.6.2 is true only for the J713/J715 board names. An M4
MacBook Pro handed over the same way would have probed and never bound.

Admit it on the same handoff predicate. Nothing changes on the Airs
(already on the path), on 26.6.2, or for a DCP without the 27.2 image or
its clocks (a Mac mini's parked main DCP stays out).

The t6041-v27-admission host unit now runs apple_dcp_usable() for the
T8132 internal DCP and dcpext on both paths and asserts it names no
machine; the readiness unit stubs the new helper as unreachable.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
RyanTheTide added a commit that referenced this pull request Nov 21, 2026
…xt/air-dcpext-272

#2596 now carries #2590's 2a3bb37, which keys a 27.2 internal display
DART on its processor's handoff and folds the internal and external
DART checks into one helper, apple_dart_serves_v27_dcp(dart,
compatible, predicate). Resolve:

- include/linux/soc/apple/t8132.h: apple_t8132_internal_dcp_v27_2() is
  gone at the base; keep this branch's comment on
  apple_t8132_dcpext_v27_2() and apple_t8132_dcpext_hdmi_v27_2().
- boot.py: keep this branch's comments, which name both boards.
- apple-dart.c: this branch's apple_dart_serves_t8132_dcpext_v27() call
  becomes apple_dart_serves_v27_dcp(np, "apple,t8132-dcpext",
  apple_t8132_dcpext_v27_2), the same body.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Follow-up pushed (fast-forward, head f4dccbe): apple_dcp_usable() admitted an apple,t8132-dcp only on apple_t8132_firmware_path(), which off 26.6.2 means the J713/J715 board names. It now also admits one that apple_t8132_dcp_v27_2() accepts, the same handoff predicate the backend choice uses, so an M4 MacBook Pro handed over on 27.2 would bind too. No change on the Airs. The admission host unit runs apple_dcp_usable() for the internal DCP and the dcpext on both paths and fails against the previous code; apple-dcp 89/89; W=1 clean.

Rows since your review, on the J713 tip-based default (integration tip + the J713 PR heads incl. this one at 2a3bb37, aura#404, one fleet cmdline, no display parameters): appledrm on eDP-1 2560x1600, backlight max 500, 0 DART faults, 0 "NOT locked", on 7 boots (gate first boot + warm 3/3, then warm 3/3 on the configured default), s2idle 3/3 with the panel bound.

Re-review please when #2541 is ready; the merge order stays #2541 -> this (retargeted) -> #2596.

Assisted-by: LLM (Claude:Opus 5.5)

DjDeveloperr and others added 2 commits November 21, 2026 16:40
Match gate_t8132 on the SoC ("apple,t8132") instead of "apple,j773g"
and drop the hard-coded J773g node path table. The M4 Airs still route
to gate_j713_dcpext_routes() before gate_socs[] is walked.

In gate_t8132_run(), walk apple,t8132-dcpext nodes, select any that
names a fixed "dp-phy" and passes apple_t8132_dcpext_v27_2(), and
derive its chain from its DT phandles (phys, iommus, mboxes, piodma
and piodma's iommus). When the main apple,t8132-dcp is handed over on
27.2 (26B123 image plus apple,clock-ids, e.g. a T8132 laptop with an
internal panel), append the external display DART to disp0's iommus
instead of replacing it; on a headless Mac mini where the main DCP is
not handed over, replace iommus as before.

Add tools/asahi/t8132-display-gate-tests.py (registered in
tools/asahi/run-host-tests.py) covering phandle-derived chain
resolution, replace-vs-append disp0 iommus behavior, and fail-closed
controls.

Signed-off-by: Diljit Singh <hey@djdev.me>
…2-internal

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
RyanTheTide added a commit that referenced this pull request Nov 21, 2026
…p272-j773g-dcpext

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@DjDeveloperr
DjDeveloperr force-pushed the djdev/j773g-272-dcpext0 branch from 9952e46 to bc0067c Compare November 22, 2026 04:39
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Since #2541 was rebased onto integration/aurora, this branch carries #2541's old commits (with Co-Authored-By trailers) and conflicts, so it needs a replacement branch on #2541's current head (or on integration/aurora once #2541 lands) with only this PR's own commits, then CI and a fresh review. The 27.2 internal display DART path (apple-dart.c:5467-5478) still keys on one firmware build through apple_t8132_dcp_v27_2(), the same issue that sent #2596 back to draft; it should keep the roots of any locked T8132 display DART instead.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Replaced by #2818: the same 12 commits replayed onto #2541's current head (bc0067c), without the old #2541 commits in the history. The two context conflicts and one selftest-list fix are described there.

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.

2 participants