Skip to content

media: apple: isp: name the reset drain reads and report a word that stays set - #2382

Merged
RyanTheTide merged 3 commits into
mainfrom
hack/media-ane-hid-a
Nov 29, 2026
Merged

RyanTheTide merged 3 commits into
mainfrom
hack/media-ane-hid-a

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

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.c byte-identical to this head 0ce9e0f), dyndbg turned on at runtime for isp-fw.c, camera opened 3 times (60 frames each, rc 0): on every open coprocessor word 0x818 read 0x2000000 after 128 reads and 0x81c 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
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

  • Name the two words (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.
  • Read them through one helper. The register accesses are the same as before: the same words, in the same order, up to 128 reads each, stopping at the first 0.
  • A word still nonzero after 128 reads now gives one warning per boot instead of nothing, and the number of reads each word took is a debug line, so the hardware runs in media: apple: isp: reset drain loops on 0x818/0x81c have no known meaning or bound #2318 can record them.

No other SoC is reached: T8140 and T6040 return before this code. No behaviour change beyond the new log lines.

Testing

  • Built isp-fw.o for arm64 (LLVM=1, release config) with W=1 before and after the change: 0 warnings both times.
  • checkpatch --strict: clean.
  • KUnit not run: the ISP suites cover queue setup, layouts and the IPC transport with stubs; none reaches the coprocessor reset, which only runs against the hardware.

Still to run

  • M1 Pro (T6000) and M2 (T8112): boot with dyndbg="file isp-fw.c +p", open the camera three times with a local frame count (for example v4l2-ctl -d /dev/video0 --stream-mmap --stream-count=60 --stream-to=/dev/null), and record the coprocessor word 0x818/0x81c read 0 after N reads lines. 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).
  • T8140 and T6040 do not run this code; nothing to check there beyond the camera still streaming.
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:

  • kernel errors, failed units and SELinux denials;
  • microphone capture byte counts;
  • camera frame counts;
  • USB speeds;
  • panel brightness steps;
  • every retry/refusal message these drafts touch;
  • 2 s2idle cycles on M1 Pro, M2 and J616s.

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.

…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]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Blockers: 2.

  1. drivers/media/platform/apple/isp/isp-fw.c:394: dev_warn_once() sits in the shared helper, so both words share one once-flag. Whichever word warns first hides the other for the rest of the boot. Your M1 Pro row shows this: 0x818 warned, so we don't know whether 0x81c also stayed set. The M2 row shows 0x81c only because 0x818 cleared there. media: apple: isp: reset drain loops on 0x818/0x81c have no known meaning or bound #2318 needs both values, so report each word (pass the result back and print once in isp_reset_coproc(), or keep one flag per word).
  2. Same line, log level: the row shows the condition on every M1 Pro and M2 boot, and the camera still gives 60/60 frames, so this warning appears on every boot of every pre-T8140 Mac on the first camera power-up while nothing is wrong. That's a new kernel warning in every regression row, and users can't act on it. Until media: apple: isp: reset drain loops on 0x818/0x81c have no known meaning or bound #2318 says what the words mean, log it with isp_dbg() (or dev_info_once() if you want it in the default log) and keep warning-level messages for cases where the WFI poll actually fails. The PR text says "a word that never clears goes unnoticed"; the data now shows that never clearing is the normal state on both Macs, so reword the comment at :374-380 to say so.

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]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Review blockers fixed in 08fe6b5: each drain word now gets its own report (no shared once-flag), and the report is isp_dbg() on every reset, so a word that stays set (M1 Pro first word, M2 second word, camera fine) no longer warns at boot. The WFI poll keeps warning/error level as the check that fails the reset.

Testing: isp-fw.c compiles warning-free (clang 22, -Wall -Wextra) against integration/aurora 4a17f73; run-host-tests.py --only isp- 18/18 ok; checkpatch --strict clean.
Still to run: M1 Pro + M2 camera rows on this head (values visible with dyndbg="file isp-fw.c +p").

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

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 drivers/media/platform/apple/isp/). Default command line, dyndbg="file isp-fw.c +p" turned on at runtime for the test only. The camera was opened 3 times (v4l2-ctl --stream-mmap --stream-count=60, rc 0 each; the lid was covered, so the frames are dark).

On every open, both words are still nonzero after the full 128 reads:

coprocessor word 0x818 read 0x2000000 after 128 reads
coprocessor word 0x81c read 0x400080 after 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).

@RyanTheTide
RyanTheTide marked this pull request as ready for review November 28, 2026 14:40
@RyanTheTide
RyanTheTide requested review from a team as code owners November 28, 2026 14:40

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

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.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

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 isp_drain_coproc_word() (isp_dbg only). Tested says that isp-fw.c in the tested dsw2 kernel is byte-identical to this head. The older T8112 and other rows in the folded 11-20 text are marked as evidence from an earlier head. The M2 laptop row is still owed.

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

The updated description now matches the debug-only implementation and identifies the older T8112 evidence as historical. The M1 Pro result covers this source. The outstanding item from my review is a current T8112 camera streaming and reset row.

@github-actions github-actions Bot added area:media Area from CODEOWNERS (bot) blast:m1 Macs affected, from Merge risk (bot) blast:m2 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) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 28, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Merge readiness at 0ce9e0f4: not ready yet

Check Detail
CI at head no failing: pr-text / pr-text, pr-text / pr-text, pr-text / pr-text
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok in the PR body at 0ce9e0f4
Conflicts ok none
PR text ok Risk: two-way · T8103, T8112, T6000, T6020, T603x (ISP reset; log lines only)

Areas: area:media

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

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; isp-fw.c byte-identical to this head 0ce9e0f). Default command line, dyndbg="file isp-fw.c +p" turned on at runtime for the test only. The camera was opened 3 times (v4l2-ctl --stream-mmap --stream-count=60, rc 0 each; the lid was covered, so the frames are dark).

On every open:

coprocessor word 0x818 read 0x0 after 1 reads
coprocessor word 0x81c read 0xfff after 128 reads

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.

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

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at 0ce9e0f4. App approved; rows J413 (T8112) + M1 Pro (T6000). Merges 1 h from now under the 6-point rule once hosted CI is green, unless you object.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merging under the 6-point rule (Ryan 09:29, permanent), at 0ce9e0f4. (1) The review App approved at this head. (2) Full CI is green. (3/4) Rows: J413+M1Pro. (5) There's no blocking review. (6) Dj was pinged here 125 min ago with no objection. Revert: git revert -m 1 <merge>.

@RyanTheTide
RyanTheTide merged commit 5fb37b4 into main Nov 29, 2026
21 of 31 checks passed
@RyanTheTide
RyanTheTide deleted the hack/media-ane-hid-a branch November 29, 2026 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:media Area from CODEOWNERS (bot) blast:m1 Macs affected, from Merge risk (bot) blast:m2 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) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant