From: sashiko-bot@kernel.org
To: "Ajay Kumar Nandam" <ajay.nandam@oss.qualcomm.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v6 4/4] ASoC: qcom: q6apm-dai: add SCM buffer assignment for mDSP platforms
Date: Wed, 23 Sep 2026 16:50:40 +0000 [thread overview]
Message-ID: <20260923165040.7F3F31F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260923-vmid-v4-v6-4-3d61a0319b1c@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] ALSA: q6apm-dai: Uncapped 8MB allocation for compressed streams exhausts carveout
- [Medium] ALSA: q6apm-dai: Missing buffer size hardware constraint for capture streams
--
commit 0f7913cfca3d367699e852961892b2259896b6d2
Author: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>
ASoC: qcom: q6apm-dai: add SCM buffer assignment for mDSP platforms
This commit adds SCM buffer assignment for mDSP platforms where audio buffers
must be explicitly assigned to specific VMIDs for the DSP to access them.
It implements support for both control-path and data-path memory carveouts
assigned at probe time.
> diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-dai.c
> index 033197bdd8705..b0b10ba51c99d 100644
> --- a/sound/soc/qcom/qdsp6/q6apm-dai.c
> +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c
[ ... ]
> @@ -409,8 +518,11 @@ static int q6apm_dai_open(struct snd_soc_component *component,
> }
>
> if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
> + size_t buf_max = pdata->has_reserved_mem ? pdata->reserved_buf_size :
> + BUFFER_BYTES_MAX;
> +
> ret = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
> - BUFFER_BYTES_MIN, BUFFER_BYTES_MAX);
> + BUFFER_BYTES_MIN, buf_max);
[Severity: Medium]
What happens when a user opens a capture stream on a DAI using the restricted
memory pool (has_reserved_mem is true)?
Since the dynamic buf_max constraint is applied exclusively to playback
streams, will capture streams be left unguarded, potentially advertising
larger buffer capabilities than physically allocated in the carveout pool and
causing allocation failures during ALSA hw_params negotiation?
> if (ret < 0) {
> dev_err(dev, "constraint for buffer bytes min max ret = %d\n", ret);
> goto err;
[ ... ]
> @@ -683,6 +830,17 @@ static int q6apm_dai_compr_open(struct snd_soc_component *component,
> if (ret)
> return ret;
>
> + if (pdata->use_scm_assign && !pdata->has_reserved_mem) {
> + ret = q6apm_dai_scm_assign(pdata, prtd->dma_buffer.addr,
> + ALIGN(size, PAGE_SIZE));
[Severity: High]
Does this code risk exhausting the carveout pool when opening a compressed
stream?
In q6apm_dai_compr_open(), just before this snippet, the buffer size is
statically set to 8MB (COMPR_PLAYBACK_MAX_FRAGMENT_SIZE *
COMPR_PLAYBACK_MAX_NUM_FRAGMENTS) and allocated via snd_dma_alloc_pages()
using the device DMA context.
Since the device is bound to a small restricted memory carveout pool via
of_reserved_mem_device_init_by_idx() when has_reserved_mem is true, wouldn't
this unbounded allocation instantly fail or exhaust the pool?
Should the allocation size be capped by reserved_buf_size, similar to the
implementation for standard PCM streams?
> + if (ret) {
> + dev_err(dev, "SCM assign compr buffer failed: %d\n",
> + ret);
> + snd_dma_free_pages(&prtd->dma_buffer);
> + return ret;
> + }
> + }
> +
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260923-vmid-v4-v6-0-3d61a0319b1c@oss.qualcomm.com?part=4
next prev parent reply other threads:[~2026-09-23 16:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 16:33 [PATCH v6 0/4] ASoC: qcom: enable audio on stage-2 protected DSPs (mDSP) Ajay Kumar Nandam
2026-09-23 16:33 ` [PATCH v6 1/4] ASoC: qcom: q6apm: clear g_apm on driver removal Ajay Kumar Nandam
2026-09-23 16:33 ` [PATCH v6 2/4] ASoC: qcom: qdsp6: generalize GPR service domain Ajay Kumar Nandam
2026-09-23 16:33 ` [PATCH v6 3/4] ASoC: dt-bindings: qcom,q6apm-dai: add memory-region and relax iommus Ajay Kumar Nandam
2026-09-28 10:50 ` Krzysztof Kozlowski
2026-09-23 16:33 ` [PATCH v6 4/4] ASoC: qcom: q6apm-dai: add SCM buffer assignment for mDSP platforms Ajay Kumar Nandam
2026-09-23 16:50 ` sashiko-bot [this message]
2026-10-06 15:38 ` [PATCH v6 0/4] ASoC: qcom: enable audio on stage-2 protected DSPs (mDSP) Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260923165040.7F3F31F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=ajay.nandam@oss.qualcomm.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox