Repository navigation
media: apple: isp: name the reset drain reads and report a word that stays set - #2382
Conversation
…stays set isp_reset_coproc(), the reset of every ISP before T8140 and T6040, reads the coprocessor words at 0x818 and 0x81c up to 128 times each until they read 0, with no wait between reads, and then carries on whatever they read. The offsets were bare numbers, the bound had no source, and a word that never cleared went unnoticed: only the WFI poll of the coprocessor status that follows can fail the boot. What the two words are is not known. On T8140 the same step reads two acknowledge words at 0x1600818 and 0x160081c, in the block where the control, status and interrupt mask registers moved from 0x14000xx to 0x16000xx, so the older counterparts may sit at 0x1400818 and 0x140081c instead. That needs a hardware run to settle. Name the words and the bound, and say what is and is not known about them. Read them through one helper that performs the same register accesses as before (the same words, in the same order, at most 128 reads each, stopping at the first 0), warns once if a word is still set after the last read, and reports at debug level how many reads each word took. T8140 and T6040 return before this code and are not reached. Link: #2318 Signed-off-by: Ryan Murray <[email protected]>
|
Blockers: 2.
The rest matches the old loop: same reads, same order, at most 128 each, stopping on the first 0, and T8140/T6040 return before this code (:406-409). The branch merges cleanly into the current integration/aurora. HW row: M1 Pro (T6000) and M2 (T8112) on the fixed head: boot, open the camera 3 times (60/60 frames each), and capture both words' final values per boot with no warning-level line. Also 0 AVC, 0 failed units, no new kernel errors. Assisted-by: LLM (Claude:Opus 5.5) |
The reset drain helper warned once when a word was still set after the last read. The once-flag sits in the helper, so the two words shared it and the first word to warn hid the other for the rest of the boot: the M1 Pro run showed 0x818 and nothing about 0x81c. The warning also fired on the first camera power-up of every boot on M1 Pro (0x818) and on M2 (0x81c), where the camera delivers every frame, so it reported a fault where there is none. Report each word's last value and its number of reads with isp_dbg(), whether it read 0 or not, on every reset. Warning and error level stay for the WFI poll, which is the check that fails the reset. Say in the comment that a word that stays set is the normal state on those two machines. Link: #2318 Signed-off-by: Ryan Murray <[email protected]>
|
Review blockers fixed in 08fe6b5: each drain word now gets its own report (no shared once-flag), and the report is Testing: isp-fw.c compiles warning-free (clang 22, -Wall -Wextra) against integration/aurora 4a17f73; |
RyanTheTide
left a comment
There was a problem hiding this comment.
At 08fe6b59b5e7 the named helper preserves the two reads in order, stops at the first zero and caps each loop at 128 reads. The later WFI poll still decides whether reset succeeded. A host compile of the exact helper passed five boundary cases, including a first-read clear, a last-read clear and a word that never clears.
The last value and count are now a debug line even when the word stays set. Please update the PR's “one warning per boot” statement and mark the warning in the earlier M1 Pro/J413 receipt as earlier-head evidence. Those camera rows verify that the read sequence didn't break capture, while the logging level is a source-only change.
|
Row: M1 Pro (J316s, T6000), the data this PR was written to collect. Combined one-shot test kernel 7.3.0-aurora-dsw2 (main 2a173ca + this PR's head 08fe6b5 + 14 other drafts; none of the others touches On every open, both words are still nonzero after the full 128 reads: The reset then goes on as before, and the camera streams. So on T6000 the bounded loop never sees 0 at 0x818/0x81c. That fits the PR's suspicion that the real drain words, if any, sit somewhere else (the T8140 layout points at 0x1400818/0x140081c). The new one-time warning fires as intended. No behaviour change: 0 error-level lines, 0 WARN/BUG, s2idle rc 0, gpubench/Vulkan smoke clean. Still to run: the same on an M2 (T8112). |
Signed-off-by: Ryan Murray <[email protected]>
There was a problem hiding this comment.
Please update the PR description at 0ce9e0f. What and the original description both promise a once-per-boot warning, but the current helper emits only isp_dbg. The hardware receipt should also distinguish the older T8112 row from evidence for the current debug-only source. If the affected code and dependencies match, show that comparison. Otherwise the nearby J473 no-camera and J615 no-path boots provide general smoke while the T8112 camera row remains due.
The code preserves the original register offsets, order and 128-read budget, with the same first-zero stopping point and no new error return. I checked the surrounding reset dispatch and WFI check and compared the loop bounds across all 129 stop and exhaustion cases offline. No DT change.
|
Description fixed per the review at 0ce9e0f (no code change). What now says this logs at debug level only, with no once-per-boot warning, which matches |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
Row: J413 (M2 Air, T8112), the current-source T8112 row from the review. Combined one-shot test kernel 7.3.0-aurora-dsw2 (main 2a173ca + this PR's head 08fe6b5 + 14 other drafts; On every open: On T8112 the first word is 0 on the first read. The second stays 0xfff through the whole bound. The reset goes on as before and the camera streams. That differs from T6000, where both words stayed nonzero (M1 Pro row above). The new reads match the old behaviour on both. No other change: 0 error-level lines, 0 WARN/BUG, s2idle rc 0, gpubench and 30 fresh Vulkan clients clean, 0 failed units. The J413 went back to its saved kernel (m2combo30), verified. |
There was a problem hiding this comment.
Verdict: MERGE at 0ce9e0f after current PR-text and readiness
The J413 combined boot used byte-identical ISP reset source and exercised camera streaming three times. The observed early stop and full 128-read bound, clean capture and saved return close the T8112 request. The description now matches the debug-only logging. Keep the newly queued PR-text and readiness runs visible in the merge check.
|
code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at |
|
Merging under the 6-point rule (Ryan 09:29, permanent), at |
What: ISP reset: name the two coprocessor words read before the WFI poll, read them through one helper with the same accesses as before (same offsets, order, 128-read bound, first-zero stop), and log each word's final value and read count at debug level (
isp_dbg). No behaviour change. There is no warning: an earlier version of this description promised a once-per-boot warning. The code at this head doesn't emit one, and the folded original text below still says so.Tested: M1 Pro (J316s, T6000) at 08fe6b5 (dsw2;
isp-fw.cbyte-identical to this head 0ce9e0f),dyndbgturned on at runtime forisp-fw.c, camera opened 3 times (60 frames each, rc 0): on every opencoprocessor word 0x818 read 0x2000000 after 128 readsand0x81c read 0x400080 after 128 reads, so on T6000 neither word ever reads 0 within the bound. The reset goes on as before and the camera streams. 0 error-level lines, 0 WARN/BUG, s2idle rc 0. J413 (M2 Air, T8112) at 08fe6b5 (dsw2): 0x818 reads 0 on the first read, 0x81c stays 0xfff through 128 reads, the camera streams on all 3 opens. J473 (M2 mini, no camera) and J615 (T8122, not reached): boot unchanged.Risk: two-way · T8103, T8112, T6000, T6020, T603x (ISP reset; log lines only)
Not yet: nothing for this change (T6000 and T8112 rows above, both on this source). The T6020/T603x ISPs have no lab Mac. The older 11-20 rows in the folded text predate this head.
Evidence
CONFIG_USB_BILLBOARD=m), LLVM 22.1.6 / rustc 1.97.1; build warnings = main's.grub2-reboot, no Stage 2 or DTB change. Each Mac went back to its saved fleet kernel, the test kernel was removed, and production state was verified: saved entry, empty next_entry, Enforcing, 0 failed units.genpd_prepare -11, brcmfmac LPAS fallback), and the fleet kernel's own s2idle shows them too.Merge main into hack/media-ane-hid-a. This PR's files are byte-identical to the dsw2 tree.Original description
Problem
isp_reset_coproc()in drivers/media/platform/apple/isp/isp-fw.c (the reset of every ISP before T8140 and T6040: T8103, T8112, T6000, T6020 and T6030/T6031) reads coprocessor words 0x818 and 0x81c up to 128 times each until they read 0, with no delay, and then goes on whatever they read. The offsets are bare numbers, nothing says where the 128 comes from, and a word that never clears goes unnoticed: only the WFI poll of the coprocessor status that follows can fail the boot. The loops come from the original driver (d2b229a).What the two words are is not known. On T8140 the same step reads two words at 0x1600818 and 0x160081c, in the block where the control, status and interrupt mask registers moved from 0x14000xx to 0x16000xx, which suggests the older counterparts may be at 0x1400818 and 0x140081c rather than 0x818 and 0x81c. That needs hardware to settle; it is tracked in #2318.
Change
ISP_COPROC_DRAIN_0,ISP_COPROC_DRAIN_1) and the bound (ISP_COPROC_DRAIN_READS), with a comment that says what is and is not known and that the WFI poll is the check.No other SoC is reached: T8140 and T6040 return before this code. No behaviour change beyond the new log lines.
Testing
isp-fw.ofor arm64 (LLVM=1, release config) with W=1 before and after the change: 0 warnings both times.Still to run
dyndbg="file isp-fw.c +p", open the camera three times with a local frame count (for examplev4l2-ctl -d /dev/video0 --stream-mmap --stream-count=60 --stream-to=/dev/null), and record thecoprocessor word 0x818/0x81c read 0 after N readslines. Expected: 60 frames each open as before, no warning unless a word stays set (which is then the evidence media: apple: isp: reset drain loops on 0x818/0x81c have no known meaning or bound #2318 asks for).Hardware rows (combined test kernel, 2026-11-20)
This change was booted in a combined test kernel: integration/aurora 0abc2f3 plus the open gate-sweep drafts plus this and the related drafts (7.3.0-aurora-hk2/pwr1/hk3). It ran once on each lab Mac (M1 Pro J316s, M2 J413, J616s, Neo J700) and was compared against the production kernel on the same Mac, using the same silent row script:
M1 Pro, M2 and J616s matched production on every row, apart from the new counters and lines the drafts add. The Neo row found the old-DTB display regression that #2358's follow-up commit fixes.
This PR: The new warning fires on both Macs that reach this code: M1 Pro "word 0x818 still 0x2000000 after 128 reads", M2 "word 0x81c still 0xfff after 128 reads". The camera still gives 60/60 frames on 3 opens on both, the same as production, so the loop never completes there. Data posted on #2318.