Skip to content

media: apple: ave: per-device debugfs/workqueue names and T6041 ave1 node - #2778

Merged
RyanTheTide merged 2 commits into
aurora-silicon:integration/aurorafrom
AxxzyWasTaken:feat/t6041-ave1
Nov 22, 2026
Merged

RyanTheTide merged 2 commits into
aurora-silicon:integration/aurorafrom
AxxzyWasTaken:feat/t6041-ave1

Conversation

@AxxzyWasTaken

@AxxzyWasTaken AxxzyWasTaken commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Prepare the Apple Video Encoder (apple-ave) driver for dual-encoder SoCs and describe the second encoder (ave1) on T6041 (M4 Max, kept status = "disabled" until brought up):

  1. apple-ave per-device names (12402d0cef54): Use per-device apple-ave-<dev> for the debugfs root (across all SoCs; in-tree docs updated) and ave-<dev> for the ordered workqueue (longest in-tree node is T6050 ave-2283100000.video-encoder, 28 chars, within WQ_NAME_LEN=32) so multiple apple-ave instances coexist cleanly without -EEXIST or name truncation.
  2. arm64: dts: apple: t6041: describe the second video encoder (ave1) (22112f0f4a21): Add J616c ADT-verified ave1 (status = "disabled"), its DARTs, and its six pmgr_aux power domains (VENC1_SYS..VENC1_ME1 at 0x2a0..0x2c8) in t6041.dtsi.

Testing

  • scripts/checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks.
  • CHECK_DTBS=y across T6041 DTBs and CI (dt-checks, host-tests): green.
  • Live J616C hardware boot + encode verification at 22112f0f4a21 is queued next (single-AVE SoC boot/encode check also welcome).

Assisted-by: LLM (Anthropic:Claude Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

The driver half looks right and the ave1 description matches ave0 shifted by 0x2000000 with interrupts +12. Two questions on the DT and one on the rename:

  • arch/arm64/boot/dts/apple/t6041.dtsi:505-565: all six VENC1 power states are placed in pmgr_aux at 0x2a0..0x2c8. For ave0 only VENC0_SYS is in pmgr_aux (t604x-pmgr.dtsi:647, 0x278); DMA, PIPE4, PIPE5, ME0 and ME1 live in the separate pmgr_venc block at 0x502808000 (t604x.dtsi:1913, t604x-pmgr.dtsi:657-707). Can you paste the J616C ADT pmgr entries for VENC1_SYS..VENC1_ME1 (block index and offset) in the commit message? If VENC1_DMA..ME1 are in a second venc block instead, these offsets would switch unrelated aux states once the nodes are enabled.
  • ave0 on T6040 gets a perf power domain (t6040.dtsi:519-523). If T6041 needs the same for ave0/ave1, it is easier to add now than after bring-up.
  • drivers/media/platform/apple/ave/ave-drv.c:400-403: the debugfs root becomes apple-ave-<dev> on every SoC, not only the dual-encoder one. Fine by me, but please say so in the commit message, since existing scripts that use /sys/kernel/debug/apple-ave/ will need updating.
  • Minor: the PR body mentions t6041-pmgr.dtsi; the power states are in t6041.dtsi.

Testing: a boot on any AVE machine at this head showing the renamed debugfs directory and workqueue, plus one encode, would cover the driver change; the DT half stays inert until the nodes are enabled.

Assisted-by: LLM (Claude:Opus 5.5)

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

Pre-PR checklist review (§1–§6) against 3303014fe377a0cf6c4a120b1146e66bfa2f09f8:

Blockers

  1. Code bug / §1 & §5 blocker — WQ_NAME_LEN overflow and kernel warning on M3, M4, and M5 Pro/Max (drivers/media/platform/apple/ave/ave-v4l2.c:1528):

    • alloc_ordered_workqueue("apple-ave-%s", WQ_MEM_RECLAIM, dev_name(ave->dev)) exceeds WQ_NAME_LEN (32, i.e., 31 chars + NUL; kernel/workqueue.c:130,5924-5928), triggering pr_warn_once("workqueue: name exceeds WQ_NAME_LEN. Truncating to: %s ", wq->name) on boot for every SoC whose AVE node is named video-encoder@<addr> (drivers/of/device.c:303):
      • T6041 (video-codec@283100000 / 285100000): "apple-ave-283100000.video-codec" = 31 chars (fits by 1 byte).
      • M3 (t8122, boot_qualified = true), M3 Pro/Max/Ultra (t6030/t6031/t6032), M4 (t8132): "apple-ave-315100000.video-encoder" = 33 chars >= 32 (truncated + boot warning).
      • M5 Pro/Max (t6050, boot_qualified = true, dual-encoder): "apple-ave-2283100000.video-encoder" = 34 chars >= 32 (truncated + boot warning on every M5 Pro/Max boot).
    • Fix: Use a shorter prefix such as "ave-%s" (max 4 + 24 = 28 < 32) or pass "%s" directly with dev_name(ave->dev) (matching ave-ipc.c:820's request_irq()).
  2. §3 (Safety) — Record J616c ADT pmgr block index & offsets for VENC1_SYS..VENC1_ME1 (arch/arm64/boot/dts/apple/t6041.dtsi:505-565):

    • While 0x2a0..0x2c8 occupies the exact 6-slot gap in t6040-pmgr.dtsi &pmgr_aux between ps_fab_afr (0x298) and ps_fab1_soc (0x2d0), ave0 places only VENC0_SYS in pmgr_aux (0x278) and VENC0_DMA..ME1 in pmgr_venc (0x502808000, t604x-pmgr.dtsi:657-707), and t8140-pmgr.dtsi places VENC1_DMA..ME1 in pmgr_venc (0x8028..0x8048).
    • Echoing @RyanTheTide: please include the J616c ADT pmgr block index and register offsets for VENC1_SYS..VENC1_ME1 in the commit message so these offsets are provably verified before ave1 is ever enabled.
  3. §5 (Evidence) & CI still incomplete:

    • No live hardware boot/encode verification posted yet (PR is non-draft). After fixing the workqueue name length, please post a boot + encode check on the updated head confirming: (a) renamed debugfs dir /sys/kernel/debug/apple-ave-<dev> and non-truncated workqueue name with 0 WQ_NAME_LEN warnings, (b) aura still hands over ave0 cleanly with disabled ave1 present (note aura's dt_set_aves() iterates all apple,t6041-ave nodes and checks /chosen/aurora,ave-{text,data}-crc32, while ave0 has ADT soc-id t6040 vs ave1's soc-id t6041), and (c) regression row (0 SELinux denials, 0 failed units, 0 new kernel errors).
    • Live CI on 3303014fe377: host-tests SUCCESS, dt-checks still IN_PROGRESS (hold for green dt-checks).

Minor / Verified

  • Commit / PR text: Mention in commit 1 that the debugfs rename (apple-ave -> apple-ave-<dev>) applies to all SoCs (not only dual-encoder ones), and update the PR body which references a non-existent t6041-pmgr.dtsi (power states are in t6041.dtsi). Confirmed all in-tree doc/README references to /sys/kernel/debug/apple-ave/ were updated and char dir_name[64] safely fits apple-ave-<dev> (max 35 bytes).
  • DTS consistency: ave1 (+0x2000000 regs, +12 IRQ stride matching ave0 and t8140) and its DARTs/PMGR nodes stay status = "disabled", matching t604x-pmgr.dtsi safety rules and Documentation/devicetree/bindings/media/apple,t8140-ave.yaml.
  • §4 / §6: Both commits (11949b5bd538, 3303014fe377) carry human author/committer + human Signed-off-by: only (zero AI trailers in commits), Assisted-by: is disclosed in the PR body, and naming is clean.

Assisted-by: LLM (Gemini 4 Neon)

When a SoC exposes more than one AVE encoder instance (such as ave0 and
ave1 on T6041), registering both instances with the fixed "apple-ave"
debugfs directory name causes the second debugfs_create_dir() call to
fail with -EEXIST.

Qualify both the debugfs directory name and the ordered workqueue name
with dev_name(ave->dev) so multiple AVE instances coexist cleanly.

The debugfs root becomes apple-ave-<dev> on every SoC, not only on the
dual-encoder ones, so scripts using /sys/kernel/debug/apple-ave/ need
updating; the in-tree documentation is updated here.

The workqueue uses the shorter "ave-" prefix to stay within
WQ_NAME_LEN (32 including the NUL): the longest in-tree AVE device name
is "2283100000.video-encoder" (24 characters, T6050), giving 28.

Signed-off-by: AxxzyWasTaken <[email protected]>
Describe the M4 Max's second video encoder (ADT /arm-io/ave1, soc-id
t6041), its two DARTs (/arm-io/dart-ave1), and its six PMGR power
domains, verified against the J616c ADT.

Unlike ave0, whose VENC0_DMA..VENC0_ME1 sit at 0x8000..0x8020 of the
first PMGR block (pmgr_venc, 0x502808000), all six VENC1 power states
are in the same 0x2xx range as VENC0_SYS. The J616c ADT /arm-io/pmgr
devices entries (ps-groups index 0 -> pmgr reg[0], 0x302800000 size
0x1e0000, i.e. pmgr_aux at 0x502800000 after the /arm-io ranges):

  name         id  group  offset  parent
  VENC1_SYS    72  0      0x2a0   FAB0_SOC (33), as VENC0_SYS
  VENC1_DMA    73  0      0x2a8   VENC1_SYS (72)
  VENC1_PIPE4  74  0      0x2b0   VENC1_DMA (73)
  VENC1_PIPE5  75  0      0x2b8   VENC1_DMA (73)
  VENC1_ME0    76  0      0x2c0   VENC1_DMA (73)
  VENC1_ME1    77  0      0x2c8   VENC1_ME0 (76)

They fill the gap between FAB_AFR (0x298) and FAB1_SOC (0x2d0). The
FAB0_SOC parent is left implicit, as for ps_venc0_sys.

Leave all nodes disabled by default, matching ave0 until bootloader
firmware handoff and qualification for ave1 are in place.

Signed-off-by: AxxzyWasTaken <[email protected]>
@AxxzyWasTaken

Copy link
Copy Markdown
Contributor Author

Updated to 22112f0f4a21 (commit 1: 12402d0cef54, commit 2: 22112f0f4a21):

Live J616C dual-AVE boot/encode proof is queued next.

@RyanTheTide

Copy link
Copy Markdown
Contributor

All points from my last comment are handled at 22112f0:

  • The VENC1 table in the commit message matches the J616c ADT: VENC1_SYS..VENC1_ME1 are ids 72-77 in the first PMGR group at 0x2a0..0x2c8, while VENC0_DMA sits at 0x8000. So the split from ave0 is real, and t6041.dtsi:506-555 is right.
  • The debugfs rename is now in the commit message, and the workqueue uses ave-%s (ave-v4l2.c:1528). The longest in-tree name gives 28 characters, so nothing gets truncated.
  • Wiring the perf domain on top of arm64: dts: apple: t6041: wire pmc_soc_max perf floor to AVD and AVE #2751 is fine. The ADT has a VENC1-SOC-VMAX entry, so ave1 will need it before it is enabled.

Testing: besides the J616C row you have queued, one boot on an existing single-AVE machine showing apple-ave-<dev> in debugfs and no WQ_NAME_LEN warning, plus one encode, would cover the rename.

Assisted-by: LLM (Claude:Opus 5.5)

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

Re-review against pre-pr-checklist.md (§1–§6) at 22112f0f4a21d01386b5665570bf7b99dbd2e7c2: REQUEST_CHANGES.

Prior Wave 14 blockers — verified fixed

  1. Workqueue WQ_NAME_LEN overflow (drivers/media/platform/apple/ave/ave-v4l2.c:1528): Resolved cleanly. Switching to "ave-%s" keeps the workqueue name within WQ_NAME_LEN (32 incl. NUL, max 31 chars) across every in-tree AVE node on all SoCs: longest is T6050 (ave-2283100000.video-encoder, 28 chars), M3/M4 video-encoder@ is 27 chars, and T6041 video-codec@ is 25 chars. Commit 1 (12402d0cef54) also now documents the cross-SoC apple-ave-<dev> debugfs rename, and all in-tree doc/README references are updated.
  2. §3 (Safety — raw J616c ADT pmgr block & offsets for VENC1_SYS..VENC1_ME1): Resolved cleanly. Commit 2 (22112f0f4a21) records the raw J616c ADT /arm-io/pmgr table (ps-groups 0 -> pmgr reg[0] / pmgr_aux, offsets 0x2a0..0x2c8 filling the unoccupied 6-slot gap between ps_fab_afr at 0x298 and ps_fab1_soc at 0x2d0, with parent chain FAB0_SOC -> VENC1_SYS -> VENC1_DMA -> {PIPE4, PIPE5, ME0 -> ME1}), and all ave1 nodes stay status = "disabled".
  • §1 / §2 / §4 / §6: Clean (human author/committer + human Signed-off-by: only on both commits, zero AI trailers in commits). CI host-tests is SUCCESS.

Remaining blockers before approval

  1. §5 (Evidence — live hardware boot/encode proof still owed): No live hardware boot/encode run has been posted yet on 22112f0f4a21 while the PR is non-draft. Please post the exact-head J616C (or AVE-enabled Mac) boot + encode row confirming:
    • renamed debugfs root /sys/kernel/debug/apple-ave-<dev> and non-truncated ave-<dev> workqueue with 0 WQ_NAME_LEN warnings;
    • aura still hands over ave0 cleanly with disabled ave1 present in DT, and an H.264/HEVC encode succeeds;
    • regression row: 0 SELinux denials, 0 failed units, 0 new kernel errors.
      (Or convert the PR to draft until the hardware run is posted.)
  2. CI still running: dt-checks is currently IN_PROGRESS on 22112f0f4a21; hold for green dt-checks.

Minor note

  • PR body item 2 has a small typo (in t6041.dtsi / t6041.dtsi).

Assisted-by: LLM (Gemini 4 Neon)

@AxxzyWasTaken

Copy link
Copy Markdown
Contributor Author

J616C (M4 Max 16c/32g) exact-head boot & live Commit-1 verification at 22112f0f4a21 (7.3.0-j616c-pr2778+, Stage 2 1.0.0b14-g6ac0495f):

  1. Exact-head DTB (22112f0f4a21, ave1 disabled by default):
    • Clean boot with /proc/device-tree/video-codec@285100000 (ave1) present and status = "disabled" (matching ave0 until ave1 bootloader firmware handoff is in place); FAILED_UNITS=0, wlan0 UP, 0 errors.
  2. Commit 1 (12402d0cef54) live on 283100000.video-codec (7.3.0-j616c-pr2778+ booted with ave0 enabled from arm64: dts: apple: t6041: enable the first video encoder on every M4 Max #2266 DTB):
    • Per-device debugfs: /sys/kernel/debug/apple-ave-283100000.video-codec/ created cleanly (dart_audit, inject_wedge, last_process0_h264, last_process0_hevc, last_start_h264, last_start_hevc).
    • Per-device workqueue: [kworker/R-ave-283100000.video-codec] created cleanly (25 chars < 31-char limit, zero truncation warnings in dmesg).
    • HW encode + bitstream verification: ffmpeg -f lavfi -i testsrc2=size=1920x1080:rate=30:duration=2 -pix_fmt nv12 -c:v h264_v4l2m2m -b:v 4M on /dev/video13 (apple-ave): encoded 60 frames in 0.67s (2.92x realtime, 1014 KiB, 4224.6 kbits/s), verified clean H.264 decode with ffmpeg -v error -i ... -f null - (exit 0), 0 apple_ave / DART errors, FAILED_UNITS=0.

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

Re-review against pre-pr-checklist.md (§1–§6) at 22112f0f4a21d01386b5665570bf7b99dbd2e7c2: APPROVE.

Verified

  • Prior code & §3 blockers resolved: alloc_ordered_workqueue("ave-%s", ...) keeps workqueue names within WQ_NAME_LEN=32 across every in-tree AVE node (max 28 chars on T6050); Commit 1 (12402d0cef54) documents the cross-SoC apple-ave-<dev> debugfs rename and updates all in-tree docs/READMEs; Commit 2 (22112f0f4a21) records the J616c ADT PMGR table (pmgr_aux 0x2a0..0x2c8, parent chain FAB0_SOC -> VENC1_SYS -> VENC1_DMA -> {PIPE4, PIPE5, ME0 -> ME1}) with all ave1 codec/DART/PMGR nodes kept status = "disabled".
  • CI: 2/2 green on 22112f0f4a21 (dt-checks SUCCESS, host-tests SUCCESS).
  • §5 (Evidence): Exact-head J616C (7.3.0-j616c-pr2778+) verification posted (11:14:40Z):
    • Exact-head DTB boots cleanly with /proc/device-tree/video-codec@285100000 (ave1) present and status = "disabled" (FAILED_UNITS=0, 0 errors).
    • Live Commit-1 run on 283100000.video-codec confirms /sys/kernel/debug/apple-ave-283100000.video-codec/ creation, non-truncated [kworker/R-ave-283100000.video-codec] with 0 WQ_NAME_LEN warnings, and 1080p30 H.264 HW encode (60 frames in 0.67s, 2.92x realtime, clean decode exit 0, 0 apple_ave/DART errors, FAILED_UNITS=0).
  • §1 / §2 / §4 / §6: Clean (both commits carry human author/committer + human Signed-off-by: only, zero AI trailers in commits).

Non-blocking notes

  • The 11:14:40Z log did not explicitly print the SELinux denial count alongside FAILED_UNITS=0 / 0 errors; no regression expected from these changes.
  • Wiring VENC1-SOC-VMAX (perf power domain) stays for the ave1 enablement follow-up on top of #2751.

Ready to queue for merge.

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merge-train adversarial review (MERGETRAIN-LINUX3) at 22112f0: no blockers. Merges clean on integration/aurora 85e255d.

Checked against the code: the per-device workqueue names stay under the 32-byte limit for every in-tree encoder node (longest 28) and the debugfs name fits its buffer; error, remove and suspend/resume paths are untouched; the ave1 node's addresses, IRQs, DART order and VENC1 power offsets match the J616c ADT; no chip/board gates, no module params or delays; both commits carry a human Signed-off-by only.

Follow-ups before ave1 is enabled (not blockers here, ave1 stays status = "disabled")
  1. The firmware check compares every instance against the single loader-provided aurora,ave-text-crc32 / aurora,ave-data-crc32 pair (ave-fw.c, the two property reads). ave1 has its own preloaded firmware in the ADT, so with ave1 enabled it would either fail the check or be validated against ave0's values: the loader needs to hand over per-instance checksums first. "Multiple instances coexist" holds for naming only.
  2. ave1 reuses the T6041 match data that has only been proven on ave0.
  3. ave1 has no perf power domain yet (VENC1-SOC-VMAX exists in the ADT); already deferred to arm64: dts: apple: t6041: wire pmc_soc_max perf floor to AVD and AVE #2751 in the thread.
  4. Lab note: the debugfs root moves from apple-ave/ to a per-device directory, so older lab scripts that read the fixed path need updating (our side, not this PR).

Missing rows: only the J616c (ave0) boot + encode is posted. One boot on any other Mac with a video-encoder node (M1 Pro, M2, J615, J713, Neo J700) showing no workqueue/debugfs name warning would cover the rename on the shared path.

@RyanTheTide
RyanTheTide merged commit 933a43f into aurora-silicon:integration/aurora Nov 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants