Skip to content

media: apple: ave: demand a DATA alias only where the firmware has one - #3677

Merged
RyanTheTide merged 2 commits into
mainfrom
fix/t6050-ave-dapf
Dec 1, 2026
Merged

RyanTheTide merged 2 commits into
mainfrom
fix/t6050-ave-dapf

Conversation

@erikwb

@erikwb erikwb commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

What: The T6050 (M5 Pro/Max) video encoder fails its probe with firmware DATA alias is missing or invalid. 69ef8fc demands a DATA alias for every encoder whose CPU DART names its filter (dapf), but that alias comes only from the TEXT link cell, which the T6050 firmware doesn't have. This demands the alias only where the variant has a link cell, and drops a false "second DART filter" warning for a DART the encoder lists twice.
Tested: J716c M5 Max at 61d3bd2b16a6 (same tree as the tested c0a847951bca; only the second commit's message changed), with the two commits merged into the J716c daily candidate, which also carries #3395, the T6050 26B123 firmware admission main still lacks, and #3662, which main needs to boot this board): apple-ave binds and /dev/video* apple-ave appears; a 60-frame 1280x720 H.264 encode decodes 60/60 at the same PSNR as a daily that never had the problem; a 30 s deep sleep resumes and an encode after wake works. AVE KUnit 54/54, AVE host tests pass, checkpatch --strict clean.
Risk: two-way door · T6050 encoders (behind a named filter, no link cell) now probe; T8103 is checked exactly as before; T6000/T8112 (link cell, no named filter) and every other variant unchanged
Not yet: on main alone the T6050 encoder still stops at the firmware TEXT CRC until #3395 lands; the encoder DART filter's control bits change across a deep sleep with nothing restoring them (see Details), a separate follow-up

Details
  • Why the filter name is right and the driver was wrong: 93af6fd names ave0_dart's second window dapf. That's correct: it is the DART's address filter in the ADT, and the binding requires names once a DART has two windows. On the J716c the ADT's dart-ave0 filter entries cover register windows only, and the T6050 firmware reaches TEXT and DATA at their DART addresses, so neither segment is behind the filter. On the M1 (T8103) the firmware is behind it: TEXT at its physical address and DATA at its alias. Nothing else reads the name: apple-dart only uses a dapf window on this DART type when apple,dapf-ranges is present (ave0_dart has none), and the boot loader programs the filter from the ADT.
  • The change: ave_fw_needs_data_alias() decides from the variant: an alias is demanded only when the variant has a text_link_cell and either a mapped filter or a physical code base. Probe and the pre-start filter check both use it. Both segments still go through the IOMMU mapping checks at probe and start. On T6050 the filter is still mapped for the dart_audit debugfs dump, which now says the firmware's memory is not behind it.
  • The second commit: ave0_dart appears twice in the encoder's iommus (SIDs 0 and 12). The second visit found the same DART's filter already mapped and warned. It now warns only when the window belongs to another DART. Both SIDs stay in the audit mask.
  • After a deep sleep the filter entries' control reads 0x30 instead of 0x31, and nothing restores it. Encoding after the wake works, because the firmware's memory isn't behind the filter. Restoring it is separate: the T8110-layout DART driver has no replay data for ave0_dart, and adding apple,dapf-ranges alone wouldn't restore the enable bits, because the replay check compares bounds only.
Evidence

J716c (T6050) kernel 7.3.0-ewb412+ = the J716c daily candidate ewb/j716c-daily-412 (main 87f8dd626a9e plus the open PRs the J716c daily carries, among them #3395 and #3662) with these two commits merged. Boot loader aura main with #585. Command line: default plus watchdog.open_timeout=120.

apple-ave 2283100000.video-encoder: firmware build 26B123 (TEXT 0x158000 CRC d33ed3b4, DATA 0x134000)
video: apple-isp apple-jpeg apple-jpeg apple-prores apple-prores-decode apple-ave avd
$ ffmpeg -f lavfi -i testsrc2=size=1280x720:rate=30 -frames:v 60 -pix_fmt nv12 -c:v h264_v4l2m2m -b:v 4M enc.h264
60 frames decoded, PSNR average 24.158 dB (identical to an older J716c daily, 7.3.0-ewb342+, on the same command)
dart_audit: audit of 2 DARTs: all streams safe
  CPU DART filter 0x00000022830b0000: the firmware's memory is not behind it
  filter 0: ctrl 0x31 0x23a3e0c110-0x23a3e2881f   (0x30 after the deep sleep)
30 s deep sleep (rtcwake): resumed; encode after wake 60/60, same PSNR

Without the fix, the same daily logs apple-ave 2283100000.video-encoder: error -ENODEV: firmware DATA alias is missing or invalid and creates no apple-ave node.

AVE KUnit (drivers/media/platform/apple/ave): 54/54, including the new ave_t6050_cpu_dart_filter and the existing ave_t8103_cpu_dart_filter. AVE host tests (run-recovery.py, run.py, run-ipc.py, run-input.py) pass with gcc; a T6050 case was added to the recovery test.

The M5 Pro and Max encoder (T6050) no longer probes:

  apple-ave 2283100000.video-encoder: error -ENODEV: firmware DATA alias
  is missing or invalid

Its CPU DART names its address filter ("dapf"), as the binding wants
for the DART's second window, and the driver demands a DATA alias for
every encoder behind a named filter. The alias comes only from the TEXT
link cell, which the T6050 firmware does not have, so it is always zero
there. That firmware reaches TEXT and DATA at their DART addresses, and
the filter its loader programs admits only register windows, so neither
segment is behind it.

Demand the alias, at probe and in the pre-start filter check, only
where the variant has a link cell and the filter or a physical code
base puts the firmware behind the filter. The M1 (T8103), the only
encoder whose firmware is behind its filter, is checked as before; the
other link-cell variants (T6000, T8112) name no filter and are
unaffected. On T6050 the filter is still mapped for the debugfs dump,
which now says the firmware's memory is not behind it.

Fixes: 69ef8fc ("media: apple: ave: require valid DATA alias and filter mapping in guard")
Signed-off-by: Erik Bourget <erik@ebourget.net>
ave_map_darts() visits a DART once per stream the encoder has on it.
The T6050 encoder has two streams on its CPU DART, so the second visit
finds that DART's filter already mapped and warns:

  apple-ave 2283100000.video-encoder: /soc@200000000/iommu@22830a0000:
  a second DART filter; keeping the first

Warn only when the window is another DART's.

Signed-off-by: Erik Bourget <erik@ebourget.net>
@erikwb
erikwb requested review from a team as code owners November 30, 2026 03:05
@erikwb
erikwb requested review from Acelogic and malik-na November 30, 2026 03:05

@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: HOLD at 61d3bd2b

Blockers:

  • Hosted CI on 61d3bd2b is still queued (apple-build, host-tests, readiness, pr-text, and KUnit suites). Code, KUnit/host test additions, and J716c hardware verification look solid — ready to approve once CI turns green.

Checked:

  • ave_fw_needs_data_alias() in drivers/media/platform/apple/ave/ave-fw.c gates the DATA alias requirement on ave->variant->text_link_cell && (ave->dapf || ave->variant->vcbar_text_phys): preserves unconditional enforcement on T8103 (text_link_cell = 0x423c, vcbar_text_phys = true) and dapf-gated enforcement on T6000/T8112, while clearing M4/M5 variants (text_link_cell == 0, vcbar_text_phys == false) whose named dapf only filters register windows.
  • ave_fw_probe(), ave_fw_filter_gap(), ave_fw_check_filter(), and ave_dart_dump() handle !ave_fw_needs_data_alias(ave) consistently without misleading filter-admits output.
  • ave_map_dapf() in drivers/media/platform/apple/ave/ave-drv.c deduplicates repeated visits to the same DART across multiple streams by comparing res.start != ave->dapf_phys, keeping the warning for a distinct second filter or resource lookup failure.
  • Both commits carry human Signed-off-by: trailers and include matching KUnit (ave_t6050_cpu_dart_filter) and host recovery test coverage (tests/recovery-test.c, tests/run-recovery.py).
Evidence
  • Diff audited: 6 files (+114/-6), commits 7e820a24 (Fixes: 69ef8fc5e313) and 61d3bd2b.
  • Hardware verification reported on J716c (M5 Max) at 61d3bd2b: apple-ave binds cleanly without the spurious second-filter warning, 60-frame 720p H.264 encode matches baseline (24.158 dB PSNR), and 30 s deep sleep resumes and encodes cleanly; AVE KUnit 54/54 and host tests pass.
  • Status checks at review time: 20 queued (apple-build, host-tests, readiness / readiness, pr-text / pr-text, 16 KUnit suites), 3 skipped.

@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) blast:m5 Macs affected, from Merge risk (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 30, 2026
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Merge readiness at 61d3bd2b: not ready yet

Check Detail
CI at head running running: KUnit asahi, KUnit spi-hid-apple, KUnit avd, KUnit ave, KUnit isp, KUnit jpeg
Review ok approved by RyanTheTide
Requested changes ok none
Hardware row at head ok in the PR body at 61d3bd2b
Conflicts ok none
PR text ok Risk: two-way · T6050 encoders (behind a named filter, no link cell) now probe; T8103 is checked exactly as before; T6000/T8112 (link cell, no named filter) and every other variant unchanged

Areas: area:media

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

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

Approving at 61d3bd2b. The K114s (M5 Pro, 26B8125) shows the same failure on a current main DTB, so this isn't J716c-only.

K114s symptom (bridge10 candidate one-shot, main DTB with #2278 media nodes okay, kernel 7.3.0-k114sstack8 = main AVE sources incl. 69ef8fc): apple-ave 2283100000.video-encoder: /soc/iommu@22830a0000: a second DART filter; keeping the first, then error -ENODEV: firmware DATA alias is missing or invalid. AVD, ProRes, both JPEGs and the ISP bind on the same boot. On 11-29, a kernel without 69ef8fc (plus #3447) encoded H.264/HEVC 120 frames, deterministic 2/2, on this board with the same media nodes.

Checked:

  • ave_fw_needs_data_alias() = link cell && (named filter || physical code base). T8103 keeps both demands; T6000/T8112 keep them behind a named filter; T6050 (no link cell, DART code base) has none. That matches what 6415f67/69ef8fc5 were guarding: the M1 alias path.
  • The filter really doesn't cover T6050 firmware. The J873S 27.0 ADT dart-ave0 dapf-instance-0 entries are 0x23_a3e0_c110-0x23_a3e2_881f, 0x62_83e0_c110-… and 0x63_a3e0_c110-…: register windows, the same shape as your J716c KUnit fixture, not TEXT/DATA.
  • The warning change: the K114s DTB has iommus = <&dart_ave0 0x0 &dart_ave0 0xc &dart_ave0_aux 0x0 &dart_ave0_aux 0xc>. Only iommu@22830a0000 names dapf, so the second lookup is the same window and now stays quiet. A genuinely different second filter still warns.
  • On the K114s, main already admits 26B8125 (#3447), so this alone should make it encode there; the J716c additionally needs #3395.

I'll add a K114s encode row at this head when the next K114s boot with the main media DT comes round (K114S-STACK's bridge10).

@github-actions github-actions Bot removed the needs-review No approving review from Core or Omarchy Mac yet (bot) label Nov 30, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

K114s (Mac17,13, M5 Pro, firmware 26B8125) at 61d3bd2b: PASS.

  • Boot: one-shot Stage 2 = aura main + iommu/apple-dart: warn once per stream when a retire invalidate fails #559 + J713: wake from suspend-to-idle via USB on both ports, and on a USB-C attach #574 with linux main's K114s DTB (media nodes okay); kernel 7.3.0-k114sstack8 (main AVE sources, incl. 69ef8fc and media: apple: ave: admit the T6050 macOS 27.2 encoder firmware build #3447). Default cmdline.
  • Stock module on this boot: a second DART filter; keeping the first, then error -ENODEV: firmware DATA alias is missing or invalid.
  • Same boot, apple-ave rebuilt from those sources + this PR (rmmod/insmod): firmware build 26B8125 (TEXT 0x158000 CRC 1e27a926, DATA 0x134000), /dev/video15 apple-ave, no second-filter warning on the new probe.
  • Encode: 120 real 1080p30 NV12 frames (Big Buck Bunny, CC-BY) via v4l2h264enc/v4l2h265enc, twice each. H.264 2,099,360 bytes, md5 0a8c6b5b…; HEVC 2,200,979 bytes, md5 5633a7ec…; deterministic 2/2. Both are byte-identical to this board's 11-29 encodes on a kernel without 69ef8fc. AVD decodes both bitstreams 120/120.
  • Same boot, unchanged: AVD bit-exact AV1/H.264/HEVC 8+10-bit/VP9, ProRes p0/p3 80 frames 0 errors, JPEG x2, ISP stream. 0 SErrors, 0 DART faults, Enforcing, 0 failed units.
  • Back on the saved default after the row.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Regression point for J616s (T6041) and Neo (T8140), checked on main's DTs: neither names dapf on an encoder DART. T6041 names it only on isp_dart0, T8140 only on pmp_dart and isp_dart0, and T8132's single one isn't an encoder DART either. So on those boards ave_map_dapf() maps nothing, ave->dapf stays NULL, and their variants have no physical code base. ave_fw_needs_data_alias() and the old condition are both false there, so probe, ave_fw_check_filter() and ave_fw_filter_gap() behave as before. On 11-28 J616s + Neo AVE encodes were byte-identical to stock for #3447 (kits/test/20261128-kmedia-ave-regress) if the train wants a hardware row too.

@RyanTheTide

Copy link
Copy Markdown
Contributor

K114s again, this time with 61d3bd2b built into a full kernel (7.3.0-k114sstack9 = main 42169a0 + #3356 + #3638 + this PR), no module swap, Stage 2 aura main 7dbbeb1a with main's K114s DTB. apple-ave binds at boot (firmware build 26B8125), and H.264/HEVC 120-frame encodes match the 17:52 and 11-29 bitstreams byte for byte (2/2), AVD round-trip 120/120. AVD, ProRes, both JPEGs and the ISP pass on the same boot. 0 SErrors, 0 DART faults, 0 failed units.

@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 61d3bd2b16a6

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: - ave_fw_needs_data_alias() in drivers/media/platform/apple/ave/ave-fw.c gates the DATA alias requirement on ave->variant->text_link_cell && (ave->dapf || ave->variant->vcbar_text_phys): preserves unconditional enforcement on T8103 (text_link_cell = 0x423c, vcbar_text_phys = true) and dapf-gated enforcement on T6000/T8112, while clearing M4/M5 variants (text_link_cell == 0, vcbar_text_phys == false) whose named dapf only filters register windows.

  • ave_fw_probe(), ave_fw_filter_gap(), ave_fw_check_filter(), and ave_dart_dump() handle !ave_fw_needs_data_alias(ave) consistently without misleading filter-admits output.
  • ave_map_dapf() in drivers/media/platform/apple/ave/ave-drv.c deduplicates repeated visits to the same DART across multiple streams by comparing res.start != ave->dapf_phys, keeping the warning for a distinct second filter or resource lookup failure.
  • Both commits carry human Signed-off-by: trailers and include matching KUnit (ave_t6050_cpu_dart_filter) and host recovery test coverage (tests/recovery-test.c, tests/run-recovery.py).

Follow-ups (not blocking): queued hosted CI

@RyanTheTide
RyanTheTide merged commit 08259a1 into main Dec 1, 2026
47 of 63 checks passed
@RyanTheTide
RyanTheTide deleted the fix/t6050-ave-dapf branch December 1, 2026 06:38
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) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants