Re: [PATCH 0/3] ASoC: qcom: q6apm: Fix shared memory unmap
From: Srinivas Kandagatla
Date: Tue Oct 20 2026 - 02:27:06 EST
On 10/16/26 3:11 PM, Shawn Guo wrote:
> Since the early buffer mapping, q6apm maps a front-end's DSP buffers
> once in pcm_new() and unmaps them in pcm_free(). The unmap side has a
> few problems, which show up when the sound card is unbound and bound
> again, e.g. by unbinding and binding any codec on the card:
>
> - The card core removes the components before it frees the PCMs, so
> the topology and its graph info are gone by the time pcm_free()
> tries to unmap. The unmap is silently skipped, the DSP keeps the old
> mapping, and the next bind fails to create the PCM:
>
> qcom-apm gprsvc:service:2:1: Error (1) Processing 0x0100100c cmd
> snd-sc8280xp sound: ASoC: can't create pcm MultiMedia1 Playback :-22
>
> - Once unmap is actually sent, every command stalls for five seconds,
> because the response handler matches on the wrong opcode:
>
> qcom-apm gprsvc:service:2:1: CMD timeout for [100100d] opcode
>
> - Unmapping the position buffer clears the circular buffer's handle
> instead of its own.
>
> Patch 1 fixes the unmap response handling, patch 2 makes the position
> buffer unmap clear its own handle, and patch 3 moves the unmap to the
> APM component's remove callback, before the topology is unloaded.
> Patches 1 and 2 go first so that patch 3 does not introduce the five
> second stalls.
>
> Tested on Qualcomm Ride board by unbinding and binding the PCM1681
> codec.
>
> echo 0-004c > /sys/bus/i2c/drivers/pcm1681/unbind
> echo 0-004c > /sys/bus/i2c/drivers/pcm1681/bind
Thanks for trying this case and fixing some of the issues.
Can you pl add Stable tag for these.
Other than than they look good to me.
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxxxxxxxx>
--srini
>
> Shawn Guo (3):
> ASoC: qcom: q6apm: Fix unmap regions response handling
> ASoC: qcom: q6apm: Clear the right handle on pos buffer unmap
> ASoC: qcom: q6apm: Unmap DSP buffers before removing the topology
>
> sound/soc/qcom/qdsp6/q6apm.c | 49 ++++++++++++++++++++++++++----------
> 1 file changed, 36 insertions(+), 13 deletions(-)
>