Skip to content

media/dts: apple: enable the T6000 AVE DMA fault reporter with runtime PM - #2811

Draft
RyanTheTide wants to merge 2 commits into
mainfrom
dtgaps8/ave-dma-runtime-pm-v2
Draft

RyanTheTide wants to merge 2 commits into
mainfrom
dtgaps8/ave-dma-runtime-pm-v2

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Replaces #1861 (same changes, commit trailers fixed, on the current integration/aurora).

The AVE auxiliary DMA fault reporter (dma-controller@40d020000, apple,t6000-ave-dma) already
has a driver in tree, but its DT node ships disabled on T6000, so the reporter never binds and AVE
DMA faults go unreported. Enabling the node as it stands would pin ps_venc_sys on: the driver only
requested its shared fault interrupt and never touched runtime PM, so once the device bound genpd
counted it as active and kept the encoder's power domain up for good, losing the AVE idle power
saving.

Two commits:

  1. media: apple/ave: enable runtime PM in the reporter and leave it runtime-suspended, the same
    way the codec DARTs it shares venc_sys (and the fault interrupt) with already behave, so genpd
    can gate the domain again. A DMA fault can only be raised, and the shared interrupt only asserted,
    while the encoder is running and the domain is powered, so the fault handler always reads
    registers in a powered domain. The domain is live at bind, so the probe starts active and drops
    the vote once the handler is installed.

  2. arm64: dts: apple: t6000: enable dma-controller@40d020000 next to the video encoder and the
    DARTs it sits alongside in venc_sys. T6001 and T6002 keep theirs disabled until the binding is
    proven on that hardware.

Tests

  • CI: dt-checks (incl. apple,ave-dma.yaml) and host-tests pass.
  • M1 Pro (j316s, T6000), test kernel 7.3.0-aurora-fleet72dg8 = this branch on integration/aurora,
    one-shot boots: clean to multi-user + Wi-Fi, s2idle 3/3, 0 AVC / SError / oops, 0 DMA fault:
    lines; H.264 encode unaffected (1080p 129 fps, High-B 146 fps, 4K 38.8 fps, 0 decode errors).
    The runtime-PM change is inert while the node is disabled (the driver never probes), so this
    confirms no regression from carrying it.
  • genpd on that kernel shows the gating the reporter joins: venc_sys is off at idle with its
    children (venc_dma, venc_pipe4/5, venc_me0/1) and the codec devices all suspended. The fix
    mirrors the apple-dart runtime-PM pattern those DARTs already use in the same domain.

Node-bind row: pending a Stage 2 DTB refresh

Proving the reporter actually binds the enabled node needs ave0_dma enabled in the DTB the Mac
loads at boot, i.e. a Stage 2 DTB refresh — the same step #1687 and #1760 need on their Macs to
go live. The two lighter mechanisms don't apply here: a runtime DT overlay can't re-trigger
platform-device creation on a status flip of a base node, and the M1 Pro aura-try reproduce guard
can't match because this Mac's committed boot.bin is stale against its current update-m1n1
config (built before the m1n1/u-boot bumps, not refreshed at the fleet72 promotion). Staying draft
until the row runs on a refreshed M1 Pro Stage 2 DTB.

The AVE auxiliary DMA fault reporter lives in the venc_sys power domain,
which the encoder and its DARTs gate whenever the codec is idle. The
driver requested its shared fault interrupt but never touched runtime PM,
so once the device bound genpd counted it as active and kept ps_venc_sys
powered for good, defeating the encoder's idle power saving.

Enable runtime PM and leave the reporter runtime-suspended. A DMA fault
can only be raised, and the interrupt it shares with the codec DARTs only
asserted, while the encoder is running and the domain is therefore
powered, so the fault handler always reads registers in a powered domain.
The domain is live at bind (the codec DARTs are already up), so start
active and drop the vote once the handler is installed, letting genpd
gate venc_sys with the rest of the encoder.

Signed-off-by: Ryan Murray <[email protected]>
Now that apple-ave-dma participates in runtime PM and no longer pins
ps_venc_sys, enable the auxiliary DMA fault reporter on T6000 alongside
the video encoder and the DARTs it shares the venc_sys domain and fault
interrupt with. T6001 and T6002 keep theirs disabled until the binding is
proven on that hardware.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Review at 65a5219 (non-author, draft). Changes requested: the interrupt handler can read the block's registers while its power domain is off.

  • Merges cleanly on integration/aurora 6748d83. Two commits, human trailers only.
  • The runtime-PM sequence in probe is balanced: pm_runtime_get_noresume() + set_active + devm_pm_runtime_enable(), put_noidle on both error paths, pm_runtime_put() once the handler is installed; devres frees the IRQ before it disables runtime PM. With that the bound device no longer holds ps_venc_sys on, which is the point of the first commit.
  • The node, its interrupt (AIC 1028, shared with ave_dart0 and ave_dart1) and its ps_venc_sys domain are already described; the DT commit only flips status.

Change needed:

  • apple_ave_dma_irq() (apple-ave-dma.c:27-31) reads AVE_DMA_ERROR_STATUS unconditionally, and after this PR the device is runtime-suspended whenever it is idle, with venc_sys off (the body's own genpd listing). The commit message argues the line can only assert while the encoder runs. That does not cover calls that are not caused by this block:
    • CONFIG_DEBUG_SHIRQ=y (set in aurora-base.config in arm64: configs: one kernel configuration for every Mac (aurora_defconfig) #2803 and in the kernels on the test machines) makes free_irq() call every IRQF_SHARED handler once. On unbind or rmmod apple-ave-dma the core does pm_runtime_put_sync() before devres releases the IRQ, so with the encoder idle that extra call reads a powered-down block.
    • The line is shared with two DARTs. apple-dart does not rely on "asserted means powered" for the same line: apple_dart_irq() takes pm_runtime_resume_and_get() around its register access and its comment says a read of a powered-down block stalls the CPU.
      Please guard the handler the same way the DARTs on this line do (resume the device for the duration of the handler, or make it a threaded handler that takes a runtime-PM reference), and add a row: with the encoder idle and venc_sys off, unbind and rebind the reporter, no stall.

Small points, not blocking:

  • T6001 and T6002 have the same block (same node, same compatible, same interrupt and domain), and T6001 already enables the encoder and its DARTs in t6001.dtsi, which t6000.dtsi includes. Enabling the reporter only in t6000.dtsi makes it a per-SoC difference for one block. Either enable it next to &ave in t6001.dtsi (so T6000 inherits it), or coordinate with arm64: dts: apple: t6001, t6002: enable every video encoder #2295, which enables the remaining T6001/T6002 encoders, so the reporter goes on with them.
  • The node-bind row is still open (the body explains why). When it runs, please include the genpd state of venc_sys at idle with the reporter bound, since "does not pin the domain" is the claim of the first commit and has only been shown with the node disabled.

Assisted-by: LLM (Claude:Opus 5.5)

This branch has not been deployed

No deployments
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.

1 participant