Repository navigation
media: apple: avd: runtime and system PM for the frame queue - #707
Closed
RyanTheTide wants to merge 4 commits into
Closed
RyanTheTide wants to merge 4 commits into
RyanTheTide wants to merge 4 commits into
Conversation
Keep power through slot retirement and context drains, restore firmware before retrying reserved frames, and defer DMA releases while the DART is inactive. Re-enable a retained Apple MCPU image before mailbox link setup, without uploading it again. Pause and drain the queue for system sleep and final teardown. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Request the mailbox IRQ without automatic enable, open it only after successful firmware boot, and synchronize and close it after backend suspend. Close the host IRQ on teardown even if the final PM transition fails. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Map only DT-declared PIODMA and SRAM resources and replay the shifted SRAM base before every open CM3 boot. Keep reset, empty-domain attach/detach and firmware reboot ordered; refuse to reboot if the DMA domain cannot be restored. Keep host IRQs closed until old slots are invalidated. Add synthetic-RAM boot replay and recovery-gating KUnit coverage. Queued PIODMA use still requires the DT to describe the DMA stream as well as decode. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Replay PIODMA setup in the common boot dispatcher so queued open transports inherit it even with their own mailbox boot implementation. Keep firmware generation handling and initial-only backend fallback in the same dispatcher, and test the real open boot path through it. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Contributor
Author
|
Closing as merged in content: head 0eaf595 is an ancestor of integration/aurora 43c790f (it came in through merge e2e4736 'Merge branch avd/power-idle into avd/rewrite-integ'), so nothing in this PR is left to land. Deleting the head branch avd/power-idle (tip still 0eaf595, no open PR uses it as a base). Overnight merge train, 11-07. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The frame queue needs to keep power until every slot is FREE and context drains have finished. This adds a common runtime/system PM path, wires both backend suspend/resume ops, drains deferred driver DMA releases before firmware boot, and kicks the queue only after successful boot. Apple resume reuses its boot verification/load/link/ready sequence; the existing firmware generation invalidates old session state. The autosuspend delay remains 100 ms, explicitly [C] pending the capture.
The host mailbox IRQ starts disabled, is enabled only after successful firmware boot, and is synchronized/disabled before the power domain can turn off. Queue hooks retain the frame PM reference through slot release, wake system-drain waiters, and protect streamoff register accesses with a PM reference. System sleep pauses m2m scheduling, drains accepted work, forces suspend, resumes firmware, and restarts scheduling. Teardown drains before reset/cleanup and flushes deferred releases while suppliers are powered.
Open-firmware resume reloads ITCM on every boot, enables the mailbox, writes RUN_CTRL bit 0, and polls FLAG0_SET == 1 at 10 us intervals for up to 10 ms. Suspend writes RUN_CTRL bits 1..3, clears FLAG0, and masks mailbox interrupts. The common boot dispatcher also rewrites PIODMA+0x24 = SRAM physical address >> 4 whenever the DT declares that transport, including recovery boots. Recovery closes the host IRQ, stops firmware, resets the block, attaches/detaches an empty IOMMU paging domain, verifies restoration of the original domain, and then reboots. Core invalidates old slots before reopening the IRQ. A running stream never falls back to another command ABI.
Integration requirements: PIODMA needs both decode and DMA IOMMU streams restored by the supplier; the T6040 DT currently lacks stream 1, and legacy T6000/T8112 DTs lack the named PIODMA aperture. Those DT changes and the DART provider support needed for empty-domain recovery belong to their separate lanes. This driver maps only declared resources and does not synthesize missing apertures or stream IDs. Firmware WFI and FULL-bit not-full interrupts remain firmware integration work; no unverified interrupt mask is enabled here.
Ten PM KUnit cases cover all-slot/drain suspend gating, deferred releases, boot-failure rollback, reserved-only replay through the real queue worker, repeated ITCM/PIODMA boot setup, and recovery guards/failure handling.
Validation:
git diff --checkpasses. Checkpatch reports 0 errors and 0 warnings with its generic FILE_PATH_CHANGES notice excluded. The lead test shell and retained-session Python pass syntax checks. Buildbox arm64 LLVM W=1 CONFIG_WERROR=y, QEMU KUnit, and host-test runs have been requested but have not executed; build capacity is currently unavailable. No target hardware was requested or measured by this worker.Source:
0eaf5955fb6e2ea01d12e18435c07eec1e9cec99, based onavd/rewrite-coreata116172.The base branch still marks the Borage transport facts unverified. This PM change does not invent the missing ITCM/link/reply register offsets or claim measured retention, bus-idle timing, or power savings. Keep this draft until the lead qualifies both available backends.
Lead power qualification (run through a controller request with the exact device identity and policy approval; no direct target transport): install the built kernel and separately supplied firmware using the normal bootguard-protected workflow. Use the same hashed sample set before and after this series. Keep raw logs on the lab machine; publish only sanitized outcomes and aggregate watts.
Run the following commands inside the approved target execution. They open video only and send decoded output to a null sink.
Pass criteria: each supported codec decodes after 2/10/120 seconds; runtime status reaches suspended between bursts; the paced decode survives s2idle; no AVD timeout, DART fault, lockdep warning or failed unmap; no retained mapping after closed-stream teardown. Repeat the idle/decode watts sample three times on the baseline and this kernel, with identical boot/display/network conditions, and report median idle watts, decoding watts, and their difference. Do not change the 100 ms delay until the idle-timer capture settles it.