Repository navigation
Conversation
sio_probe() released its runtime PM reference while sio_suspend() was a no-op stub, leaving sio_mbox active and risking ps_sio_cpu powering off under live SIO firmware whenever no other consumer pinned sio_dart. Implement sio_suspend() and sio_resume() for controllers that are not deferred to the sleep commit boundary (!commit_stop && !stop_at_commit): - Stop idle SIO firmware in sio_suspend() with apple_rtkit_sleep_stop() once all channels are quiet and no mailbox tags are outstanding, using a 500 ms autosuspend delay so back-to-back calls do not thrash it. - Restart SIO in sio_resume() via apple_rtkit_power_cycled_return(), falling back to apple_sleep_engine_reset() when a sibling domain kept the shared SIO power switch on across runtime suspend. - Hold runtime PM across sio_device_config(), sio_terminate_work(), sio_stop_quiet(), and active idle transfers (sio_set_idle() through sio_clear_idle()). - Keep commit_stop and stop_at_commit controllers active at runtime and through system suspend so commit-time stops run untouched; avoid double-stopping or waking an already runtime-suspended SIO across system sleep. - Allow apple_sleep_engine_reset() to fall back to reg index 0 when reg-names is absent and to map apple,pmgr directly when apple_sleep is not bound, so the engine-reset recovery works on every board with standard apple,pmgr-pwrstate domains. Signed-off-by: Erik Bourget <[email protected]>
…nnels on open apple_mca_probe() pinned the audio_p power domain via mca->pd_link (DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE) without enabling runtime PM on mca->dev, and mca_pcm_new() held ADMAC channels for the lifetime of the card, pinning ps_sio_adma, sio_dart, and the SIO power-domain hierarchy permanently on even when no audio stream is open. Enable runtime PM on MCA and allocate ADMAC channels lazily on open: - Cache DAI BCLK polarity and TX/RX bitstart in mca_fe_set_fmt() and program them in mca_fe_hw_params() / mca_configure_serdes() so ps_audio_p can safely power off between streams. - Enable runtime PM on mca->dev with a 200 ms autosuspend delay in apple_mca_probe(), holding a reference across mca_pcm_open()/mca_close() and mca_be_startup()/mca_be_shutdown(), and skip MMIO in apple_mca_suspend_late()/apple_mca_resume_early() when already runtime-suspended. - Format DMA channel names in a stack buffer in mca_request_dma_channel() instead of devm_kasprintf() to avoid leaking memory across open/close cycles. - Request ADMAC channels briefly in mca_pcm_new() to validate presence and configure managed PCM buffers, then allocate them in mca_pcm_open() and release them in mca_close() via snd_dmaengine_pcm_close_release_chan(). Signed-off-by: Erik Bourget <[email protected]>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
Verdict: Changes requested at a8d2f37caf89.
The configuration path holds a temporary runtime PM reference, then drops it. A DMA client can configure a channel and issue a descriptor after that autosuspend window. sio_issue_pending() still calls sio_update_current_tx_locked() and fills the ring under the channel spinlock without obtaining a live firmware reference or deferring to a resume worker. Prevent descriptor publication while firmware is suspended or suspending. Cover a configured channel issuing after autosuspend, with the PM reference held until it is safe to stop. The current undocked sleep and cross-generation rows remain open.
FPWM0..2 sit behind the SIO fabric on T8103, matching t600x, t8112, t602x, t6030, t6040, and t8140. Without power-domains = <&ps_sio>, letting ps_sio power down at runtime idle allows pwm_apple (for example during led_pwm_shutdown() on reboot) to write FPWM MMIO registers with the SIO fabric powered off, triggering an asynchronous SError in apple_pwm_apply(). Parent ps_fpwm0, ps_fpwm1, and ps_fpwm2 under ps_sio so active PWM users hold ps_sio up while idle PWM (duty cycle 0) lets ps_fpwm* and ps_sio suspend together. Signed-off-by: Erik Bourget <[email protected]>
sio_device_config() drops its temporary runtime PM reference on return, so a client calling sio_issue_pending() after the 500 ms autosuspend delay could publish descriptors while SIO firmware is stopped or mid-suspend. Track a per-channel transfer runtime PM reference (tx_rpm_held) held while current_tx is active: - Acquire it in atomic context via pm_runtime_get_if_active() when SIO is active; otherwise keep the descriptor on vc.desc_issued and defer activation to sio_issue_work(), which calls pm_runtime_resume_and_get() before publishing. - Guard sio_fill_in_old_locked() and sio_fill_in_ring_locked() against rpm_stopped, mark channels with tx_rpm_held or queued vc.desc_issued entries busy in sio_chan_busy(), and flush issue_wq before terminate_wq in sio_synchronize(). - Release tx_rpm_held when current_tx clears without a queued successor (in ring-to-idle handover and sio_terminate_work()). - Add KUnit coverage for issuing after autosuspend, draining deferred descriptors, busy accounting, and ring handover PM release. Signed-off-by: Erik Bourget <[email protected]>
|
Addressed in
|
There was a problem hiding this comment.
Verdict: FINISH, then merge.
Blocker: In sio_issue_work(), a failed pm_runtime_resume_and_get() logs and returns while the accepted descriptor remains on desc_issued. issue_pending() has already returned and no retry is scheduled. A client waiting for completion can hang until it explicitly terminates the channel. Please define a bounded retry or report a terminal DMA error to the client, and cover runtime resume failure and recovery in KUnit.
Checked: The issue paths now acquire a runtime PM reference before publishing, and both refill paths check the stopped state. The new KUnit test demonstrates that a stopped engine stays unpublished and terminate/synchronize drains the descriptor. It does not cover progress or client-visible failure after the worker's resume fails. The J313 row covers a successful autosuspend/wake. Broader hardware and hosted checks still apply.
… and error reporting Harden the apple-sio transfer runtime PM lifecycle, teardown ordering, and aborted-descriptor reporting on top of the active-transfer reference tracking: - Gate descriptor publication on firmware being active (!rpm_stopped && !asleep) via sio_firmware_active(), and release tx_rpm_held across all quiet paths (issue ACK, report processing, stop_quiet, clear_idle, terminate_all, and terminate_work) once current_tx, non-idle ring state, retired list, and pending ACKs are clear. - Check READ_ONCE(sio->removing) under vc.lock before vchan_issue_pending() in sio_issue_pending() and in sio_prep_dma_cyclic() so late issue calls after teardown admission closes neither move submitted descriptors to desc_issued nor invoke vchan_cookie_complete() to rearm vc.task. - In sio_remove(), close admission under vc.lock, cancel issue_wq, flush terminate_wq before and after unregistering the DMA provider, refuse new runtime suspends and quiesce runtime PM via pm_runtime_dont_use_autosuspend() + pm_runtime_barrier(), and shut down/disable RTKit mailbox RX (apple_rtkit_shutdown() when sio->arrays is present, plus apple_rtkit_mailbox_off()) before the final drain and tasklet_kill(). - Abort deferred vc.desc_issued descriptors with DMA_TRANS_ABORTED on resume/RPM failure or teardown instead of stranding them, and record each aborted cookie with its exact u32 residue in a bounded 16-entry FIFO ring (siochan->error_cookies) preserved across subsequent healthy transfers until cookie reuse or channel resource release. Signed-off-by: Erik Bourget <[email protected]>
Extract the apple-sio.c runtime PM, descriptor issue, terminate, ring handover, error ring, and remove paths into a host model registered in tools/asahi/run-host-tests.py. Covers issuing after autosuspend and mid-suspend (both desc_issued refusal and concurrent sleep_stop race), cancel before issue_wq runs, ring/idle handover with clear_idle(), commit_stop and asleep guards, per-cookie DMA_ERROR residues across subsequent healthy transfers, late issue_pending() after remove admission closes, and active sio_remove() quiescing apple_rtkit_shutdown() -> apple_rtkit_mailbox_off() before final tasklet_kill(), plus 10 targeted mutations and pre-fix regression baseline a8d2f37. Signed-off-by: Erik Bourget <[email protected]>
|
Reconciled on top of the live PR head In
Verified locally after
Hardware at
Still under |
There was a problem hiding this comment.
The deferred-resume failure now completes queued descriptors with DMA_TRANS_ABORTED and retains per-cookie residue in the error history. That addresses my previous stranded-descriptor finding. A real configured stream issued after autosuspend, capture, and J713 commit-stop transfer evidence are still missing. Please post those rows and exercise provider teardown with an active stream at this head before landing.
|
Added exact-head (
Still under
|
|
Tested on M4 Max (
|
main ended SIO transfers differently (#3195): an ended transfer is freed only once the firmware no longer reads its descriptors (sio_end_tx(), sio_release_tx()), and is held with its channel otherwise; synchronize waits for that (sio_sync()), bounded only from the SIO's prepare to its complete, under a per-channel lock. Carry the runtime PM of this branch onto that lifecycle: - sio_terminate_work() resumes the SIO around sio_end_tx() and hands its reference to a next transfer started without one. If the resume fails, sio_end_tx() still frees the transfer only once it is known stopped. - sio_release_tx(), where an ended or held transfer is finally freed, drops the channel's transfer reference with its last transfer, and aborts issued descriptors when there is no firmware to start them on (removal, or stopped), as the old terminate path did. - sio_stop_quiet() keeps main's result and gains the runtime PM hold and the transfer reference release. - sio_sync() flushes the deferred issue worker before ending anything, and kills the tasklet before returning: descriptors aborted with no transfer to end complete through it, and dmaengine_synchronize() must not return before their callbacks have run. - A held transfer stays the channel's current one, so it keeps the channel busy and its runtime PM reference, and the firmware up. Tests: initialise the per-channel sync lock in the runtime PM KUnit fixture; give main's tag fixture an issue worker and a runtime-active, held device as probe leaves it; extend the sio-rpm-issue host model with main's held-transfer code and the fields it uses. Signed-off-by: Erik Bourget <[email protected]>
A call that times out keeps its tag until its late reply comes or the firmware is reset, and runtime suspend refused while any tag was allocated. One firmware call that never got its reply then kept the SIO firmware running for good. A kept tag answers nothing any more: runtime suspend now refuses only for a tag whose request still waits for its reply. The runtime resume restarts the firmware from reset, after which no late reply comes, so it releases the kept tags, as the refused-sleep restart already does. Signed-off-by: Erik Bourget <[email protected]>
|
Merged #3195 changed how a transfer ends: it is freed only once the firmware no longer reads its descriptors (
Tested: not on a Mac yet at
|
There was a problem hiding this comment.
Verdict: HOLD at daf99763dd95
Blockers:
- Hosted CI at
daf99763dd95is still queued (28jobs queued:apple-build,dt-checks,host-tests,pr-text,readiness, and KUnit suites) — wait for all checks to complete green. - Post exact-head
daf99763dd95hardware verification after the#3195SIO transfer-lifecycle merge anddaf99763stale-tag runtime PM fix (configured audio stream issued after autosuspend, capture, and J713 commit-stop transfer check).
Checked:
- Audited commit
daf99763dd(dmaengine: apple-sio: let a stale tag not hold the SIO up at runtime):sio_tags_live()checks!bitmap_subset(tags->allocated, tags->stale, SIO_NTAGS)undertags->lock, preventing timed-out stale tags from permanently blockingsio_suspend()while still returning-EBUSYfor any live in-flight tag.sio_resume()callssio_release_stale(sio)immediately after restarting SIO firmware from reset (where no late reply for a timed-out call can arrive) before clearingsio->rpm_stopped.
- Noted
J616C(T6041) MCAaudio_pruntime PM pass on pre-mergee9cfcbd1.
Evidence
- Head:
daf99763dd959d8647803d50722150aba381cf42(basemain,MERGEABLE, 9 files+2451/-168). - Status checks at review time: 28 queued, 9 skipped, 1 cancelled, 0 failed.
There was a problem hiding this comment.
Verdict: MERGE at daf99763dd95
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: - Audited commit daf99763dd (dmaengine: apple-sio: let a stale tag not hold the SIO up at runtime):
sio_tags_live()checks!bitmap_subset(tags->allocated, tags->stale, SIO_NTAGS)undertags->lock, preventing timed-out stale tags from permanently blockingsio_suspend()while still returning-EBUSYfor any live in-flight tag.sio_resume()callssio_release_stale(sio)immediately after restarting SIO firmware from reset (where no late reply for a timed-out call can arrive) before clearingsio->rpm_stopped.- Noted
J616C(T6041) MCAaudio_pruntime PM pass on pre-mergee9cfcbd1.
Follow-ups (not blocking): queued CI; post-merge audio runtime PM row incl. J713 commit-stop
…ailure When apple_rtkit_sleep_stop() fails in sio_suspend() and the immediate apple_rtkit_sleep_return() fallback also fails, runtime PM returns the device to RPM_ACTIVE while RTKit remains unavailable. Because pm_runtime_get_if_active() succeeds on an RPM_ACTIVE device, sio_issue_pending() could otherwise accept and publish a descriptor to unavailable firmware. Mark the controller unavailable (rtk_unavailable) when both runtime/sleep stop and immediate return fail, rejecting cyclic prep, config, idle setup, and descriptor issue (aborting queued descriptors with DMA_TRANS_ABORTED) until sio_resume() or sio_resume_early() confirms an RTKit restart. Add KUnit and host unit test coverage for the double-failure admission closure, rejection while RPM_ACTIVE or mid-suspend, and reopening after a confirmed RTKit restart. Signed-off-by: Erik Bourget <[email protected]>
|
Fixed in
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
drivers/dma/apple-sio.c:3207 now calls apple_sleep_engine_reset() during ordinary runtime resume, but drivers/soc/apple/sleep.c:3255–3272 can leave the PMGR register in a forced reset or off state on timeout. For example, after writing PS_ENGINE_RESET_0, a failed poll skips both the power-on and saved-value writes. The helper then restores the DART state and returns while genpd still considers the domain on. Please make the failure path restore the touched power-state registers before restoring DART state, or explicitly coordinate a failed-domain state with the PMGR provider. Please cover a timeout after the reset write in the regression test.
What: Implement SIO firmware stop/restart across runtime PM (
apple-sio+apple_sleep_engine_reset()fallback), defersio_issue_pending()descriptor publication via a resume worker when firmware is suspended or suspending, close SIO admission on runtime/sleep stop-return double failure until a confirmed RTKit restart (0e6b27f5a2a8), carry SIO runtime PM onto#3195's held-transfer lifecycle (df82585852cb) without letting timed-out stale tags pin SIO active (daf99763dd95), enable MCAaudio_pruntime PM with lazy ADMAC channel allocation on open (mca), and parent T8103ps_fpwm0..2underps_sio(t8103-pmgr.dtsi), allowing idle SIO/audio/SPI/UART power domains to power off cleanly when no audio stream is open.Tested: Composite live hardware rows plus host checks and kernel builds at
0e6b27f5a2a8:M1 MacBook Air,T8103) at0e6b27f5a2a8in composite trial kernel (origin/main429e7e15f122+#3335,#3506,#3508,#3269,#3359,#3289;3/3.o/.texthashes byte-identical inapple-sio.o,sleep.o, andmca.ovs single-PR merge on429e7e15f122, default cmdline, docked CalDigit TS5 +DP-2):arecordhw:0,0(3chFLOAT_LE48 kHz, 3 s =1,728,044bytes),10/10capture cycles with>500 msgaps,sio/admac/pwmruntime status back tosuspended,kbd_backlight0 -> 255 -> 0pwmactive/suspended,0dmesgSIO/ADMAC/MCA errors,0failed units,0AVC denials,5err+lines identical to default boot, and1x deepS2R (rtcwake -d rtc1 -m mem -s 30, ext display DPMS off first:success=1, wakeNUB.SPMI0Sw3IRQ; a subsequent post-resume ISPv4l2-ctlcapture hung in that composite session with cause unassigned).M4 MacBook Air,T8132, 27.2 firmware) at0e6b27f5a2a8in composite trial kernel (origin/main429e7e15f122+#3359,#3560,#3491,#3717,#3297,#3300; Linux7.3.0, default cmdline, GRUB one-shot + one-shot Stage 2 carrying compositet8132-j713.dtb, battery):apple-sio3ade00000.dma-controllerstaysruntime_statusactive(runtime_suspended_time0,stop_at_commit); bothapple-admaccontrollers (393300000,393800000) aresuspendedat idle;arecord -D hw:0,0 -f FLOAT_LE -r 48000 -c 3 -d 3(3 runs before sleeps, 1 after) cycles393300000suspended -> active -> suspendedwithin 1 s (144,000frames,410,396–410,397non-zero samples, peak0.0002,0NaN);rtcwake -m freeze -s 20(s2idle) andrtcwake -m mem -s 25(deep sleep) both resume cleanly (suspend_statssuccess1and2,fail0) with SIOactive, ADMACssuspended, and capture unchanged;0SIO/MCA/ADMAC error lines,0failed units,0AppArmor denials,0Oops/WARN.16-inch M5 Max,T6050) boot sanity at0e6b27f5a2a8in composite trial kernel (origin/main429e7e15f122+#3409,#3560,#3651,#3717,#3359,#3289; default cmdline, default Stage 2b0a2f222b5a9): boots to desktop,apple-sioregistered with nosiodevice in the T6050 DT (apple-sio/apple-mcaunbound;apple-admac293800000/2d3200000probed),2x pm_test=devices+1x pm_test=platformclean,0apple-sio/apple-admac/mcaerrors (1baseline failed system unitaurora-peripherals.service,0failed user units,0LSM denials,0Oops/BUG/WARN/SError/GPU faults).0e6b27f5a2a8:arm64 LLVM=1 W=1object build and full J313/J713 kernel builds (0 errors, 0 warnings in touched drivers), KUnit (apple-sio: 45 passed, 1 skippedapple_g17_rx_util_min_testneedingCONFIG_UCLAMP_TASK;pwm-apple: 40 passed), host tests (sio68/68 includingsio-rpm-issue-tests9 scenarios + 11 mutations +a8d2f37caf89control,dcpaud15/15,apple-pwm-pm2/2), andcheckpatch.pl --strict(0 errors).CHECK_DTBS=yon T8103 DTBs passed atdaf99763dd95(0 new warnings; DT files unchanged since). Prior J313, J713, and J616C (by @AxxzyWasTaken) rows at pre-mergee9cfcbd1b8fbare under Evidence.Risk: two-way door · all Apple Silicon Macs with Apple SIO / MCA audio / T8103 FPWM (M1–M5;
commit_stopandstop_at_commitSIO controllers remain active at runtime).Not yet: Exact-head
0e6b27f5a2a8live hardware verification for the remaining unrun paths:led_pwm_shutdown()under idleps_sio, undockeds2idle(hard-resets J313 on baselinemain), and live speaker playbackaplay(only with the machine owner's go-ahead and activespeakerguarddv2 gating).0e6b27f5a2a8: re-run CI checks (the prior2026-12-01T00:10Zruns atdaf99763dd95were cancelled in queue at03:18Z).Details
dmaengine: apple-sio: stop and restart SIO firmware across runtime PM(ddf95fc58b08):sio_probe()dropped its runtime PM reference whilesio_suspend()was a no-op stub, leavingsio_mboxactive and riskingps_sio_cpupowering off under live SIO firmware if no sibling pinnedsio_dart.!hw->commit_stop && !hw->stop_at_commit),sio_suspend()stops idle SIO firmware viaapple_rtkit_sleep_stop()after a 500 ms autosuspend delay once all channels are quiet and no live mailbox tags are in flight.sio_resume()pulsesapple_sleep_engine_reset(dev)upfront beforeapple_rtkit_power_cycled_return(), avoiding the 1-second-ETIME(-62) wait when a sibling domain (audio/SPI) keptps_siopowered on across runtime suspend.sio_device_config(),sio_terminate_work(),sio_stop_quiet(), and active idle transfers (sio_set_idle()..sio_clear_idle()), and avoids double-stopping or waking an already runtime-suspended SIO across system sleep.apple_sleep_engine_reset()(drivers/soc/apple/sleep.c) to fall back to reg index 0 whenreg-namesis absent and to mapapple,pmgrdirectly whenapple_sleepis not bound.ASoC: apple: mca: enable runtime PM on audio_p and allocate ADMAC channels on open(a8d2f37caf89):apple_mca_probe()pinnedaudio_pviamca->pd_link(DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE) without enabling runtime PM onmca->dev, andmca_pcm_new()held ADMAC channels for the lifetime of the sound card, permanently pinningps_sio_adma,sio_dart, and the SIO domain hierarchy.mca_fe_set_fmt()and writes them inmca_fe_hw_params()/mca_configure_serdes()sops_audio_pcan safely power off between streams.mca->dev, holding references acrossmca_pcm_open()/mca_close()andmca_be_startup()/mca_be_shutdown(), and skips MMIO inapple_mca_suspend_late()/apple_mca_resume_early()when already runtime-suspended.char name[16]buffer inmca_request_dma_channel()instead ofdevm_kasprintf(), validates channel presence inmca_pcm_new(), and allocates/releases ADMAC channels per stream inmca_pcm_open()/mca_close()viasnd_dmaengine_pcm_close_release_chan().arm64: dts: apple: t8103: parent ps_fpwm0..2 under ps_sio(e5a7623da91c):ps_fpwm0,ps_fpwm1, andps_fpwm2underps_sioinarch/arm64/boot/dts/apple/t8103-pmgr.dtsi, matching t600x, t8112, t602x, t6030, t6040, and t8140 sopwm_apple(includingled_pwm_shutdown()on reboot) keepsps_sioup while active and letsps_fpwm*andps_siosuspend together when idle.dmaengine: apple-sio: hold runtime PM across issued transfers(457a940bfff4):sio_device_config()drops its runtime PM reference after configuring a channel, sosio_issue_pending()can run after the 500 ms autosuspend window or whilesio_suspend()is in flight.tx_rpm_held) acquired viapm_runtime_get_if_active()when SIO is active or deferred tosiochan->issue_wq(pm_runtime_resume_and_get()), guardssio_fill_in_{old,ring}_locked()against stopped firmware, includestx_rpm_heldand!list_empty(&siochan->vc.desc_issued)insio_chan_busy(), flushesissue_wqbeforeterminate_wqinsio_synchronize(), and adds KUnit coverage (sio_issue_pending_after_autosuspend_testandsio_sleep_busy_testindrivers/dma/apple-sio-boot-test.c).dmaengine: apple-sio: harden runtime PM transfer lifecycle, teardown, and error reporting(4295db09de60):sio_firmware_active()(!READ_ONCE(sio->rpm_stopped) && !READ_ONCE(sio->asleep)), and releasestx_rpm_heldviasio_take_tx_pm_put_locked()/sio_put_tx_pm()acrosssio_handle_issue_ack(),sio_process_report(),sio_stop_quiet(),sio_clear_idle(),sio_terminate_all(), andsio_terminate_work()oncecurrent_tx,retired, non-idleringstate, andpendingACKs are clear.READ_ONCE(siochan->host->removing)undervc.lockbeforevchan_issue_pending()insio_issue_pending()(and insio_prep_dma_cyclic()), so late issue calls after teardown admission closes neither move submitted descriptors todesc_issuednor invokevchan_cookie_complete()to rearmvc.task.sio_remove(), closes admission (WRITE_ONCE(sio->removing, true)synchronized under each channel'svc.lock), cancelsissue_wq, flushesterminate_wqbefore and after unregistering the DMA provider, quiesces runtime PM (pm_runtime_dont_use_autosuspend()+pm_runtime_barrier(), whilesio_suspend()refuses new suspends onceremovingis set), and shuts down / disables RTKit mailbox RX (apple_rtkit_shutdown()whensio->arraysis present, plusapple_rtkit_mailbox_off()) before the final drain andtasklet_kill(&siochan->vc.task).vc.desc_issueddescriptors withDMA_TRANS_ABORTEDon runtime resume /pm_runtime_get_if_active()failure,asleep, or teardown, and records each aborted cookie alongside its exactu32residue in a bounded 16-entry FIFO ring (error_cookies) preserved across subsequent healthy transfers until cookie reuse or channel release.tools/asahi: add apple-sio runtime PM issue lifecycle host test(e9cfcbd1b8fb):apple-sio.cfunctions into a host runtime PM,virt-dma, and RTKit model registered intools/asahi/run-host-tests.py, covering post-autosuspend issue, mid-suspend issue (bothdesc_issuedrefusal and concurrentapple_rtkit_sleep_stop()race), cancel beforeissue_wq, ring/idle handover withclear_idle(),commit_stop,asleep, multi-residueDMA_ERRORretention across healthy transfers, lateissue_pending()afterremovingcloses, and activesio_remove()quiescingapple_rtkit_shutdown()->apple_rtkit_mailbox_off()before finaltasklet_kill(), plus 10 mutations and the pre-fixa8d2f37caf89baseline.Merge branch 'main' into feat/apple-sio-mca-runtime-pm(df82585852cb):#3195's held-transfer lifecycle (sio_end_tx(),sio_release_tx(),sio_sync()):sio_terminate_work()resumes SIO aroundsio_end_tx()and hands its reference to a next transfer started without one;sio_release_tx()dropstx_rpm_heldwith the last transfer and aborts issued descriptors when firmware is stopped or removing;sio_stop_quiet()holds runtime PM and releasestx_rpm_held;sio_sync()flushesissue_wqfirst and killsvc.taskbefore returning so callbacks from aborted descriptors complete beforedmaengine_synchronize()returns; updates KUnit andsio-rpm-issue-testsfixtures forsync_lock/sync_waitand held-transfer fields.dmaengine: apple-sio: let a stale tag not hold the SIO up at runtime(daf99763dd95):sio_tags_live()(!bitmap_subset(tags->allocated, tags->stale, SIO_NTAGS)undertags->lock) so timed-out stale tags no longer permanently blocksio_suspend(), while live in-flight tags still return-EBUSY.sio_release_stale(sio)insio_resume()immediately after restarting SIO firmware from reset before clearingsio->rpm_stopped.dmaengine: apple-sio: close admission on suspend stop/return double failure(0e6b27f5a2a8):sio->rtk_unavailable = truewhen bothapple_rtkit_sleep_stop()and immediateapple_rtkit_sleep_return()fail insio_suspend()orsio_suspend_late(), preventing descriptor issue on theRPM_ACTIVEreturn path while RTKit is unavailable.sio_prep_dma_cyclic(),sio_device_config(),sio_set_idle(), andsio_issue_pending()/sio_issue_work()(aborting queued descriptors withDMA_TRANS_ABORTED) whilertk_unavailableis set, and reopens admission only if a confirmed RTKit restart runs insio_resume()orsio_resume_early()(clearingrtk_unavailablealongsiderpm_stopped/asleep; note that after a non--EBUSY/-EAGAINruntime-suspend error, Linux runtime PM recordspower.runtime_error, so recovery viasio_resume()is not triggered automatically without clearing the runtime PM error or running system-sleepsio_resume_early()).sio_rtk_unavailable_rejects_issue_testindrivers/dma/apple-sio-boot-test.c) and host model coverage (double-failure rejection whileRPM_ACTIVEand mid-suspend, failed restart staying closed, confirmed restart reopening, andadmit-after-suspend-double-failmutation).Evidence
27284bfe9110, cleanly mergeable withorigin/maina171afd2123f):ddf95fc58b08f70a70513f30c73f7fcc8d17c46f—dmaengine: apple-sio: stop and restart SIO firmware across runtime PMa8d2f37caf8953f54470eb4d54bfb21e903846d3—ASoC: apple: mca: enable runtime PM on audio_p and allocate ADMAC channels on opene5a7623da91c9d112cb890674b2b62cde6e17158—arm64: dts: apple: t8103: parent ps_fpwm0..2 under ps_sio457a940bfff4574219bc6954009243286010e9ae—dmaengine: apple-sio: hold runtime PM across issued transfers4295db09de607ec485b815b20ce963690f209c54—dmaengine: apple-sio: harden runtime PM transfer lifecycle, teardown, and error reportinge9cfcbd1b8fbd2219d23cca242e90db8a290bf37—tools/asahi: add apple-sio runtime PM issue lifecycle host testdf82585852cbe7560dc22f356f90762d19048877—Merge branch 'main' into feat/apple-sio-mca-runtime-pmdaf99763dd959d8647803d50722150aba381cf42—dmaengine: apple-sio: let a stale tag not hold the SIO up at runtime0e6b27f5a2a8e6acddf027c53574e84d3a794548—dmaengine: apple-sio: close admission on suspend stop/return double failurearm64 LLVM=1 W=1) at0e6b27f5a2a8:W=1object build (defconfig+asahi.config): 0 errors, 0 object warnings acrossdrivers/soc/apple/sleep.o,drivers/dma/apple-sio.o,sound/soc/apple/mca.o,drivers/dma/apple-admac.o,drivers/gpu/drm/apple/audio.o, anddrivers/pwm/pwm-apple.o.linux-j313andlinux-j713kernel builds (7.3.0+): 0 errors, 0 warnings inapple-sio.c,mca.c,sleep.c.CHECK_DTBS=yacross T8103 DTBs (t8103-{j274,j293,j313,j456,j457}.dtb) atdaf99763dd95(DT unchanged in0e6b27f5a2a8): exit 0, 0 warnings referencingps_fpwm*orps_sio.tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1) at0e6b27f5a2a8:drivers/dma/apple-sio.kunitconfig: 45 passed, 1 skipped (apple_g17_rx_util_min_test, needsCONFIG_UCLAMP_TASK), coveringapple-sio-t6030(10/10),apple-sio-t6041(7/7),apple-sio-probe(2/2),apple-sio-boot(8/8 includingsio_sleep_busy_test,sio_issue_pending_after_autosuspend_test, andsio_rtk_unavailable_rejects_issue_test),apple-sio-msg(7/7),apple-sio-terminate(8/8), andapple_mbox_g17_stall(3/4 + 1 skipped).drivers/pwm/pwm-apple.kunitconfig: 40 passed (pwm-apple, includingapple_pwm_test_runtime_pm_keeps_registersandapple_pwm_test_zero_duty_runtime_pm_readback).tools/asahi/run-host-tests.py) at0e6b27f5a2a8:--only sio: 68/68 passed (includingsio-rpm-issue-tests9 scenarios, all 11 mutations includingskip-remove-shutdown,skip-remove-mailbox-off, andadmit-after-suspend-double-fail, and--ref a8d2f37caf8953f54470eb4d54bfb21e903846d3killed).--only dcpaud: 15/15 passed.--only apple-pwm-pm: 2/2 passed.scripts/checkpatch.pl --strict --git origin/main..HEAD): 0 errors across all PR commits (0e6b27f5a2a8,daf99763dd95,4295db09de60,a8d2f37caf89,ddf95fc58b08: 0 errors, 0 warnings, 0 checks; 1 file-additionMAINTAINERSnotice one9cfcbd1b8fb; 1 commit-description 75-col wrap warning each one5a7623da91cand457a940bfff4).0e6b27f5a2a8(composite trial kernels overorigin/main429e7e15f122):M1 MacBook Air,T8103) composite (origin/main429e7e15f122+#3335,#3506,#3508,#3269,#33590e6b27f5a2a8,#3289;3/3.o/.texthashes byte-identical inapple-sio.o,sleep.o, andmca.ovs single-PR merge on429e7e15f122; GRUB one-shot, default cmdline, docked CalDigit TS5 +DP-23840x2160@120, AC 100%):0failed units,0AVC denials,5err+lines identical to default boot;arecord hw:0,0(3chFLOAT_LE48 kHz, 3 s =1,728,044bytes) and10/10capture cycles with>500 msgaps passed withsio/admac/pwmruntime status returning tosuspended;kbd_backlight0 -> 255 -> 0pwmactive/suspended;0dmesgSIO/ADMAC/MCA errors;1x deepS2R (rtcwake -d rtc1 -m mem -s 30, ext display DPMS off first) passed (success=1, wakeNUB.SPMI0Sw3IRQ; right after deep S2R, post-resume ISPv4l2-ctlcapture hung with cause unassigned).s2idleand reboot-timeled_pwm_shutdown()did not run.M4 MacBook Air,T8132, 27.2 firmware) composite (origin/main429e7e15f122+#33590e6b27f5a2a8,#35606c38b2268568,#349144d22bf36fb3,#371727ffbe1aa92a,#32970378182e01b8,#3300241b8646ccdf; Linux7.3.0, GRUB one-shot + one-shot Stage 2 carrying compositet8132-j713.dtb, default cmdline, battery 50% to 43%, no speaker playback, no external display attached):apple-sio3ade00000.dma-controllerstaysruntime_statusactive(runtime_suspended_time0,stop_at_commit); bothapple-admaccontrollers (393300000,393800000) aresuspendedat idle;arecord -D hw:0,0 -f FLOAT_LE -r 48000 -c 3 -d 3(built-in high-quality microphone, 3 runs before sleeps and 1 after both) cycles393300000suspended -> activefor the stream and-> suspendedwithin 1 s of stop, capturing144000frames per run with410396–410397non-zero samples, peak0.0002,0NaN;rtcwake -m freeze -s 20(s2idle) andrtcwake -m mem -s 25(deep sleep) both resumed cleanly (suspend_statssuccess1and2,fail0) with SIOactive, ADMACssuspended, and capture repeating unchanged;0SIO/MCA/ADMAC error lines,0failed units,0AppArmor denials,0Oops/WARN.16-inch M5 Max,T6050) composite boot sanity (origin/main429e7e15f122+#3409,#3560,#3651,#3717,#33590e6b27f5a2a8,#3289; Linux7.3.0, default cmdline, default Stage 2b0a2f222b5a9): boots to desktop;apple-sioregistered (/sys/bus/platform/drivers/apple-sio) with nosionode in T6050 DT (apple-sio/apple-mcaunbound;apple-admac293800000.dma-controllerand2d3200000.dma-controllerprobe);sleep.capple,seq-commit-siopresent and2x pm_test=devices+1x pm_test=platformresumed cleanly;0apple-sio/apple-admac/mcaerrors or warnings;1baseline failed unit (aurora-peripherals.service),0failed user units,0LSM denials,0Oops/BUG/WARN/SError/GPU faults (4kernelerr+lines frommainbase).e9cfcbd1b8fb(retained for baseline context):mainfe9af4b604784withe9cfcbd1b8fbd, alongside iio: aop_temp, aop_las: run board temperature and lid angle reports on demand with idle stop #3409 and serial: apple-dockchannel: stop idle console drain timer, back off RX, and add sleep PM #3335): clean boot, 0 failed units, 0dmesgerrors,speakerguardd-v2active (Speaker Playback Mux=Secondary), both audio ADMACs (513300000.dma-controller,513800000.dma-controller) entersuspended(usage=0) at idle,apple-sio(429e00000.dma-controller) stays active (stop_at_commit), settled battery idle3.52–3.59 W(disp_bl=100,kbd_bl=64).e9cfcbd1b8fb:apple-sio(3ade00000,stop_at_commit=true) stayedactive;apple-admac(393300000/393800000) cycledsuspended -> active -> suspendedacross a 2 s 3-chFLOAT_LEarecordmic capture (hw:0,0,96,000frames,266,397non-zero samples, peak0.00169,0NaNs) and remained clean across 3×s2idle;0SIO/MCA/ADMAC errors.e9cfcbd1b8fb: internal HPAI mic (hw:AppleJ313HPAI,0, 3-ch float, 2 s =96,000frames,~288k/288knon-zero, peak7e-4, rms1.35e-4,0NaN/Inf, both before and afterdeepsleep) and jack mic (hw:AppleJ313,0, 2-ch S16,96,000frames) exercised cleanly;apple-admac,apple-mca, and AOP DMA cycledsuspended -> active -> suspendedwithin 5 s;apple-siostayedsuspendedacross capture and sleeps;0SIO/ADMAC/MCA errors or leaks. In batched candidateac44bee46ee4(main9e38a276dcb4): live DT showsps_fpwm0..2parented underps_sio,236400000.sioand236408000.mboxstayedsuspendedwithspeakersafetydholdingpcmC1D2c(0-62/-ETIME), stoppingspeakersafetyddropped all 5 devices tosuspendedand 14 power domains (sio_cpu,dpa0,mca0..5,sio_adma,audio_p,uart_p,spi_p,fpwm0,fpwm2) tooff-0, andkbd_backlight0 -> 128 -> 0ran before and afterdeepS2R with0SErrors.a8d2f37caf89: boot + dockeddpaudio1wake (~2 ms wake, 0-62/-ETIME); all 5 devices reachedsuspendedand all 9 PMGR domains (sio_cpu,dpa0,mca2,sio_adma,audio_p,uart_p,spi_p,sio,sio_busif) dropped tooff-0with all PCMs closed (macsmc_hwmonHeatpipe Power3,248.1 -> 3,171.2 mW); real mic capture and speaker playback passed with 0 errors.