Repository navigation
drm/apple: fill the extended firmware-27 D003 bandwidth reply - #3327
Conversation
The extended firmware-27 reply describes the realtime bandwidth slot both as an address and as a byte offset from its firmware display register window. Document how the existing apple,bw-scratch specifier supports this reply. Signed-off-by: DjDeveloperr <hey@djdev.me>
The J516s DCP requests 44 output bytes for D003. The short H17P encoder gives it the dashboard address but leaves the extended slot offset and size at zero. The macOS reply has an offset of 0x988 and a size of 8, with the same dashboard address and zero clock-request word. With the offset at zero, the firmware's write of its bandwidth request when it powers its M3 down lands on the first word of the update window (PTD entry 0) instead of the dashboard slot, and the PMP traps that write as "PTD abort (0x0)". Select the extended format by the callback's output size and supply the offset already resolved from apple,bw-scratch. Keep the short encoder for DCPs using the existing format. Signed-off-by: DjDeveloperr <hey@djdev.me>
Document that the internal display's scratch register is PTD entry 305 within the update window at disp-5. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
Verdict at Blockers: none. Checked:
EvidenceHead
|
|
J714s (MacBook Pro 14" M5 Pro, T6050) no-op row at exact head
1. Displays attached on this rig:
2. The D003 reply on this Mac:
3. One DPMS off/on cycle of all three monitors, through Hyprland, which ran normally:
4. Whole boot: 0 WARN/BUG/Oops, 0 No display was plugged or unplugged for this row; it covers the monitors already attached. |
There was a problem hiding this comment.
Verdict: Changes requested at 363c468374ac.
Blockers: The D003 callback uses the short encoder for every output size other than 44 bytes. The dispatcher clears the declared output area but does not validate sizes against callback prototypes. Require an exact supported output size before encoding and a sufficient input size before reading the request or deriving the header from the input pointer. Also validate the full eight-byte scratch slot against its mapped window for the extended reply. The current scratch resolver accepts a four-byte slot.
Please add short-layout, extended-layout and malformed-length coverage. The reported J516s result covers the new layout; retain the stated M5 Pro, Neo and external-display rows for the shared callback path.
…izes The firmware-27 D003 callback read the request before checking in_len, encoded the short reply for any out_len other than the extended size, and wrote an 8-byte scratch slot that the scratch resolvers only check for 4 bytes. Move the encoding into dcp_v27_rt_bw_reply(), which requires a complete request, fills only the 0x14 and 0x2c reply layouts, and for the extended reply requires the whole 8-byte slot inside the mapped scratch window. Anything else is warned about and the reply stays cleared. Add KUnit cases for both layouts, malformed lengths and a 4-byte slot. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Pushed bdff788 for the App's length-validation finding. The D003 encoding now lives in dcp_v27_rt_bw_reply(). It requires in_len >= the 4-byte request, fills only the 0x14 short and 0x2c extended reply layouts, and for the extended reply requires the whole 8-byte scratch slot inside the mapped scratch window (the resolvers only check 4 bytes). Anything else logs "D003 bandwidth request is malformed" and leaves the reply cleared. |
There was a problem hiding this comment.
Verdict: FINISH at bdff788. The new encoder checks minimum input length, permits exactly the two reply lengths, and checks the whole eight-byte slot without subtraction underflow. The KUnit cases cover both layouts and confirm that malformed input leaves the output unchanged. Please link CI and the current-head J700 boot and J714s or J473 external-display rows. Please also identify the clean provenance for the wire layout in the PR description, citing only project-owned measurements, public sources, or independently authored code.
|
bdff788 J700 (MacBook Neo, T8140, fw 27) PASS: combined guarded one-shot |
|
bdff788 J473 (M2 Mac mini, T8112, fw 27.2, external displays) PASS: combined guarded one-shot |
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
I merged current |
There was a problem hiding this comment.
Verdict: HOLD at 85c4cf9f.
Checked: Compared the PR patch before and after the forward merge. The file set and added and removed lines match the reviewed revision. Keep hosted checks, applicable boot/display rows and the clean provenance statement for the wire layout.
There was a problem hiding this comment.
Verdict: MERGE at 85c4cf9f5bb8
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: Compared the PR patch before and after the forward merge. The file set and added and removed lines match the reviewed revision. Keep hosted checks, applicable boot/display rows and the clean provenance statement for the wire layout.
Follow-ups (not blocking): hosted checks, boot/display rows, provenance statement for wire layout
|
Merging at |
What: The firmware-27 DCP on J516s asks for a 44-byte D003 (realtime bandwidth) reply, but Linux fills only the 20-byte H17P layout. That leaves the slot offset at 0, so when the DCP powers its M3 down, its bandwidth write lands on PTD entry 0 instead of its dashboard slot (entry 305), and the PMP traps it ("PTD abort (0x0)"). This fills the extended reply's slot offset and size from
apple,bw-scratch, as macOS does.Tested: J516s M3 Pro at
363c468: boots, the DCP comes up and keeps writing its dashboard slot (PTD entry 305), entry 0 stays untouched. The same code on the T6030 sleep branch, with the PMP running:pm_test=devicespasses, the DCP's power-down write goes to entry 305 and the PMP survives.Risk: two-way door · M3 (firmware-27 DCPs that ask for the 44-byte reply); the 20-byte reply and the H17P path keep their encoder.
Not yet: no-op rows on the M5 Pro (20-byte reply) and the Neo (H17P path); the external T6030 DCPs, which this driver runs on firmware 14.7.
Details
trampoline_rt_bandwidth_h17p()iniomfb_v27.cpicks the layout by the callback's output size. With 0x2c bytes it fills the extended reply: the dashboard address (as before), a zero clock-request word, the slot's offset from its display register window at+0x14and the slot size (8) at+0x1c. Any other size keeps the short H17P encoder, unchanged.apple,bw-scratchalready gives (<&pmgr_dcp 0 5 0x988>on J516s, entry 305 of the update window at disp-5), so there is no new constant or SoC check.0x988at+0x14and8at+0x1c, with the same dashboard address and a zero clock-request word (our boot traces). Its external DCPs get0x10990and0x10998, relative to their own windows.apple,bw-scratchspecifier serves the extended reply; there is no schema change.Evidence
363c468(this branch) on J516s: boots on the internal display; the DCP logsprogram_M3_rt_config: Using Dashboard 3503d0988. PTD entry 305 kept changing (DCP active) and entry 0 stayed0x0, stamp 0. This base offers only s2idle, which dwc3 refuses at prepare, so the power-down path runs on the sleep branch.m3pro/t6030-sleep-p20batb322203(this commit's code, with the T6030 PMP started),pm_test=devices:power_down_M3: disabling M3once, no PMP crash; entry 3050x4000000000900408->0x0; entry 00x0, stamp 0 before and after. Before the change, the same branch logged "PTD abort: (0x0)" on every run, 71 ms after the M3 power-down.