From: sashiko-bot@kernel.org
To: "Harendra Gautam" <harendra.gautam@oss.qualcomm.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v8 04/10] ASoC: qcom: Add QAIF CPU DAI ops, regmap, DT parsing and platform init
Date: Mon, 28 Sep 2026 13:04:49 +0000 [thread overview]
Message-ID: <20260928130450.1D8911F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260928-b4-qaif-shikra-audio-v8-4-ac618057fe85@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] ASoC: qaif-cpu: concurrent MI2S hw_params clobbers shared frame config
- [Medium] ASoC: qaif-cpu: stopping stream in loopback mode breaks concurrent stream
- [Low] ASoC: qaif-cpu: integer underflow in max_register calculation bypasses bounds
--
commit 96b925c5161486efa5953d5523b45fed9502f610
Author: Harendra Gautam <harendra.gautam@oss.qualcomm.com>
ASoC: qcom: Add QAIF CPU DAI ops, regmap, DT parsing and platform init
This commit adds the QAIF CPU DAI driver to support Qualcomm audio
interface paths for CDC DMA and serial AIF audio links. It implements
CIF and AIF DAI operations, including channel mask programming, dynamic
clock control, and format setup.
> diff --git a/sound/soc/qcom/qaif-cpu.c b/sound/soc/qcom/qaif-cpu.c
> new file mode 100644
> --- /dev/null
> +++ b/sound/soc/qcom/qaif-cpu.c
[ ... ]
> +static int qaif_aif_cpu_daiops_hw_params(struct snd_pcm_substream *substream,
> + struct snd_pcm_hw_params *params,
> + struct snd_soc_dai *dai)
> +{
[ ... ]
> + if (qaif_is_aif_mi2s_port(dai->driver->id) && !cfg->slot_width) {
> + slot_width = bitwidth;
> + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
> + drvdata->aif_intf_cfg[idx].slot_en_tx_mask =
> + GENMASK(channels - 1, 0);
> + else
> + drvdata->aif_intf_cfg[idx].slot_en_rx_mask =
> + GENMASK(channels - 1, 0);
> + drvdata->aif_intf_cfg[idx].slot_num = QAIF_MI2S_SLOTS;
> + } else {
[ ... ]
> + ret = regmap_update_bits(map, QAIF_AUD_INTF_FRAME_CFG_REG(idx),
> + QAIF_AIF_BITS_PER_LANE_MASK,
> + (slot_width * cfg->slot_num) - 1);
[Severity: High]
Does this dynamically derived slot_width risk clobbering the shared frame
configuration register when concurrent playback and capture streams on the
same MI2S port use different formats?
Since ALSA exposes these as separate DAIs without enforcing
symmetric_sample_bits, an active playback stream could be disrupted by a
capture hw_params call that overwrites the physical frame size here.
[ ... ]
> +static int qaif_aif_cpu_daiops_trigger(struct snd_pcm_substream *substream,
> + int cmd, struct snd_soc_dai *dai)
> +{
[ ... ]
> + cfg = &drvdata->aif_intf_cfg[idx];
> + if (cfg->loopback_en)
> + enable_bit = QAIF_AIF_CTL_ENABLE_BIT;
> + else if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
> + enable_bit = QAIF_AIF_CTL_ENABLE_TX_BIT;
> + else
> + enable_bit = QAIF_AIF_CTL_ENABLE_RX_BIT;
> +
> + switch (cmd) {
> + case SNDRV_PCM_TRIGGER_START:
[ ... ]
> + case SNDRV_PCM_TRIGGER_STOP:
> + case SNDRV_PCM_TRIGGER_SUSPEND:
> + case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
> + ret = regmap_update_bits(drvdata->audio_qaif_map,
> + QAIF_AUD_INTF_CTL_REG(idx), enable_bit, 0);
[Severity: Medium]
When stopping a stream in loopback mode, does unconditionally clearing this
global enable bit prematurely disable the shared interface?
Loopback requires both directions to run concurrently, so stopping one
stream might cause hardware DMA stalls for the other active stream.
[ ... ]
> +int asoc_qcom_qaif_cpu_platform_probe(struct platform_device *pdev)
> +{
[ ... ]
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!res)
> + return dev_err_probe(dev, -EINVAL, "Failed to get MMIO resource\n");
> +
> + regmap_cfg.max_register = resource_size(res) - regmap_cfg.reg_stride;
[Severity: Low]
Can this calculation underflow if a malformed device tree provides a memory
region smaller than regmap_cfg.reg_stride (4 bytes)?
An underflow would wrap max_register to a massive 32-bit unsigned value,
bypassing regmap's bounds checking protections.
> + drvdata->audio_qaif_map = devm_regmap_init_mmio(dev, drvdata->audio_qaif,
> + ®map_cfg);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260928-b4-qaif-shikra-audio-v8-0-ac618057fe85@oss.qualcomm.com?part=4
next prev parent reply other threads:[~2026-09-28 13:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 12:52 [PATCH v8 00/10] ASoC: qcom: Add QAIF driver for Shikra audio platform Harendra Gautam
2026-09-28 12:52 ` [PATCH v8 01/10] ASoC: dt-bindings: qcom,shikra-qaif-cpu: Add binding Harendra Gautam
2026-09-28 13:01 ` sashiko-bot
2026-10-06 14:16 ` Rob Herring
2026-09-28 12:52 ` [PATCH v8 02/10] ASoC: qcom: Add QAIF shared data structures and variant interface Harendra Gautam
2026-09-28 12:52 ` [PATCH v8 03/10] ASoC: qcom: Add QAIF hardware register map Harendra Gautam
2026-09-28 13:03 ` sashiko-bot
2026-09-28 12:52 ` [PATCH v8 04/10] ASoC: qcom: Add QAIF CPU DAI ops, regmap, DT parsing and platform init Harendra Gautam
2026-09-28 13:04 ` sashiko-bot [this message]
2026-09-28 12:52 ` [PATCH v8 05/10] ASoC: soc-core: Add snd_soc_of_xlate_dai_name() generic helper Harendra Gautam
2026-09-28 12:52 ` [PATCH v8 06/10] ASoC: qcom: Switch lpass-cpu and qaif-cpu to snd_soc_of_xlate_dai_name() Harendra Gautam
2026-09-28 12:52 ` [PATCH v8 07/10] ASoC: qcom: Add QAIF PCM operations Harendra Gautam
2026-09-28 13:07 ` sashiko-bot
2026-09-28 12:52 ` [PATCH v8 08/10] ASoC: qcom: Add QAIF IRQ handling and platform register Harendra Gautam
2026-09-28 13:04 ` sashiko-bot
2026-09-29 11:36 ` Ajay Kumar Nandam
2026-09-30 5:28 ` Harendra Gautam
2026-09-28 12:52 ` [PATCH v8 09/10] ASoC: qcom: Add Shikra QAIF support Harendra Gautam
2026-09-28 12:53 ` [PATCH v8 10/10] MAINTAINERS: Add Qualcomm QAIF driver entry Harendra Gautam
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=20260928130450.1D8911F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=harendra.gautam@oss.qualcomm.com \
--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