Linux Sound subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Neil Armstrong" <neil.armstrong@linaro.org>
Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 18/19] ASoC: qcom: sdw: allow LPASS_CDC_DMA_WSA_RX0 as soundwire dai
Date: Fri, 04 Dec 2026 17:52:08 +0000	[thread overview]
Message-ID: <sashiko-outbox-250349@kernel.org> (raw)
In-Reply-To: <20261204-topic-sm8650-el2-v3-18-8384ef0ac751@linaro.org>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] ASoC: qcom: sdw: qcom_snd_is_dsp_bypass_link() misclassifies
  QAIF links
- [High] ASoC: qcom: sleep in atomic trigger context on
  LPASS_CDC_DMA_WSA_RX0
--

commit 901b97812de99037ffb2d847d92ed32893b5f329
Author: Neil Armstrong <neil.armstrong@linaro.org>

ASoC: qcom: sdw: allow LPASS_CDC_DMA_WSA_RX0 as soundwire dai

This commit adds qcom_snd_is_dsp_bypass_link() to identify DSP bypass
links and restricts LPASS CPU DAI ID matching in qcom_snd_is_sdw_dai() to
those links, while also adding LPASS_CDC_DMA_WSA_RX0 as a SoundWire DAI.

> diff --git a/sound/soc/qcom/common.h b/sound/soc/qcom/common.h
> index 37b185a4968f3..1af9c32505e61 100644
> --- a/sound/soc/qcom/common.h
> +++ b/sound/soc/qcom/common.h
> @@ -32,5 +32,14 @@ int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd,
>  int qcom_snd_dp_jack_setup(struct snd_soc_pcm_runtime *rtd,
>  			   struct snd_soc_jack *dp_jack, int id);
>  
> +/*
> + * DSP Bypass links (lpass-cpu) are neither DPCM frontends nor backends,
> + * their cpu dai ids overlap with the DSP dai ids.
> + */
> +static inline bool qcom_snd_is_dsp_bypass_link(struct snd_soc_pcm_runtime *rtd)
> +{
> +	return !rtd->dai_link->no_pcm && !rtd->dai_link->dynamic;
> +}

[Severity: High]
Can qcom_snd_is_dsp_bypass_link() misclassify non-DSP QAIF links as
lpass-cpu links?

qcom_snd_parse_of() leaves both no_pcm and dynamic as 0 for any plain
CPU-to-codec DT link without a platform node, which includes QAIF links
such as shikra_qaif_cpu_dai_driver in sound/soc/qcom/qaif-shikra.c.
Unlike lpass-cpu, QAIF registers its SoundWire DAIs using
qcom,q6dsp-lpass-ports.h IDs (RX_CODEC_DMA_RX_0, RX_CODEC_DMA_RX_1,
VA_CODEC_DMA_TX_1), and sc8280xp_add_be_ops() attaches sc8280xp_be_ops to
those links.

Because qcom_snd_is_dsp_bypass_link() returns true for QAIF links,
qcom_snd_is_sdw_dai() returns false in its default branch without reaching
the second switch.  qcom_snd_sdw_startup() then returns early without
allocating or setting sruntime, causing a NULL pointer dereference during
hw_params in qcom_swrm_hw_params() -> qcom_swrm_stream_alloc_ports() (and
in slave codec hw_params via sdw_stream_add_slave() ->
sdw_master_rt_find()).

Identifying the lpass-cpu component/driver directly rather than inferring
the DAI ID namespace from !no_pcm && !dynamic would avoid breaking QAIF
links.

> diff --git a/sound/soc/qcom/sdw.c b/sound/soc/qcom/sdw.c
> index e19adb7c750b0..b071d2a797885 100644
> --- a/sound/soc/qcom/sdw.c
> +++ b/sound/soc/qcom/sdw.c
> @@ -6,10 +6,25 @@
>  #include <dt-bindings/sound/qcom,q6afe.h>
>  #include <linux/module.h>
>  #include <sound/soc.h>
> +#include "common.h"
>  #include "sdw.h"
>  
> -static bool qcom_snd_is_sdw_dai(int id)
> +static bool qcom_snd_is_sdw_dai(struct snd_soc_pcm_runtime *rtd)
>  {
> +	int id = snd_soc_rtd_to_cpu(rtd, 0)->id;
> +
> +	/* DSP Bypass usecase, cpu dai ids overlap with DSP dai ids */
> +	if (qcom_snd_is_dsp_bypass_link(rtd)) {
> +		switch (id) {
> +		case LPASS_CDC_DMA_TX3:
> +		case LPASS_CDC_DMA_RX0:
> +		case LPASS_CDC_DMA_WSA_RX0:
> +			return true;
> +		default:
> +			return false;
> +		}
> +	}

[Severity: High]
Does enabling LPASS_CDC_DMA_WSA_RX0 on DSP bypass links trigger sleeping
in atomic context during PCM trigger?

qcom_snd_parse_of() only sets link->nonatomic = 1 for DPCM links, so DSP
bypass links remain atomic and ALSA holds spin_lock_irq across
soc_pcm_trigger().  lpass_platform_wsaif_irq() can also reach
soc_pcm_trigger(STOP) in hardirq context on DMA XRUN or error interrupts
via snd_pcm_stop_xrun() and snd_pcm_stop().

soc_pcm_trigger() -> snd_soc_pcm_dai_trigger() calls
snd_soc_dai_digital_mute() for codecs with .mute_unmute_on_trigger = true,
which both wsa884x and wsa883x set.  Their mute_stream callbacks perform
SoundWire regmap writes (regmap_update_bits() -> sdw_transfer()), which
acquire sleeping mutexes (map->mutex and bus->msg_lock) and wait for bus
transfers while atomic or in hardirq context.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-topic-sm8650-el2-v3-0-8384ef0ac751@linaro.org?part=18

  reply	other threads:[~2026-12-04 17:52 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 15:53 [PATCH v3 00/19] arm64: qcom: enable SM8650 audio without ADSP firmware Neil Armstrong
2026-12-04 15:53 ` [PATCH v3 01/19] ASoC: qcom: lpass-cpu: fix RXTX WRDMA current address register readability Neil Armstrong
2026-12-04 15:53 ` [PATCH v3 02/19] ASoC: qcom: lpass-platform: disable the RXTX & VA DMA interrupts on stop Neil Armstrong
2026-12-04 15:53 ` [PATCH v3 03/19] ASoC: dt-bindings: qcom,lpass: add Senary & Septenary MI2S ids Neil Armstrong
2026-12-04 15:53 ` [PATCH v3 04/19] ASoC: dt-bindings: qcom,lpass: add WSA RX and TX channels ids Neil Armstrong
2026-12-04 15:53 ` [PATCH v3 05/19] ASoC: dt-bindings: qcom,lpass-*-macro: document less clock when ADSP is not used Neil Armstrong
2026-12-04 16:20   ` sashiko-bot
2026-12-04 15:53 ` [PATCH v3 06/19] ASoC: dt-bindings: qcom,lpass-cpu: document the SM8650 LPASS Neil Armstrong
2026-12-04 15:53 ` [PATCH v3 07/19] ASoC: codecs: lpass-wsa-macro: handle the macro & dcodec power domains Neil Armstrong
2026-12-04 15:53 ` [PATCH v3 08/19] ASoC: qcom: lpass-cpu: get the optional codec_mem3 clock Neil Armstrong
2026-12-04 15:53 ` [PATCH v3 09/19] ASoC: qcom: lpass: add support for optional WSA interface Neil Armstrong
2026-12-04 16:49   ` sashiko-bot
2026-12-04 15:53 ` [PATCH v3 10/19] ASoC: qcom: lpass-cdc-dma: add support for WSA codec DMA Neil Armstrong
2026-12-04 16:47   ` sashiko-bot
2026-12-04 15:53 ` [PATCH v3 11/19] ASoC: qcom: lpass: prepare to handle multiple lpaifs for i2s Neil Armstrong
2026-12-04 15:53 ` [PATCH v3 12/19] ASoC: qcom: lpass: add support for MI2S_SENARY & MI2S_SEPTENARY Neil Armstrong
2026-12-04 15:53 ` [PATCH v3 13/19] ASoC: qcom: lpass: support mapping I2S ports to multiple LPAIFs Neil Armstrong
2026-12-04 17:10   ` sashiko-bot
2026-12-04 15:53 ` [PATCH v3 14/19] ASoC: qcom: lpass: support LPM memory type for I2S LPAIFs Neil Armstrong
2026-12-04 17:08   ` sashiko-bot
2026-12-04 15:53 ` [PATCH v3 15/19] ASoC: qcom: lpass: allocate LPM buffer memory to DAIs Neil Armstrong
2026-12-04 17:33   ` sashiko-bot
2026-12-04 15:53 ` [PATCH v3 16/19] ASoC: qcom: lpass: enable the right codec_mem clock when usin LPM memory Neil Armstrong
2026-12-04 17:28   ` sashiko-bot
2026-12-04 15:53 ` [PATCH v3 17/19] ASoC: qcom: add SM8650 LPASS CPU driver Neil Armstrong
2026-12-04 17:42   ` sashiko-bot
2026-12-04 15:53 ` [PATCH v3 18/19] ASoC: qcom: sdw: allow LPASS_CDC_DMA_WSA_RX0 as soundwire dai Neil Armstrong
2026-12-04 17:52   ` sashiko-bot [this message]
2026-12-04 15:53 ` [PATCH v3 19/19] ASoC: qcom: sc8280xp: allow using the sc8280xp card with lpass-cpu Neil Armstrong
2026-12-04 17:54   ` sashiko-bot

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=sashiko-outbox-250349@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=neil.armstrong@linaro.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