Repository navigation
drm/apple, iommu: apple-dart: drive the M4 MacBook Air's internal panel on macOS 27.2 (v27 backend) - #2590
drm/apple, iommu: apple-dart: drive the M4 MacBook Air's internal panel on macOS 27.2 (v27 backend)#2590RyanTheTide wants to merge 26 commits into
Conversation
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
left a comment
There was a problem hiding this comment.
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 andapple,clock-ids, with no board list. That's the direction we want, and it's better than the J773g board check inapple_t8132_dcpext_v27_2().apple_t8132_internal_dcp_v27_2()(t8132.h:63) andj713_v27add another firmware-version key on the DART side. They sit inside the existingapple_t8132_firmware_path()andres->startchecks (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 publishesapple,clock-idson 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_v27fw_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 exactlyregion->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 entriesat 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:
- 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.
- The rest of the driver validates firmware tables first:
- 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->dvaagainst the window first.
- The exact physical-address match makes this harmless, but please check
- "NOT locked: refusing" (:5990) is logged with
dev_info. Make itdev_err. - On 27.2,
j713_displayis cleared before thej713_dcp/j713_displayparameter check (:5502), soapple_dart.j713_dcp=0no longer leaves these DARTs untouched. Please keep that escape hatch on the v27 path too, or say in 0bb4ac7 that it's gone. - The v27 path also drops the
preserve_displayhandling, including theapple,clock-protectionpower gating (apple_dart_dcp_power_off()). That matters for the sleep row you already list. - KUnit: add a region whose two pages have different protections, and check that it stays unchanged.
- 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_v27is set. - The dcp.c changes match only
apple,t8132-dcp. The dcpexts' only compatible isapple,t8132-dcpext.
- The new reserved-region hook returns early unless
- J713 on 26.6.2: it keeps the M4 backend and the borrowed DARTs.
bw_mailboxstays 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-scratchon an enabledt8132-dcp. - The
pmgr_dcpslot lies inside disp-4, the same layout aspmgr_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.
…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>
|
Follow-ups to the review at 29701d0, pushed as three new commits (no force push), head 2ec7e53:
Testing on 2ec7e53:
Still to run: the J713 row is queued with the Air's owner. Kernel 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>
…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>
|
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.
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. |
…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>
|
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 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.
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, Row files
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>
…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>
|
Follow-up pushed (fast-forward, head f4dccbe): 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) |
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>
…p272-j773g-dcpext Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
9952e46 to
bc0067c
Compare
|
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. |
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:
card1-eDP-1.apple-panel-bl0-500 nits; SMC system power goes 3.98 -> 9.98 W across the range.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
Reviewer / agent detail
apple_dart_dcp_validate()->apple_dart_dcp_firmware()accepts 26.6.2 only, so30ae00000.dcphad noiommu_group.__DATA(root 3, leaves 260-462 -> PA 0x103e1874000).__TEXTflags 0x5 (read-only, cacheable), and__DATAplus the four other segments 0x1 (read-write, cacheable). The core maps iommu-addresses regions read-write, and uncached for thisdma-noncoherentDCP, soapple_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.traces/display/20261121-j713-d2-oneshot/andtraces/display/20261121-j713-dcp272-pt/in the lab store.apple_dart.j713_dcp/j713_displayparameters no longer leave these DARTs alone; that is intended, the path needs no parameter. Item 5: the v27 path has noapple,clock-protectionpower gating; s2idle with the panel bound is covered by the rows above, deep sleep is not claimed.Assisted-by: LLM (Claude:Opus 5.5)