From: sashiko-bot@kernel.org
To: "Harendra Gautam" <harendra.gautam@oss.qualcomm.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v6 07/10] ASoC: qcom: Add QAIF PCM operations
Date: Fri, 11 Sep 2026 09:39:04 +0000 [thread overview]
Message-ID: <20260911093904.DA9241F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260911-b4-qaif-shikra-audio-v6-7-e9addb358201@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Unchecked DMA channel counts passed to GENMASK() can evaluate to GENMASK(-1, 0), leading to undefined behavior and hardware resource conflicts.
- [High] Hardware initialization state is permanently lost if the QAIF domain is power-collapsed during system suspend.
--
commit 6bb3c2e1288c0727263b66bf59c762a0401fb99b
Author: Harendra Gautam <harendra.gautam@oss.qualcomm.com>
ASoC: qcom: Add QAIF PCM operations
This commit adds PCM platform callbacks for QAIF DAIs to handle playback and
capture. It allocates DMA buffers, performs hardware initialization, and
manages DMA resources across the stream lifecycle.
> diff --git a/sound/soc/qcom/qaif-platform.c b/sound/soc/qcom/qaif-platform.c
> new file mode 100644
> index 0000000000000..84ce3ad9a1f2d
> --- /dev/null
> +++ b/sound/soc/qcom/qaif-platform.c
[ ... ]
> +static int qaif_map_ee_resource(struct qaif_drv_data *drvdata)
> +{
> + const struct qaif_variant *v = drvdata->variant;
> + struct regmap *map = drvdata->audio_qaif_map;
> + int ret;
> +
> + ret = regmap_write(map, QAIF_EE_RDDMA_MAP_REG(v), GENMASK(v->num_rddma - 1, 0));
[Severity: High]
If a hardware variant has 0 channels for a specific DMA type (for example,
playback-only), will v->num_rddma evaluate to 0? Passing 0 to
GENMASK(v->num_rddma - 1, 0) results in an unsigned underflow and creates an
all-ones bitmask. Could this write corrupt the execution environment mapping
by unintentionally claiming all channels of that type?
This same underflow pattern appears below for num_wrdma, num_codec_rddma,
and num_codec_wrdma.
> + if (ret)
> + return ret;
> + ret = regmap_write(map, QAIF_EE_WRDMA_MAP_REG(v), GENMASK(v->num_wrdma - 1, 0));
> + if (ret)
> + return ret;
> + if (v->num_intf > 0) {
> + ret = regmap_write(map, QAIF_EE_INTF_MAP_REG(v), GENMASK(v->num_intf - 1, 0));
> + if (ret)
> + return ret;
> + }
> + ret = regmap_write(map, QAIF_EE_CODEC_RDDMA_MAP_REG(v),
> + GENMASK(v->num_codec_rddma - 1, 0));
> + if (ret)
> + return ret;
> + return regmap_write(map, QAIF_EE_CODEC_WRDMA_MAP_REG(v),
> + GENMASK(v->num_codec_wrdma - 1, 0));
> +}
[ ... ]
> +static int qaif_init(struct snd_soc_component *component)
> +{
> + struct qaif_drv_data *drvdata = snd_soc_component_get_drvdata(component);
> + int ret;
> +
> + if (drvdata->qaif_hw_configured)
> + return 0;
[Severity: High]
Is the hardware initialization state permanently lost if the QAIF domain is
power-collapsed during system suspend?
If the QAIF block registers (SHRAM boundaries, EE mappings, and DMA routing)
are reset to zero when the audio power domain collapses during system sleep,
and drvdata->qaif_hw_configured is never cleared by suspend/resume callbacks,
this early return prevents the hardware from being reprogrammed when opening
a new stream after resume.
> +
> + ret = qaif_config_shram(drvdata);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260911-b4-qaif-shikra-audio-v6-0-e9addb358201@oss.qualcomm.com?part=7
next prev parent reply other threads:[~2026-09-11 9:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 9:17 [PATCH v6 00/10] ASoC: qcom: Add QAIF driver for Shikra audio platform Harendra Gautam
2026-09-11 9:17 ` [PATCH v6 01/10] ASoC: dt-bindings: qcom,shikra-qaif-cpu: Add binding Harendra Gautam
2026-09-11 9:17 ` [PATCH v6 02/10] ASoC: qcom: Add QAIF shared data structures and variant interface Harendra Gautam
2026-09-11 9:17 ` [PATCH v6 03/10] ASoC: qcom: Add QAIF hardware register map Harendra Gautam
2026-09-11 9:34 ` sashiko-bot
2026-09-11 9:17 ` [PATCH v6 04/10] ASoC: qcom: Add QAIF CPU DAI ops, regmap, DT parsing and platform init Harendra Gautam
2026-09-11 9:17 ` [PATCH v6 05/10] ASoC: soc-core: Add snd_soc_of_xlate_dai_name() generic helper Harendra Gautam
2026-09-11 9:32 ` sashiko-bot
2026-09-11 9:17 ` [PATCH v6 06/10] ASoC: qcom: Switch lpass-cpu and qaif-cpu to snd_soc_of_xlate_dai_name() Harendra Gautam
2026-09-11 9:40 ` sashiko-bot
2026-09-11 9:17 ` [PATCH v6 07/10] ASoC: qcom: Add QAIF PCM operations Harendra Gautam
2026-09-11 9:39 ` sashiko-bot [this message]
2026-09-11 9:17 ` [PATCH v6 08/10] ASoC: qcom: Add QAIF IRQ handling and platform register Harendra Gautam
2026-09-11 9:40 ` sashiko-bot
2026-09-11 9:17 ` [PATCH v6 09/10] ASoC: qcom: Add Shikra QAIF support Harendra Gautam
2026-09-11 9:17 ` [PATCH v6 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=20260911093904.DA9241F000FF@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;
as well as URLs for NNTP newsgroup(s).