Skip to content

drm/apple: dcp: allow 4 KiB alignment for firmware-placed live RTKit buffers - #3552

Merged
RyanTheTide merged 1 commit into
mainfrom
fix/dcp-live-rtkit-4k-align
Nov 29, 2026
Merged

RyanTheTide merged 1 commit into
mainfrom
fix/dcp-live-rtkit-4k-align

Conversation

@sithglan

@sithglan sithglan commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

What: Allow 4 KiB (SZ_4K) alignment for firmware-placed (is_mapped == 1) live RTKit handoff buffers in dcp_rtkit_live_parse() on 16 KiB arm64 kernels while keeping host PAGE_ALIGNED() checks for loader-allocated (is_mapped == 0) buffers, fixing live 27.2 HDMI handoff adoption on J274 (companion PR: aurora-silicon/aura#564).
Tested: J274 (M1 Mac mini, T8103, macOS 27.2.1, 16 KiB kernel) at 46d51a741dcf with aurora-silicon/aura#564 HDMI 1920x1200@60: 231c00000.dcp adopted dcp-live-v1 cleanly (boot scanout retired by displayed swap 3, fb0: appledrmfb, 271c00000.dcp and USB-C Type-C muxes bound, 0 DART faults, 0 failed units) — PASS. KUnit (arm64) apple-dcp-handoff 3/3 passed; scripts/checkpatch.pl 0 errors, 0 warnings.
Risk: two-way · Macs using live RTKit DCP handoff (M1/T8103 J274+). Only relaxes alignment from PAGE_SIZE to SZ_4K for firmware-placed (is_mapped == 1) live RTKit buffers, which still undergo contiguous DART translation, no-map carveout containment, and offset-aware dcp_vmap_wc() checks; loader-allocated buffers keep PAGE_ALIGNED().
Not yet: Non-J274 Macs using live RTKit handoff with 4 KiB-aligned firmware-placed buffers.

Details

Problem

When aura hands off a live 27.2 HDMI DCP session on M1 Mac mini (J274 / T8103, companion PR aurora-silicon/aura#564), apple,rtkit-buffers includes T8103's firmware-placed crashlog buffer (ep=1, iova=0x276000, size=0x10000, is_mapped=1), which sits inside the pre-mapped dcp_data carveout (0xbe6510000+0x300000).

On 16 KiB arm64 kernels, dcp_rtkit_live_parse() unconditionally checks PAGE_ALIGNED(iova) && PAGE_ALIGNED(size) and returns -EINVAL (Invalid live RTKit handoff), aborting apple-drm component bind (which also leaves 271c00000.dcp's USB-C Type-C muxes unbound).

dcp_check_iova_contiguous(), dcp_rtkit_live_carveout(), and dcp_vmap_wc() already handle sub-page offsets cleanly.

Change

  • Extract dcp_rtkit_live_buf_valid() in drivers/gpu/drm/apple/dcp.c:
    • Firmware-placed buffers (is_mapped == 1): require IS_ALIGNED(iova, SZ_4K) && IS_ALIGNED(size, SZ_4K) (matching RTKit's 4 KiB page granularity).
    • Loader-allocated buffers (is_mapped == 0): keep PAGE_ALIGNED(iova) && PAGE_ALIGNED(size) so their no-map reserved-memory regions remain host page-aligned.
  • Add dcp_handoff_live_rtkit_buf_valid KUnit test case to drivers/gpu/drm/apple/dcp_handoff_test.c.
Evidence
  • J274 (M1 Mac mini, T8103, macOS 27.2.1 main OS, 16 KiB kernel) at 46d51a741dcf: cold-booted with HDMI (1920x1200@60) plugged in via companion aura PR display: hand a lit external AFKv2 DCP on running (J274 27.2 HDMI) aura#564 — 231c00000.dcp adopted dcp-live-v1 cleanly (ep=1 iova=0x276000+0x10000 is_mapped=1, ep=2/ep=4 loader-allocated), set_digital_out_mode "1920x1200": 60 (finished:8242), boot scanout retired by displayed swap 3, fb0: appledrmfb, 271c00000.dcp and both USB-C Type-C muxes bound cleanly, 0 DART faults, 0 failed systemd units.
  • KUnit (arm64): apple-dcp-handoff 3/3 passed (dcp_handoff_external_idle, dcp_handoff_boot_notch, dcp_handoff_live_rtkit_buf_valid).
  • scripts/checkpatch.pl: 0 errors, 0 warnings.

…buffers

In dcp_rtkit_live_parse(), every apple,rtkit-buffers entry was checked
with PAGE_ALIGNED(iova) && PAGE_ALIGNED(size). On 16 KiB arm64 kernels,
this rejects firmware-placed (is_mapped == 1) buffers whose RTKit
addresses use 4 KiB granularity inside a pre-mapped firmware carveout —
for example T8103 (M1 Mac mini J274, fw 27.2.1) places the crashlog
buffer (ep 1) at iova 0x276000 (size 0x10000) inside dcp_data
(0xbe6510000+0x300000), causing dcp_rtkit_live_parse() to return -EINVAL
and aborting apple-drm probe when adopting a live HDMI session from
aura.

Both dcp_check_iova_contiguous() and dcp_vmap_wc() already handle
sub-page offsets cleanly (offset_in_page(phys) + multi-page vmap).

Split the validation into dcp_rtkit_live_buf_valid():
- Firmware-placed buffers (is_mapped == 1): require 4 KiB alignment
  (IS_ALIGNED(..., SZ_4K)), matching the RTKit buffer request protocol.
- Loader-allocated buffers (is_mapped == 0): keep host PAGE_ALIGNED()
  so their no-map reserved-memory carveouts never alias neighbouring
  pages.

Add a KUnit test case (dcp_handoff_live_rtkit_buf_valid) in
dcp_handoff_test.c covering firmware-placed 4 KiB buffers,
loader-allocated page alignment, endpoint IDs, flags, size limits, and
address wraparound.

Tested:
- J274 (M1 Mac mini, T8103, macOS 27.2.1 main OS, 16 KiB kernel) booted
  with HDMI (1920x1200@60) via aurora-silicon/aura#564 live handoff
  (dcp-live-v1, ep1 iova=0x276000 size=0x10000 is_mapped=1, ep2/ep4
  loader-allocated): 231c00000.dcp adopted the live RTKit session
  cleanly ("DCP booted", "set_digital_out_mode finished:8242", "boot
  scanout retired by displayed swap 3", fb0 appledrmfb, 0 DART faults,
  0 failed units), 271c00000.dcp and USB-C Type-C muxes bound cleanly.
- KUnit (arm64): apple-dcp-handoff 3/3 passed
  (dcp_handoff_external_idle, dcp_handoff_boot_notch,
  dcp_handoff_live_rtkit_buf_valid).
- scripts/checkpatch.pl: 0 errors, 0 warnings.

Risk: low — only relaxes alignment from PAGE_SIZE to SZ_4K for
firmware-placed (is_mapped == 1) live RTKit buffers, which are still
verified to be contiguously DART-mapped inside a no-map DCP carveout
and mapped via dcp_vmap_wc(). Loader-allocated buffers keep full
PAGE_ALIGNED() enforcement.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan
sithglan requested review from a team as code owners November 28, 2026 17:07

@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: FINISH, then merge at 46d51a74

Blockers:

  1. Update the PR description so pr-text and pr-readiness pass:
    • Add two-way and affected Macs (e.g. Risk: two-way · Macs using live RTKit DCP handoff (M1/T8103 J274+)) to the Risk: line.
    • Include the head SHA 46d51a74 in the Tested: J274 hardware row.
  2. Wait for the 21 queued CI checks at 46d51a74 (apple-build, Apple DRM KUnit, host-tests, pr-text, readiness) to finish green.

Checked:

  • drivers/gpu/drm/apple/dcp.c (dcp_rtkit_live_buf_valid(), dcp_rtkit_live_parse()): cleanly splits alignment checks so firmware-placed live RTKit buffers (is_mapped == 1) require IS_ALIGNED(..., SZ_4K) while loader-allocated buffers (is_mapped == 0) retain PAGE_ALIGNED(), preserving endpoint (1, 2, 4, 8), flag (<= 1), size (1..SZ_16M), and wraparound (iova + size < iova) checks.
  • Verified downstream consumers handle sub-page offsets safely: dcp_check_iova_contiguous() steps by IOMMU pgsize, dcp_rtkit_live_carveout() checks byte-granularity containment inside no-map non-reusable reserved-memory, and dcp_vmap_wc() / dcp_rtkit_live_unmap() handle offset_in_page(phys) cleanly.
  • drivers/gpu/drm/apple/dcp_handoff_test.c: dcp_handoff_live_rtkit_buf_valid thoroughly covers 4 KiB firmware-placed, host page-aligned loader-allocated (PAGE_SIZE > SZ_4K), endpoint, flag, size, and U64_MAX wraparound bounds (3/3 arm64 KUnit PASS, checkpatch.pl 0/0, live J274 16 KiB HDMI 1920x1200@60 boot PASS with 0 DART faults and 0 failed units).
  • Checked for Apple material, tool attribution, and private serials: clean; MERGEABLE on main; human Signed-off-by present. Code is ready to approve as soon as Risk: and the 46d51a74 SHA are updated in the PR description.
Evidence
  • Head: 46d51a74 (base: main, mergeable: MERGEABLE, +45/-3 across 2 files).
  • Inspected dcp_rtkit_live_parse(), dcp_check_iova_contiguous(), dcp_rtkit_live_carveout(), dcp_vmap_wc(), and dcp_rtkit_live_unmap() in drivers/gpu/drm/apple/dcp.c.

@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 28, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Merge readiness at 46d51a74: not ready yet

Check Detail
CI at head no failing: pr-text / pr-text
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok in the PR body at 46d51a74
Conflicts ok none
PR text ok Risk: two-way · Macs using live RTKit DCP handoff (M1/T8103 J274+). Only relaxes alignment from PAGESIZE to SZ4K for firmware-placed (ismapped == 1) live RTKit buffers, which still undergo contiguous DART translation, no-map carveout containment, and offset-aware dcpvmapwc() checks; loader-allocated buffers keep PAGEALIGNED().

Areas: area:display

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: MERGE at 46d51a74

Blockers: None (wait for re-triggered pr-text, readiness, and remaining queued KUnit CI jobs to finish; apple-build, host-tests, kunit, KUnit dcp-fabric, and KUnit dcp-topology are already green).

Checked:

  • Confirmed PR description update at 46d51a741dcf: **What:**, **Tested:** (exact-head J274 M1 Mac mini T8103 27.2.1 16 KiB kernel with aurora-silicon/aura#564 HDMI 1920x1200@60, dcp-live-v1 adopted cleanly, boot scanout retired by displayed swap 3, 271c00000.dcp + Type-C muxes bound, 0 DART faults, 0 failed units, apple-dcp-handoff 3/3 KUnit, checkpatch 0/0), **Risk:** (two-way · Macs using live RTKit DCP handoff (M1/T8103 J274+)), and **Not yet:** are all in place.
  • Previously audited full diff (drivers/gpu/drm/apple/dcp.c, drivers/gpu/drm/apple/dcp_handoff_test.c) at 46d51a74: dcp_rtkit_live_buf_valid() cleanly allows SZ_4K alignment only for firmware-placed (is_mapped == 1) live RTKit buffers (which remain checked by dcp_check_iova_contiguous(), dcp_rtkit_live_carveout(), and offset-aware dcp_vmap_wc()), preserves PAGE_ALIGNED() for loader-allocated (is_mapped == 0) buffers, and adds KUnit coverage in dcp_handoff_live_rtkit_buf_valid.
Evidence
  • drivers/gpu/drm/apple/dcp.c: dcp_rtkit_live_buf_valid() separates is_mapped == 1 (SZ_4K) from is_mapped == 0 (PAGE_SIZE).
  • drivers/gpu/drm/apple/dcp_handoff_test.c: covers aligned and unaligned is_mapped == 0 and is_mapped == 1 cases (3/3 KUnit pass).

@RyanTheTide

Copy link
Copy Markdown
Contributor

code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at 46d51a74. App approved (NEON-PR-REVIEW2), J274 (T8103) row PASS. The RTKit handoff buffer path is shared by every DCP generation, so it needs one more family at this head (e.g. J316s, J413 or J616s: boot with panel/HDMI up and 0 DART faults). Merges under the 6-point rule after that and green CI, unless you object.

@github-actions github-actions Bot added blast:m1 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) and removed needs-hw-row No hardware row at the PR head (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 28, 2026
@erikwb

erikwb commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

J716c (16-inch M5 Max) at 46d51a741dcf: boots, the internal panel's live DCP handoff completes, no DART faults, no regression against the default kernel.

Evidence

Batched kernel 7.3.0-ewb353+ = main 219311530ef0 + #3552 46d51a741dcf + #3566 74b7061e457b + #3567 f75c5e8ecf41 + #2070 81a7880e9f25, each head merged unchanged. One local change: the J716c DTB is built without #include "t6050-media.dtsi" in t6050-j716c.dts, because main since #2278 hangs the J716c at boot (#3618). One-shot trial boot on the default command line plus watchdog.open_timeout=120 (a recovery watchdog for test boots only); compared against the default 7.3.0-ewb342+ on the same Mac and cables.

  • Internal panel: apple-dcp 48ae00000.dcp: boot scanout retired by displayed swap 6, Hyprland up on eDP-1 3456x2234@120.
  • Two external 4K monitors on a CalDigit TS5 come up as on the default kernel (DP-1, DP-4 3840x2160@240, 256-byte EDID, 40 modes each).
  • 0 DART faults. Kernel errors are the same set as the default boot (DCP "undeclared provider clock index 0", one PCIe of_irq_parse_pci pair). Failed units: aurora-peripherals.service only, same as the default boot.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging under the 6-point rule (Ryan 09:29, permanent), at 46d51a74. (1) The review App approved at this head. (2) Full CI is green. Hosted pr-text is still queued; the canonical pr-text.sh passes locally on this body. (3/4) Rows: J274+J716c(erikwb). (5) There's no blocking review. (6) Dj was pinged here 889 min ago with no objection. Revert: git revert -m 1 <merge>.

@RyanTheTide
RyanTheTide merged commit 09b5402 into main Nov 29, 2026
21 of 26 checks passed
@RyanTheTide
RyanTheTide deleted the fix/dcp-live-rtkit-4k-align branch November 29, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:display Area from CODEOWNERS (bot) blast:m1 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants