Skip to content

kboot: give a firmware-placed live RTKit buffer the carveout the binding needs - #605

Merged
RyanTheTide merged 8 commits into
fix/584-dart-three-tablesfrom
fix/584-live-fw-buffer-carveout
Dec 1, 2026
Merged

RyanTheTide merged 8 commits into
fix/584-dart-three-tablesfrom
fix/584-live-fw-buffer-carveout

Conversation

@satchlj

@satchlj satchlj commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

On the M5 Max Mac Studio (J775c), Stage 2 hands dcpext0 (HDMI) over running and describes its RTKit session, but the kernel refuses it:

FDT: dcpext0: live RTKit session v12, 3 system buffer(s), epmap 0000011d 00823f3f
OF: reserved mem: ... dcpext0-rtkit-ep4@1000e5c0000
OF: reserved mem: ... dcpext0-rtkit-ep2@1000e5d0000
apple-dcp 2b2e00000.dcp: error -EINVAL: Invalid live RTKit handoff
apple-dcp 2b2e00000.dcp: external display processor unusable (bind failed: -22); the other displays go on without it

The third buffer is the OSLog buffer the T6050 external DCP firmware places itself (rtkit(dcp): pre-allocated oslog buffer (dva 0x100039b4000, phys 0x10fd71dc000, size 0x5ff8)), in memory the DT does not describe. The apple,dcp binding requires every apple,rtkit-buffers entry to lie in a no-map region the DCP's memory-region names, mapped there through iommu-addresses; dt_publish_live_rtkit() gave one only to loader-allocated buffers and assumed the DT already describes the firmware's carveout, as it does for the M1 Mac mini (J274) DCP's crashlog in dcp_data (the working reference, #564 and aurora-silicon/linux 46d51a741dcf).

This gives a firmware-placed buffer that no such region already holds one of its own: the whole 16K pages it touches, at the IOVA of their start. The firmware DMAs into those pages, so they are never the kernel's to use. A buffer whose address and IOVA sit at different offsets in a page cannot be mapped that way and stops the boot, like the other descriptions that cannot be made. The buffer is still published exactly as the firmware gave it (OSLog states its size in bytes).

The kernel side, aurora-silicon/linux#3689 (on #3686), takes a firmware-placed OSLog buffer whose size is not a whole page, as RTKit itself does; both are needed for the J775c handoff.

Stacked on #602.

Tested: tests/python at the PR head on macOS (1501 passed, 60 skipped); test_live_rtkit_description.py covers a firmware buffer inside a DT carveout (no new region), the J775c OSLog shape outside the DT (a 0x8000 no-map region at the page-aligned IOVA, buffer published as 0x5ff8), and a buffer whose pages cannot map (boot stops, nothing described). clang-format clean. Not yet run on hardware: the J775c row with linux#3689 is next; draft until then.
Risk: two-way door. Only adds reserved-memory regions for firmware-placed live RTKit buffers that no existing DCP carveout holds; Macs whose firmware buffers already sit in a DT carveout (M1 Mac mini) get the same tree as before.

@satchlj

satchlj commented Nov 30, 2026

Copy link
Copy Markdown
Member Author

J775c: HDMI works end to end with this stack plus linux#3686/#3689 and the #3682 DT: apple-dcp adopts the live dcpext0 session, HDMI-A-1 connected 2560x1440, boot scanout retired, apple-mcc enables SLC (GPU bandwidth back to 716/863 GB/s at d4/d8). Full row: aurora-silicon/linux#3689 (comment)

Firmware 27 can advertise both dptx-port endpoints, 0x2a and 0x2c, and
serve the AppleDCPDPTXRemotePort service on either. dcp_dptx_init() took
0x2a whenever it was advertised. On the J775c dcpext0 the RemotePort
service is on 0x2c (dcpdptx-port-epic, units 0 and 1, in macOS's
IORegistry) and 0x2a carries DCPDPService, which announced nothing while
the AP started the ports. RTKit on that DCP has no timeout, so
afk_epic_start_interface() waited on 0x2a without end: the Stage 2
console stopped at the second pair of "AFK: adopted" lines (0x2a's rings)
until the trial watchdog reset the machine.

Where both are advertised, start both and keep the one whose firmware
announces a service the dptx-port ops take; stop the other before the
ports are opened. Where one is advertised, or neither, nothing changes.
Which endpoint is bound still selects the v27 message layout.

AFK:

 - afk_epic_select_interface(): of several endpoints started for one
   interface, the first whose firmware announces a service it has ops
   for. Announcements before the match are dropped and logged; the
   matching one stays queued for afk_epic_start_interface(). It waits as
   long as afk_epic_start_interface() does.
 - The announcement decoding moves out of afk_epic_start_interface()
   into afk_epic_decode_announce(), shared by both; what is accepted is
   unchanged.
 - Candidates start with no notification handler, which would take
   their announcements; afk_epic_set_notify() turns it on once the ports
   are open.
 - The waits that have no bound when RTKit has no timeout now say so
   after a second and every five seconds: the first service announcement
   ("EPIC: still waiting after Ns for a service announcement on endpoint
   ..."), and a blocking poll with no IOP message ("EPIC: no message from
   the IOP for Ns, waiting on endpoint ..."), which covers the START and
   SHUTDOWN acknowledgements. The waits themselves are unchanged.

Signed-off-by: Satya Benson <satya@benson.earth>
…ing needs

The kernel takes over a DCP handed on running only if every buffer in
apple,rtkit-buffers lies in a no-map region the DCP's memory-region
names, mapped there through iommu-addresses (the apple,dcp binding). A
loader-allocated buffer always gets one. A firmware-placed buffer got
none, on the assumption that the DT already describes the firmware's
carveout, as it does for the M1 Mac mini (J274) DCP's crashlog in dcp_data.

The T6050 external DCPs' firmware places its OSLog buffer itself
(0x5ff8 bytes) in memory the DT does not describe, so the kernel
refused the whole session and the external display processor stayed
unbound.

Give a firmware-placed buffer that no such region already holds one of
its own: the whole 16K pages it touches, at the IOVA of their start,
which the firmware DMAs into and the kernel must never use. A buffer
whose pages cannot map that way (its address and IOVA at different
offsets in a page) stops the boot like the other descriptions that
cannot be made. The buffer itself is still published as the firmware
gave it.

Signed-off-by: Satya Benson <satya@benson.earth>
@satchlj
satchlj force-pushed the fix/584-live-fw-buffer-carveout branch from a6130e4 to f8d4f63 Compare November 30, 2026 15:32
@satchlj

satchlj commented Nov 30, 2026

Copy link
Copy Markdown
Member Author

rebased onto fix/584-dptx-port-endpoint 83946b1: old head a6130e4, new head f8d4f63, conflicts in src/kboot.c and tests/python/test_live_rtkit_description.py (main split publishing into dt_publish_one_live_rtkit(); the carveout check now runs in it for every published DCP).

@satchlj

satchlj commented Nov 30, 2026

Copy link
Copy Markdown
Member Author

J775c (M5 Max Studio) row for the rebased stack at these heads: #589 a81571f6, #590 0b82cba4, #591 f7771e54, #592 d86af18d, #597 85982071, #602 83946b1d, #605 f8d4f63e, all on main f380f03c. Trial Stage 2 is lab/584-rebased-trial c9cb7a0c = this stack + #587 + #338 (raw image sha256 9473514e…). Only Stage 2 changed from this Mac's default. The kernel is the packaged linux-aurora (linux main e6c7b032 + linux#3686/#3689/#3682), Stage 1 is main 1e01a273 NO_DISPLAY, firmware 27.2.

Stage 2:

dart: /arm-io/dart-dcpext0: three-table stream, vm-base 0x10000000000, 1 root entry
dcp-dptx: endpoint 0x2c announces the dptx-port service
display: swapped! (swap_id=0)
DCP: T6050: dcpext0 handed off with the display subsystem: firmware 27.0, framebuffer 0x10fd805c000+0x854000
DCP: T6050: dcpext1 handed off: bw-scratch 0x30000
FDT: dcpext0: live RTKit session v12, 3 system buffer(s), epmap 0000011d 00823f3f
Preparing to boot kernel at 0x10004400000 with fdt at 0x1000eb80000

Linux: HDMI-A-1 connected 2560x1440, boot scanout retired by displayed swap 3, system level cache allocation enabled on 32 planes, 0 failed units, Wi-Fi up, and it returned to the saved default unaided. GPU bandwidth d4/d8 742/856 GB/s, render tri d1/d8 133.3/23.9 µs, llama-2-7B Q4_0 pp512 3,088 / tg128 110.7. That matches the pre-rebase stack within run-to-run spread.

@satchlj
satchlj marked this pull request as ready for review November 30, 2026 15:41
@satchlj
satchlj requested review from a team as code owners November 30, 2026 15:41
@satchlj
satchlj requested review from Acelogic and malik-na November 30, 2026 15:41
@github-actions github-actions Bot added blast:m1 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 30, 2026
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Merge readiness at 156b8427: ready to merge

Check Detail
CI at head ok 12 checks passed
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok comment at 6b52b129; the changed files are byte-identical at 156b8427
Conflicts ok none
PR text ok Risk: two-way · . Only adds reserved-memory regions for firmware-placed live RTKit buffers that no existing DCP carveout holds; Macs whose firmware buffers already sit in a DT carveout (M1 Mac mini) get the same tree as before.

Areas: none matched in CODEOWNERS
Merge: gh pr merge 605 --merge (Owners and Core through the bypass: add --admin).

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: HOLD at f8d4f63e

Blockers:

  • Stacked on open PR #591: targets feature branch fix/584-dptx-port-endpoint (which currently has open changes requested on rtkit_access_remote() cache maintenance). Code, tests, hosted CI, and exact-head J775c hardware row for #605 itself are clean and ready once #591 is resolved and rebased/merged.

Checked:

  • Audited src/kboot.c (dt_live_rtkit_covered(), dt_publish_one_live_rtkit()) and tests/python/test_live_rtkit_description.py (+117/-6).
  • Verified dt_live_rtkit_covered() checks memory-region phandles for 2-cell u64 reg, no-map present, reusable absent, and overflow-free containment (phys >= base && size <= rsize && phys - base <= rsize - size).
  • Verified dt_publish_one_live_rtkit() validates every uncovered firmware-placed buffer before mutating the DT (non-zero phys, matching SZ_16K page offset between phys and iova, b->iova >= off, overflow guard on phys), aligns the reserved region to full 16 KiB pages (phys -= off, iova -= off, size = ALIGN_UP(b->size + off, SZ_16K)), and keeps apple,rtkit-buffers published verbatim with the firmware's byte size.
  • Verified test_live_rtkit_description.py covers existing dcp_data carveout preservation, T6050 OSLog 0x5ff8 -> 0x8000 region creation, and fail-hard rejection without partial DT mutation on skewed page offsets.
  • Hosted CI is green at f8d4f63e (8/8 checks passed: policy, ESP stage 2 vital size, selftest, pr-text, readiness), and exact-head J775c row (#605#issuecomment-7283295510) confirmed dcpext0 live RTKit handoff with 3 system buffers, HDMI-A-1 connected 2560x1440, SLC enabled on 32 planes, 0 failed units.
Evidence
  • Head SHA: f8d4f63ece945b0a735a1f9b30454db6fa7779fe (base=fix/584-dptx-port-endpoint, MERGEABLE, 8P/0F/0Q CI).
  • Non-blocking nit: dt_publish_one_live_rtkit() checks b->phys > UINT64_MAX - (b->size + off + SZ_16K) against u64 wraparound, but not the symmetric b->iova > UINT64_MAX - (b->size + off + SZ_16K) (harmless on real DART IOVAs well below 64-bit max).

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

Verdict: MERGE at f8d4f63e, after the PRs under it land.

Blockers: none in this PR.

Checked: only firmware-placed buffers that no no-map, non-reusable memory-region of the DCP already holds get a new region. The containment check can't overflow. On the M1 Mac mini, the crashlog sits in dcp_data, so it takes the unchanged path, and your host test covers that shape. The new region is the whole 16K pages at the IOVA of their start. It's refused unless the address and IOVA share their page offset, and every buffer is checked before the tree is touched. The buffer is still published at the firmware's byte size. The J775c row for the rebased stack is at this head with linux#3689. It shows the live RTKit session described and Linux driving HDMI 2560x1440 from dcpext0.

Note (not blocking)

The PR body still says "not yet run on hardware … draft until then" and has no What/Tested/Risk/Not yet sections. The stack row above is that run, so the body can say so.

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 30, 2026

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at f8d4f63ece94

Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.

Checked: - Audited src/kboot.c (dt_live_rtkit_covered(), dt_publish_one_live_rtkit()) and tests/python/test_live_rtkit_description.py (+117/-6).

  • Verified dt_live_rtkit_covered() checks memory-region phandles for 2-cell u64 reg, no-map present, reusable absent, and overflow-free containment (phys >= base && size <= rsize && phys - base <= rsize - size).
  • Verified dt_publish_one_live_rtkit() validates every uncovered firmware-placed buffer before mutating the DT (non-zero phys, matching SZ_16K page offset between phys and iova, b->iova >= off, overflow guard on phys), aligns the reserved region to full 16 KiB pages (phys -= off, iova -= off, size = ALIGN_UP(b->size + off, SZ_16K)), and keeps apple,rtkit-buffers published verbatim with the firmware's byte size.
  • Verified test_live_rtkit_description.py covers existing dcp_data carveout preservation, T6050 OSLog 0x5ff8 -> 0x8000 region creation, and fail-hard rejection without partial DT mutation on skewed page offsets.
  • Hosted CI is green at f8d4f63e (8/8 checks passed: policy, ESP stage 2 vital size, selftest, pr-text, readiness), and exact-head J775c row (#605#issuecomment-7283295510) confirmed dcpext0 live RTKit handoff with 3 system buffers, HDMI-A-1 connected 2560x1440, SLC enabled on 32 planes, 0 failed units.

Follow-ups (not blocking): Merge parent #591 first; follow-ups: symmetric iova overflow check nit

Signed-off-by: Satya Benson <satya@benson.earth>
…-carveout

Signed-off-by: Satya Benson <satya@benson.earth>
@satchlj

satchlj commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

Merged main 2a7854a via the branch below, no conflicts.

@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) and removed ready-to-merge Meets the merge policy: merge it (bot) labels Dec 1, 2026
@satchlj

satchlj commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

Merged #602 (5d3b1f39) -> head 6b52b129 (43/43 host tests pass). Updated J775c Stage 2 hardware row will follow once the build completes.

@satchlj

satchlj commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

J775c (M5 Max) row: a Stage 2 built from aura main 2a7854a3 with #590→#605 merged at their current heads (built tree 6b52b129, reports 1.0.0b17-g6b52b129), trial boot on the default command line: Stage 2 handed dcpext0 over live, apple-drm bound 2b2e00000.dcp, HDMI connected (console and greeter), SLC enabled, 0 failed units; the reboot out returned to the default unaided.

@satchlj

satchlj commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

J775c (M5 Max Studio) Stage 2 hardware row at the updated heads: #591 ece3e344, #592 f086b09c, #597 0bc4529b, #602 5d3b1f39, #605 6b52b129 on main 378497cf (Stage 2 built cleanly from main + this stack: 1.0.0b17-g6b52b129, raw aura.bin sha256 2a7f7410…; Stage 1 1e01a273 NO_DISPLAY, system firmware 27.2, kernel 7.3.0-1-46.5-ARCH, default command line):

  • One-shot Stage 2 trial booted cleanly and returned unaided to default.
  • apple-drm display-subsystem: bound 2b2e00000.dcp (ops dcp_comp_ops [appledrm])
  • HDMI-A-1 status: connected
  • apple-mcc 2220000000.memory-controller: system level cache allocation enabled on 32 planes
  • systemctl --failed: 0 failed units.

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed needs-hw-row No hardware row at the PR head (bot) labels Dec 1, 2026
@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed ready-to-merge Meets the merge policy: merge it (bot) labels Dec 1, 2026
@RyanTheTide
RyanTheTide changed the base branch from fix/584-dptx-port-endpoint to fix/584-dart-three-tables December 1, 2026 11:34
@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging at 156b842753e6 (B2 merge train, 12-01 merge bar). Approval at this head: DjDeveloperr,aurora-silicon-review[bot]. Row: J775c (M5 Max Studio) Stage 2 row for the whole stack (satchlj, on #591; heads since then only merge main). CI: aura train A3 = main f6d78b6 + #591 #592 #597 #602 #605 (candidate 548f83df): gcc normal + ESP_STAGE2 pass, no new warnings; pytest 1749 passed / 0 failed. Hosted CI is queued behind the backlog. Revert: git revert -m 1 <merge commit>.

@RyanTheTide
RyanTheTide merged commit 0ad6c96 into fix/584-dart-three-tables Dec 1, 2026
14 of 16 checks passed
@RyanTheTide
RyanTheTide deleted the fix/584-live-fw-buffer-carveout branch December 1, 2026 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blast:m1 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants