Repository navigation
kboot: publish the firmware-27 DCP clocks from the ADT on the legacy display path - #382
Conversation
…display path The firmware-27 DCP takes its firmware clocks from the OS. Linux reads them as apple,clock-ids plus clocks named firmware-<n> (as on T8142/J813). The M1/M2 device trees predate firmware 27, so they list only the display clock. On the MacBook Air M2 (J413) with the 27.2 stub, the DCP then has no firmware clocks and the panel does not start. On firmware 27 or later, for dcp and dcpext on the legacy display path: when the node has no apple,clock-ids and exactly one clock, read /arm-io/<engine> clock-ids and /arm-io clock-frequencies (indexed from 256, the same reading the dcp6 handoff does), publish one fixed clock per ID after the display clock, and set clock-names and apple,clock-ids. Selected by firmware version and by the device tree lacking the clocks. Device trees that list their own clocks (T8142) and the dcp6 handoff SoCs, which return before this path, are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fail the boot on it fdt_get_alias() returns a string inside the blob, and adding the fixed-clock nodes moves it. Copy it first. A failed clock publication now leaves the DCP without its firmware clocks, which is logged, instead of stopping kboot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Claude Opus 5.5 on @satchlj's behalf. Hardware result on MacBook Air M2 (J413, T8112), macOS 27.2 (26B123) stub: pass. The change is now part of phellos's default. Tested in phellos's upstream-first build, and it is now the default (one-shot
🤖 Generated with Claude Code |
|
Claude Opus 5.5 on @satchlj's behalf: hardware run.
Build: phellos (MacBook Air M2, J413, macOS 27.2 / 26B123 stub), default rebuilt 2026-11-20 = linux |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Reviewed 53202ff. Approving.
What I checked:
dt_set_dcp_fw27_clocks()copies the alias path before adding nodes, which fixes the blob-pointer bug.- It acts only when firmware is 27 or later and the node has no
apple,clock-ids, one clock and noclock-names. - Every refusal returns 0 with a log line, and a publish failure only logs (
src/kboot.c:8251-8254). - Firmware older than 27 and every tree that describes its own clocks are unchanged. On 27.x, the M1/M2 DCPs don't start without the clocks anyway, so the other legacy SoCs can't regress.
Hardware gate is met: J413 on the 27.2 stub at this exact head (panel, brightness, s2idle). CI is green.
Follow-up for later, not blocking: this is now the fifth copy of the clock-ids → /arm-io clock-frequencies reader, after dcp6_read_disp0_clocks(), the T6041 reader and kboot_t6031.c. Line :8064 repeats DCP_CLOCK_ID_BASE (256) and :8045 a cap of 8. One shared reader in a header would let them all agree.
main has moved in src/kboot.c, so I'm updating the branch and will merge on green CI. #404 is stacked on this branch, and aura doesn't delete merged branches, so #404 will need retargeting to main afterwards.
Assisted-by: Claude Opus 5.5
RyanTheTide
left a comment
There was a problem hiding this comment.
No blockers. Dj covered the gating, the copied alias path and the non-fatal publish. One small robustness point he didn't mention, plus a hardware row for the SoC that hasn't been tested.
- src/kboot.c, end of
dt_set_dcp_fw27_clocks(): the threefdt_setpropcalls aren't atomic. Supposeclocksis written (now 1 + n entries) and thenclock-namesorapple,clock-idsfails, for example because the blob is out of space. The DCP node is then left with several clocks, no names and no ids.dt_set_display()only logs the failure, so the kernel gets a node that matches neither the old one-clock layout nor the new one. Fix: writeapple,clock-idsandclock-namesfirst andclockslast. If you want it tidier, delete the two new properties again when a later write fails, so a failure leaves the original one-clock node. Orphanedfixed-clocknodes at the root after a failure in the loop are harmless.
I checked the bounds: names[108] holds "display" plus 8 "firmware-N" (96 bytes), name[40] fits the longest clock-dcpext-firmware-<u32>, and the id/index check rejects ids below 256 and past clock-frequencies.
Hardware row: M1 Pro (T6000) on a firmware-27 stub, which the PR says hasn't been tested. Boot this Stage 2. Pass: FDT: dcp: N firmware clocks published from /arm-io/disp0 appears and the internal panel comes up at native mode, or the existing tree already has apple,clock-ids and nothing changes.
Assisted-by: LLM (Claude:Opus 5.5)
Claude Opus 5.5 on @satchlj's behalf.
kboot: on firmware 27 or later, publish the DCP firmware clocks from the ADT on the legacy display path (dcp and dcpext).Why: the firmware-27 DCP takes its firmware clocks from the OS. Linux reads them as
apple,clock-idsplusclocksnamedfirmware-<n>(as on T8142/J813). The M1/M2 device trees predate firmware 27 and list only the display clock. aurora-silicon/linux#1832 names this publication as a follow-up. On the MacBook Air M2 (J413) with the 27.2 stub, the IDs are disp0 344/415 (712 MHz and an explicit 0) and dispext0 350/418.Change:
dt_set_dcp_fw27_clocks()runs fordcp(/arm-io/disp0) anddcpext(/arm-io/dispext0) on the legacy path. It acts only when the node has noapple,clock-ids, exactly one clock and noclock-names. It readsclock-idsand/arm-ioclock-frequencies(indexed from 256, the reading the dcp6 handoff already does), adds one fixed clock per ID after the display clock, and setsclock-names(display,firmware-0, …) andapple,clock-ids. Missing or out-of-range ADT data leaves the node unchanged, with a log line.Selection: the firmware version and the device tree lacking the clocks. T8142 device trees, which list their own clocks, are unchanged. So are the dcp6-handoff SoCs, which return before this path.
Testing
df2e4330), and with them the panel starts. This exact change: hardware result to follow from the phellos upstream-default boot.🤖 Generated with Claude Code