Repository navigation
drm/apple: dcp: allow 4 KiB alignment for firmware-placed live RTKit buffers - #3552
Conversation
…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>
There was a problem hiding this comment.
Verdict: FINISH, then merge at 46d51a74
Blockers:
- Update the PR description so
pr-textandpr-readinesspass:- Add
two-wayand affected Macs (e.g.Risk: two-way · Macs using live RTKit DCP handoff (M1/T8103 J274+)) to theRisk:line. - Include the head SHA
46d51a74in theTested:J274 hardware row.
- Add
- 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) requireIS_ALIGNED(..., SZ_4K)while loader-allocated buffers (is_mapped == 0) retainPAGE_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 IOMMUpgsize,dcp_rtkit_live_carveout()checks byte-granularity containment insideno-mapnon-reusablereserved-memory, anddcp_vmap_wc()/dcp_rtkit_live_unmap()handleoffset_in_page(phys)cleanly. drivers/gpu/drm/apple/dcp_handoff_test.c:dcp_handoff_live_rtkit_buf_validthoroughly covers 4 KiB firmware-placed, host page-aligned loader-allocated (PAGE_SIZE > SZ_4K), endpoint, flag, size, andU64_MAXwraparound bounds (3/3arm64 KUnit PASS,checkpatch.pl0/0, live J274 16 KiB HDMI1920x1200@60boot PASS with 0 DART faults and 0 failed units).- Checked for Apple material, tool attribution, and private serials: clean;
MERGEABLEonmain; humanSigned-off-bypresent. Code is ready to approve as soon asRisk:and the46d51a74SHA are updated in the PR description.
Evidence
- Head:
46d51a74(base: main,mergeable: MERGEABLE,+45/-3across 2 files). - Inspected
dcp_rtkit_live_parse(),dcp_check_iova_contiguous(),dcp_rtkit_live_carveout(),dcp_vmap_wc(), anddcp_rtkit_live_unmap()indrivers/gpu/drm/apple/dcp.c.
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
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 withaurora-silicon/aura#564HDMI1920x1200@60,dcp-live-v1adopted cleanly,boot scanout retired by displayed swap 3,271c00000.dcp+ Type-C muxes bound,0DART faults,0failed units,apple-dcp-handoff3/3 KUnit,checkpatch0/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) at46d51a74:dcp_rtkit_live_buf_valid()cleanly allowsSZ_4Kalignment only for firmware-placed (is_mapped == 1) live RTKit buffers (which remain checked bydcp_check_iova_contiguous(),dcp_rtkit_live_carveout(), and offset-awaredcp_vmap_wc()), preservesPAGE_ALIGNED()for loader-allocated (is_mapped == 0) buffers, and adds KUnit coverage indcp_handoff_live_rtkit_buf_valid.
Evidence
drivers/gpu/drm/apple/dcp.c:dcp_rtkit_live_buf_valid()separatesis_mapped == 1(SZ_4K) fromis_mapped == 0(PAGE_SIZE).drivers/gpu/drm/apple/dcp_handoff_test.c: covers aligned and unalignedis_mapped == 0andis_mapped == 1cases (3/3KUnit pass).
|
code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at |
|
J716c (16-inch M5 Max) at EvidenceBatched kernel
|
|
Merging under the 6-point rule (Ryan 09:29, permanent), at |
What: Allow 4 KiB (
SZ_4K) alignment for firmware-placed (is_mapped == 1) live RTKit handoff buffers indcp_rtkit_live_parse()on 16 KiB arm64 kernels while keeping hostPAGE_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
46d51a741dcfwith aurora-silicon/aura#564 HDMI1920x1200@60:231c00000.dcpadopteddcp-live-v1cleanly (boot scanout retired by displayed swap 3,fb0: appledrmfb,271c00000.dcpand USB-C Type-C muxes bound,0DART faults,0failed units) — PASS. KUnit (arm64)apple-dcp-handoff3/3 passed;scripts/checkpatch.pl0 errors, 0 warnings.Risk: two-way · Macs using live RTKit DCP handoff (M1/T8103 J274+). Only relaxes alignment from
PAGE_SIZEtoSZ_4Kfor firmware-placed (is_mapped == 1) live RTKit buffers, which still undergo contiguous DART translation,no-mapcarveout containment, and offset-awaredcp_vmap_wc()checks; loader-allocated buffers keepPAGE_ALIGNED().Not yet: Non-J274 Macs using live RTKit handoff with 4 KiB-aligned firmware-placed buffers.
Details
Problem
When
aurahands off a live 27.2 HDMI DCP session on M1 Mac mini (J274 / T8103, companion PR aurora-silicon/aura#564),apple,rtkit-buffersincludes T8103's firmware-placed crashlog buffer (ep=1,iova=0x276000,size=0x10000,is_mapped=1), which sits inside the pre-mappeddcp_datacarveout (0xbe6510000+0x300000).On 16 KiB arm64 kernels,
dcp_rtkit_live_parse()unconditionally checksPAGE_ALIGNED(iova) && PAGE_ALIGNED(size)and returns-EINVAL(Invalid live RTKit handoff), abortingapple-drmcomponent bind (which also leaves271c00000.dcp's USB-C Type-C muxes unbound).dcp_check_iova_contiguous(),dcp_rtkit_live_carveout(), anddcp_vmap_wc()already handle sub-page offsets cleanly.Change
dcp_rtkit_live_buf_valid()indrivers/gpu/drm/apple/dcp.c:is_mapped == 1): requireIS_ALIGNED(iova, SZ_4K) && IS_ALIGNED(size, SZ_4K)(matching RTKit's 4 KiB page granularity).is_mapped == 0): keepPAGE_ALIGNED(iova) && PAGE_ALIGNED(size)so theirno-mapreserved-memory regions remain host page-aligned.dcp_handoff_live_rtkit_buf_validKUnit test case todrivers/gpu/drm/apple/dcp_handoff_test.c.Evidence
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.dcpadopteddcp-live-v1cleanly (ep=1 iova=0x276000+0x10000 is_mapped=1,ep=2/ep=4loader-allocated),set_digital_out_mode "1920x1200": 60(finished:8242),boot scanout retired by displayed swap 3,fb0: appledrmfb,271c00000.dcpand both USB-C Type-C muxes bound cleanly,0DART faults,0failed systemd units.arm64):apple-dcp-handoff3/3 passed (dcp_handoff_external_idle,dcp_handoff_boot_notch,dcp_handoff_live_rtkit_buf_valid).scripts/checkpatch.pl: 0 errors, 0 warnings.