Skip to content

drm/apple: iomfb_v27: skip 8-byte D003 slot metadata on doorbell dashboards - #3830

Merged
DjDeveloperr merged 1 commit into
mainfrom
fix/dcp-v27-d003-doorbell-slot
Dec 1, 2026
Merged

DjDeveloperr merged 1 commit into
mainfrom
fix/dcp-v27-d003-doorbell-slot

Conversation

@erikwb

@erikwb erikwb commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

What: Skip writing the 8-byte scratch_offset and scratch_size fields in the extended (0x2c-byte) firmware-27 D003 bandwidth reply when apple,bw-doorbell is 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 during set_power_state(0) (deep sleep and eDP-1 DPMS-off) introduced by #3327.
Tested: J313 M1 MacBook Air (T8103, firmware-27 DCP, docked with CalDigit TS5) at af1d77fc4081: boot, eDP-1 DPMS off/on, and docked deep sleep (rtcwake -d /dev/rtc1 -m mem -s 10) all pass with zero DCP crashes (suspend_stats/success=1). KUnit apple-dcp-v27 (8/8 passed) and checkpatch.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
  • PR drm/apple: fill the extended firmware-27 D003 bandwidth reply #3327 (8f9a1eb3c5d9, bdff788a215b) populated scratch_offset = offset and scratch_size = 8 for every 0x2c-byte D003 reply. On SoCs with a separate apple,bw-doorbell register (T8103: apple,bw-scratch = <&pmgr_dcp 0 5 0x14> for 231c00000.dcp and 0x18 for 271c00000.dcp), the PMGR scratch slots are 4 bytes wide rather than 8-byte PMP PTD entries.
  • Handing scratch_offset = 0x14, scratch_size = 8 to T8103's internal DCP causes firmware to issue a 64-bit write to device memory at base + 0x14 (FAR=0xffffffff1018c014) on M3 power-down, triggering an immediate ARM64 write alignment fault (ESR=0x96000061) and RTKit crash. On 271c00000.dcp (0x18), an 8-byte write overflows the 4-byte register.
  • trampoline_rt_bandwidth_h17p() now passes dcp->disp_bw_doorbell_index != 0 to dcp_v27_rt_bw_reply(). When a doorbell register is present, the function validates 4-byte alignment and window bounds, clears the reply, and fills only reply->config (leaving scratch_offset and scratch_size zero, 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.
  • Adds KUnit tests in iomfb_v27_test.c for doorbell-backed extended replies (4-byte and 8-byte aligned offsets, window end, misaligned/out-of-bounds failures) and unaligned non-doorbell offsets.
Evidence
  • Bisect on J313 (T8103, docked with CalDigit TS5): a438532e2743 (59e0ba9832b6^1) sleeps cleanly (rc=0); 59e0ba9832b6 (Merge drm/apple: fill the extended firmware-27 D003 bandwidth reply #3327) crashes 231c00000.dcp on set_power_state(0) with ESR=0x96000061, FAR=0xffffffff1018c014, no reply to set_power_state(0): -110, PM: failed to suspend: error -16.
  • J313 at af1d77fc4081:
    • Boot: 231c00000.dcp (Using Dashboard 23b738014) and 271c00000.dcp (Using Dashboard 23b738018) up with zero D003 bandwidth request is malformed warnings.
    • eDP-1 DPMS 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.
    • Deep sleep (rtcwake -d /dev/rtc1 -m mem -s 10): rc=0 on attempt 1, suspend_stats/success=1, fail=0, clean wake (set_digital_out_mode finished:2125).
  • KUnit: ./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.

…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>
@erikwb
erikwb requested review from a team as code owners December 1, 2026 18:57
@erikwb
erikwb requested review from LiamRay11 and maralcbr December 1, 2026 18:57

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

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.

@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) blast:m1 Macs affected, from Merge risk (bot) blast:m3 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) labels Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Merge readiness at af1d77fc: ready to merge

Check Detail
CI at head ok 9 checks passed
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok in the PR body at af1d77fc
Conflicts ok none
PR text ok Risk: two-way · 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.

Areas: area:display
Merge: gh pr merge 3830 --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.

@github-actions github-actions Bot removed the ci-failing A check failed at the PR head (bot) label Dec 1, 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 af1d77f

Checked:

  • Doorbell detection: disp_bw_doorbell_index is set only by dcp_get_bw_doorbell_reg(), to count after the scratch window was added, so it is ≥1 whenever apple,bw-doorbell was parsed. != 0 is a correct "has doorbell" test.
    • The hw.firmware_clock path (T8140 internal/external) fills disp_bw_doorbell_res but 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.
  • Every DT at this head: apple,bw-doorbell exists only on t8103, t8140 and t8142.
    • Doorbell path: t8103 offsets 0x14/0x18 and t8142 offset 0 pass 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-scratch offset is 8-byte aligned (t600x/t602x/t603x/t604x/t605x, and t8112 0x5d8/0x5e0). The new IS_ALIGNED(offset, 8) refuses nothing that #3327 accepted, so J516s and the T8112 replies are byte-for-byte unchanged. The added memset is a no-op there, because the trampoline already clears the reply.
  • 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).

@RyanTheTide

Copy link
Copy Markdown
Contributor

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.

  • Kernel 7.3.0-aurora-b1pm3829 = main cd5cb048 + pmdomain: apple: pmgr-pwrstate: do not gate parent domains at sync_state #3829 eb64ee5f + drm/apple: iomfb_v27: skip 8-byte D003 slot metadata on doorbell dashboards #3830 af1d77fc (local merge 02368e37), m2combo30 config, one-shot BLS entry with the production options exactly. Trial Stage 2 = production aura 99b6dd13 + U-Boot + production DTB with the soc: apple: sleep: T8112 (M2) suspend-to-RAM, enabled on J413 #3647 DT delta (chosen/aurora,trial = the trial image).
  • Boot: up in 40 s, Enforcing, 0 failed units, displays, GPU render node, 12 USB, NVMe, Ethernet + gateway ping, 0 oops. Kernel errors = the 3 existing ones (SEP sensor -ENODEV, SEP matching unavailable, DCP audio close -110). genpd: 70 domains on, 80 off after sync_state; 4 always-on domains turned on at boot, as on production.
  • DPMS (Mutter PowerSaveMode 3 then 0): DP-2 + HDMI-A-1 off, then on. 0 DCP crash, 0 D003 bandwidth request is malformed, 0 no reply to set_power_state. HDMI-A-1 read disconnected in the sample 12 s after DPMS on and was connected enabled again at the next check. The J473 has no apple,bw-doorbell (t8112 bw-scratch 0x5d8/0x5e0), so its D003 reply is unchanged by drm/apple: iomfb_v27: skip 8-byte D003 slot metadata on doorbell dashboards #3830.
  • s2idle (rtcwake rtc1, 20 s): rc=0, success +1, fail 0. Both monitors connected + enabled after wake, 0 oops.
  • Then a plain reboot back to saved m2combo30 (48 s), verified: Stage 2 cc5dc744, next_entry empty, no trial files, Enforcing, 0 failed.
  • Evidence: traces/boot/20261202-b1-3829-j473/r1 (lab store).

@github-actions github-actions Bot added the ready-to-merge Meets the merge policy: merge it (bot) label Dec 1, 2026
@DjDeveloperr
DjDeveloperr merged commit ade2dbd into main Dec 1, 2026
12 of 13 checks passed
@DjDeveloperr
DjDeveloperr deleted the fix/dcp-v27-d003-doorbell-slot branch December 1, 2026 20:05
@DjDeveloperr

Copy link
Copy Markdown
Contributor

J516s (T6030, M3 Pro) hardware verification PASS for af1d77fc40810d1b5b45d9eb479bd1a39d7046f4:

  • Build / base note: af1d77fc4081's parent (cd5cb0485700) predates pmdomain: apple: pmgr-pwrstate: do not gate parent domains at sync_state #3829 (required to boot J516s on post-pmdomain: apple: pmgr-pwrstate: power gate a domain left clock gated #3668 main) and lacks T6030 deep-sleep support, so af1d77fc40810d1b5b45d9eb479bd1a39d7046f4 was cherry-picked cleanly (0 conflicts, identical diff) onto #3818 (e9ce12c1c2381a20e24ea1ed3ebf19a02ae7f24f, carrying main@fe7d114c7a08 with pmdomain: apple: pmgr-pwrstate: do not gate parent domains at sync_state #3829 plus T6030 deep S2R; dcp_v27_rt_bw_reply() and trampoline_rt_bandwidth_h17p() are untouched between main and e9ce12c1c238). Tested kernel: 7.3.0-t6030s2r #66, boot=83d4fa32-75fb-4311-a51b-8c8ca80d5bf6, appledrm.ko sha256 43fdcf93d9bd12dfc5d7ece5cf96b26f053d5436993a31f84fce57514fa2352d.
  • Boot (28ec00000.dcp, non-doorbell 8-byte PTD slot apple,bw-scratch = <&pmgr_dcp 0 5 0x988>): IOMFB Int RTBandwidth: program_M3_rt_config: Using Dashboard 3503d0988, DCP booted, eDP-1 connected/enabled/On, backlight 25, zero D003 errors or warnings on internal 28ec00000.dcp (external 2d2c00000.dcp and 2d6c00000.dcp without apple,bw-scratch keep their unchanged pre-existing D003 bandwidth request is malformed notice).
  • eDP-1 DPMS off -> on (kscreen-doctor --dpms off -> 4s -> --dpms on): full M3 power-down (IOMFB: power on -> off vmaod 0 aot 0, dpms=Off enabled=disabled bl=0) and full M3 power-up (load APT M3 IMem/DMem, program_M3_rt_config: Using Dashboard 3503d0988, clearing M3 reset, switch to normal mode succeeded, enabling backlight, dpms=On enabled=enabled bl=25); zero priority 0–3 kernel errors, zero RTKit/alignment faults.
  • Physical T6030 deep S2R (rtcwake -m mem -s 20, s2idle [deep]): RC=0, resumes 0 -> 1, wake source: NUB.SPMI0.SW3, 28ec00000.dcp V27 wake: internal DCP stopped and restarted after A500-wake (plain-on 0@83), program_M3_rt_config: Using Dashboard 3503d0988, eDP-1 connected/enabled/On, backlight 25, zero priority 0–3 kernel errors.
  • Clean stock handback: verified back on stock 7.3.0 (boot=9fef4e8a-823e-4c39-8267-1bc20b3aa127, both ESPs restored to efab68fa..., empty grubenv, 0 failed units).

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) blast:m3 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