Repository navigation
drm/apple, iommu: apple-dart: drive the M4 MacBook Air's internal panel on macOS 27.2 (v27 backend, on #2541's rebase) - #2818
RyanTheTide wants to merge 12 commits into
Conversation
…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>
…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>
…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>
…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>
…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>
|
Open item before this is ready, from Dj's review of #2596 (same pattern here): The two internal display DARTs get What the J713 reports (PROTECT bit 0, 27.2 stub, from our boot logs): seven T8132 DARTs are locked. Six are display DARTs: dcpext0/dispext0 286340000/286300000, dcpext1/dispext1 48a340000/48a300000, and the internal 30a340000/30a300000. The seventh is the PMP DART 380300000 (protect 0x1e7, serving Plan: key Converted to draft until then. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial pre-PR checklist review (§1–§6) at verified live head a912b89b3c469d92a3dd00c9a812533fd053fa42: requesting changes for a real runtime-PM bug in __apple_dart_j713_v27_fw_prot(), the §1 firmware-build gating of T8132 fw_mirror (which you also noted when converting to Draft), and missing CI / rebased-head hardware evidence.
Blockers
-
Code bug — MMIO read after
pm_runtime_put()(drivers/iommu/apple-dart.c:4600-4607):if (pm_runtime_resume_and_get(dart->dev) < 0) return; ttbr = apple_dart_readl(dart, DART_TTBR(dart, sid, 0)); pm_runtime_put(dart->dev); if (!(ttbr & dart->hw->ttbr_valid) || (dart->hw->tcr_4level && (apple_dart_readl(dart, DART_TCR(dart, sid)) & dart->hw->tcr_4level))) return;
pm_runtime_put(dart->dev)releases the runtime-PM reference beforeapple_dart_readl(dart, DART_TCR(dart, sid))runs. Onapple_dart_hw_t8110,tcr_4levelis non-zero (DART_T8110_TCR_FOUR_LEVEL), andapple_dart_probe()drops its probe PM ref at line 6280 for non-borrowed/non-MTP DARTs (j713_display_v27), sodart->devcan runtime-suspend beforeDART_TCRis read. Read bothttbrandtcrbefore callingpm_runtime_put(dart->dev). -
§1 (No firmware-version gating in DART
fw_mirror):
apple_dart_serves_t8132_dcp_v27()(drivers/iommu/apple-dart.c:5485-5499) keys T8132fw_mirroranddart->j713_v27onapple_t8132_dcp_v27_2()(hardcoding27.2.0+ the26B123UUID), rather than decidingfw_mirrorfrom the DART's own hardware state (locked && !fw_handoff && !borrowed) as T6041/T6050/T8140/T8142 already do. Any subsequent 27.x firmware build would losefw_mirrorand fail to attach the internal panel. Agreed with your Draft comment's plan to key T8132fw_mirroronlocked && !fw_handoff && !borrowed(and verify the PMP DART380300000is unaffected on hardware). Similarly, generalize the live-leaf firmware-segment protection hook from a J713/27.2-specific flag (dart->j713_v27) so it does not require per-build/per-board opt-in. -
Stack, CI & §5 evidence:
- Currently Draft, stacked on unmerged Draft
#2541(djdev/j773g-272-dcpext0), with 0 CI runs executed ona912b89b. Needs#2541landed, retargeted ontointegration/aurora, and green CI (dt-checks,host-tests). - Once reworked, post a fresh J713 hardware row on clean
integration/aurora+ this PR proving: (a) internal panel (eDP-1, backlight, DPMS, s2idle, 0 DART faults, 0 failed units, 0 AVC, 0 new kernel errors), (b) PMP DART380300000/ PMP reports unchanged underfw_mirror, and (c) J713 26.6.2 borrowed-path regression check.
- Currently Draft, stacked on unmerged Draft
What Checks Out (§2, §3, §4, §6)
- §2 (No hacks): Runs on the default kernel command line with no new parameters.
- §3 (Memory safety & other SoCs): Aside from the
pm_runtime_put()ordering bug above,__apple_dart_j713_v27_fw_prot()validates roots viaapple_dart_fw_table_ram(), leaf tables viaapple_dart_fw_table_decode(), overflow-safe window bounds vialocked_window[sid], exact PA matches, and uniform page protections (never widening beyond the live leaves, failing closed on mismatch).iomfb_m4.cgatingbw_mailboxonif (external)preserves 26.6.2 behavior;t8132-dcp.dtsipmgr_dcpslot (0x382820000) andt8132-j713.dtspanelgeometry (290x189/181 mm,500nits) check out. Non-T8132 SoCs and J773g's idle main DCP are unaffected.#2819stacks cleanly on top. - §4 (Clean-room & attribution): Clean. All 12 commits carry human identity (
Ryan Murray) and humanSigned-off-by:with zero AI trailers (old#2541Co-Authored-Byhistory from#2590is cleanly gone); PR body includesAssisted-by:. - §6 (Naming): Clean.
Assisted-by: LLM (Gemini 4 Neon)
|
Review at a912b89.
|
|
J713 row (M4 MacBook Air, macOS 27.2 stub), one-shot boot of integration/aurora f1d5b24 merged with this stack (#2819 head 888805b on #2818 a912b89). Default kernel command line, unchanged Stage 2:
|
Problem
#2590 (the M4 MacBook Air's internal panel on the macOS 27.2 stub) can no longer be merged. It was stacked on an older head of #2541, and #2541 has since been rebased onto integration (3 commits dropped as landed via #2688, the rest adapted to the landed helpers). #2590's history also still carries #2541's old commits through two merges.
Change
Same series as #2590, replayed onto #2541's current head (bc0067c). This replaces #2590.
git range-diffshows=), apart from two context conflicts:selftests: apple-dcp: boot: the PASS list now has drm/apple, soc: apple: drive the M4 Mac mini's (J773g) HDMI from dcpext0 on macOS 27.2 (v27 backend) #2541's T8122/T8132 lines next to the internal-DCP line.iommu: apple-dart: keep a 27.2 J713 internal display DART's locked roots:apple_t8132_internal_dcp_v27_2()is now added above drm/apple, soc: apple: drive the M4 Mac mini's (J773g) HDMI from dcpext0 on macOS 27.2 (v27 backend) #2541's rewordedapple_t8132_dcpext_v27_2()comment.What the series does is unchanged from #2590:
apple_dcp_usable()lets a T8132 internal DCP handed over this way join the DRM device on any board.Testing
t6041_v27_admissionharness now extracts nameddisplay.hhelpers, so the boot selftest commit addsapple_t8132_dcp_v27_2to that list (otherwise its cases don't compile).Still to run
Reviewer / agent detail
git range-diff de2c2969..dde724cb bc0067c7..a912b89b: 10 of 12=, 2!(context only, above). drm/apple, iommu: apple-dart: drive the M4 MacBook Air's internal panel on macOS 27.2 (v27 backend) #2590's review history and the root-cause notes are on drm/apple, iommu: apple-dart: drive the M4 MacBook Air's internal panel on macOS 27.2 (v27 backend) #2590 and still apply.traces/display/20261123-j713-disp3/in the lab store.Assisted-by: LLM (Claude:Opus 5.5)