Repository navigation
drm/apple: iomfb_v27: skip 8-byte D003 slot metadata on doorbell dashboards - #3830
Conversation
…boards The extended firmware-27 D003 bandwidth reply encodes an 8-byte slot offset and size for PMP PTD update-window dashboards (such as T6030). Hardware with a separate apple,bw-doorbell register instead uses 4-byte PMGR dashboard slots (for example T8103 at disp-5 offsets 0x14 and 0x18). Writing scratch_offset = 0x14 and scratch_size = 8 for a doorbell-backed 4-byte slot causes the T8103 internal DCP to fault on M3 power-down during set_power_state(0) (deep sleep or eDP-1 DPMS-off) with a 64-bit write alignment fault in device memory (ESR=0x96000061, FAR=0xffffffff1018c014) and crash RTKit. Pass dcp->disp_bw_doorbell_index != 0 into dcp_v27_rt_bw_reply(). When a separate doorbell register is present, validate 4-byte alignment and window bounds, clear the extended reply, and encode only reply->config with zero slot offset and size. For non-doorbell 8-byte slots, also require 8-byte offset alignment before emitting the 8-byte slot fields. Add KUnit tests for doorbell-backed extended replies and unaligned non-doorbell offsets. Fixes: 8f9a1eb ("drm/apple: fill the extended firmware-27 D003 bandwidth reply") Fixes: bdff788 ("drm/apple: iomfb_v27: validate the D003 bandwidth request and reply sizes") Signed-off-by: Erik Bourget <erik@ebourget.net>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Reviewed the D003 reply sizes and the separate-doorbell test at this head. Doorbell indices are populated after the mandatory display registers, so zero still means no separate doorbell. The 4-byte case clears the extended slot words, aligned 8-byte replies retain their metadata, and the short reply keeps its old path. The J313 result covers the reported regression. Hosted checks and peer smoke remain pending.
|
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 af1d77f
Checked:
- Doorbell detection:
disp_bw_doorbell_indexis set only bydcp_get_bw_doorbell_reg(), tocountafter the scratch window was added, so it is ≥1 wheneverapple,bw-doorbellwas parsed.!= 0is a correct "has doorbell" test.- The
hw.firmware_clockpath (T8140 internal/external) fillsdisp_bw_doorbell_resbut never the index, so it keeps the 8-byte reply. Its offsets (0x20000,0x28000) are 8-byte aligned, so the new alignment check doesn't refuse them.
- The
- Every DT at this head:
apple,bw-doorbellexists only on t8103, t8140 and t8142.- Doorbell path: t8103 offsets
0x14/0x18and t8142 offset0pass the 4-byte check. - T8142's 0x2c reply goes from (0, 8) under #3327 back to (0, 0), the pre-#3327 reply.
- Non-doorbell 8-byte path: every
apple,bw-scratchoffset is 8-byte aligned (t600x/t602x/t603x/t604x/t605x, and t81120x5d8/0x5e0). The newIS_ALIGNED(offset, 8)refuses nothing that #3327 accepted, so J516s and the T8112 replies are byte-for-byte unchanged. The addedmemsetis a no-op there, because the trampoline already clears the reply.
- Doorbell path: t8103 offsets
- Short 0x14 reply: untouched (the M5 Pro asks for 0x14 per #3327's traces).
- Evidence: the J313 bisect + exact-head DPMS/deep-sleep row matches the reported fault (FAR at
base+0x14, an 8-byte store to a 4-byte PMGR register).
Follow-ups (non-blocking): T8142 (J813) exact-head DPMS + s2idle row, since that is the one other SoC whose reply changes (back to the pre-#3327 reply).
|
Row: af1d77f (+ main cd5cb04 + #3829) + J473 Mac mini M2 (T8112, non-doorbell path) + PASS: DPMS off/on and s2idle with 0 DCP crashes and 0 malformed-D003 warnings. No-regression row for the unchanged non-doorbell reply.
|
|
J516s (T6030, M3 Pro) hardware verification PASS for
|
What: Skip writing the 8-byte
scratch_offsetandscratch_sizefields in the extended (0x2c-byte) firmware-27 D003 bandwidth reply whenapple,bw-doorbellis present, and require 8-byte offset alignment for non-doorbell 8-byte slots. This fixes an internal DCP RTKit crash (ESR=0x96000061,FAR=0xffffffff1018c014) on T8103 duringset_power_state(0)(deep sleep andeDP-1DPMS-off) introduced by #3327.Tested: J313 M1 MacBook Air (T8103, firmware-27 DCP, docked with CalDigit TS5) at
af1d77fc4081: boot,eDP-1DPMS off/on, and docked deep sleep (rtcwake -d /dev/rtc1 -m mem -s 10) all pass with zero DCP crashes (suspend_stats/success=1). KUnitapple-dcp-v27(8/8 passed) andcheckpatch.pl --strict(0 errors, 0 warnings).Risk: two-way door · T8103 (M1) and any doorbell-backed firmware-27 DCP requesting a 0x2c-byte D003 reply; non-doorbell 8-byte PMP PTD dashboards (such as T6030 / M3 Pro) keep their exact #3327 reply, and 0x14-byte short replies are unchanged.
Not yet: J516s (T6030) hardware re-verification of the unchanged non-doorbell extended reply, and T8142 (doorbell-backed firmware-27) hardware verification.
Details
8f9a1eb3c5d9,bdff788a215b) populatedscratch_offset = offsetandscratch_size = 8for every 0x2c-byte D003 reply. On SoCs with a separateapple,bw-doorbellregister (T8103:apple,bw-scratch = <&pmgr_dcp 0 5 0x14>for231c00000.dcpand0x18for271c00000.dcp), the PMGR scratch slots are 4 bytes wide rather than 8-byte PMP PTD entries.scratch_offset = 0x14, scratch_size = 8to T8103's internal DCP causes firmware to issue a 64-bit write to device memory atbase + 0x14(FAR=0xffffffff1018c014) on M3 power-down, triggering an immediate ARM64 write alignment fault (ESR=0x96000061) and RTKit crash. On271c00000.dcp(0x18), an 8-byte write overflows the 4-byte register.trampoline_rt_bandwidth_h17p()now passesdcp->disp_bw_doorbell_index != 0todcp_v27_rt_bw_reply(). When a doorbell register is present, the function validates 4-byte alignment and window bounds, clears the reply, and fills onlyreply->config(leavingscratch_offsetandscratch_sizezero, matching pre-drm/apple: fill the extended firmware-27 D003 bandwidth reply #3327 behavior). When no doorbell is present, it validates 8-byte alignment (IS_ALIGNED(offset, sizeof(u64))) and window bounds before emitting the 8-byte slot fields.iomfb_v27_test.cfor doorbell-backed extended replies (4-byte and 8-byte aligned offsets, window end, misaligned/out-of-bounds failures) and unaligned non-doorbell offsets.Evidence
a438532e2743(59e0ba9832b6^1) sleeps cleanly (rc=0);59e0ba9832b6(Merge drm/apple: fill the extended firmware-27 D003 bandwidth reply #3327) crashes231c00000.dcponset_power_state(0)withESR=0x96000061,FAR=0xffffffff1018c014,no reply to set_power_state(0): -110,PM: failed to suspend: error -16.af1d77fc4081:231c00000.dcp(Using Dashboard 23b738014) and271c00000.dcp(Using Dashboard 23b738018) up with zeroD003 bandwidth request is malformedwarnings.eDP-1DPMS off/on:IOMFB: power on -> off,power_down_M3: disabling M3,did_power_off: m_power_ctrl->setPower( 0 )→IOMFB: power off -> on,power_on: setPower( 1 ),enabling backlight, zero crashes.rtcwake -d /dev/rtc1 -m mem -s 10):rc=0on attempt 1,suspend_stats/success=1,fail=0, clean wake (set_digital_out_mode finished:2125)../tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 --kunitconfig drivers/gpu/drm/apple/tests/topology.kunitconfig apple-dcp-v27→8/8 passed.scripts/checkpatch.pl --git HEAD~1..HEAD --strict: 0 errors, 0 warnings, 0 checks.