All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Robert Ijtsma" <robertijtsma@gmail.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH 2/2] soundwire: qcom: populate wr_fifo_depth before enabling interrupts
Date: Tue, 24 Nov 2026 22:54:01 +0000	[thread overview]
Message-ID: <sashiko-outbox-232167@kernel.org> (raw)
In-Reply-To: <20261124-qcom-soundwire-fixes-v1-2-8ca94d60ddd6@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] soundwire: qcom: Fixes trailer cites 02efb49aa805 instead of
  a661308c34de
- [Low] soundwire: qcom: redundant unchecked SWRM_COMP_PARAMS read in
  qcom_swrm_init()
--

commit 6cb5da021ef8535ab5b5f9bfc4e8100a46f9d35b
Author: Robert Ijtsma <robertijtsma@gmail.com>

> soundwire: qcom: populate wr_fifo_depth before enabling interrupts
>
> ctrl->wr_fifo_depth is currently populated at the end of
> qcom_swrm_init(), after devm_request_threaded_irq() in qcom_swrm_probe()
> and after enabling CPU interrupts in qcom_swrm_init().
>
> If a SoundWire interrupt fires before SWRM_COMP_PARAMS has been read,
> qcom_swrm_cmd_fifo_wr_cmd() observes ctrl->wr_fifo_depth == 0 and fails
> with -EIO ("err write overflow").
>
> Read and validate SWRM_COMP_PARAMS in qcom_swrm_probe() prior to
> requesting the threaded IRQ, and read SWRM_COMP_PARAMS before enabling
> CPU interrupts in qcom_swrm_init().
>
> Fixes: 02efb49aa805 ("soundwire: qcom: add support for SoundWire controller")
> Signed-off-by: Robert Ijtsma <robertijtsma@gmail.com>

[Severity: Low]
Should the Fixes: tag point to a661308c34de ("soundwire: qcom: wait for
fifo space to be available before read/write") instead of 02efb49aa805
("soundwire: qcom: add support for SoundWire controller")?

Commit a661308c34de ("soundwire: qcom: wait for fifo space to be available
before read/write") introduced ctrl->wr_fifo_depth, the SWRM_COMP_PARAMS
read at the end of qcom_swrm_init(), and swrm_wait_for_wr_fifo_avail() in
qcom_swrm_cmd_fifo_wr_cmd().

> diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
> index 368f511867835..3a42ab85be7c6 100644
> --- a/drivers/soundwire/qcom.c
> +++ b/drivers/soundwire/qcom.c
> @@ -997,6 +997,12 @@ static int qcom_swrm_init(struct qcom_swrm_ctrl *ctrl)
>  	ctrl->reg_write(ctrl, ctrl->reg_layout[SWRM_REG_INTERRUPT_CLEAR],
>  			0xFFFFFFFF);
>  
> +	ctrl->reg_read(ctrl, SWRM_COMP_PARAMS, &val);
> +	if (ctrl->version >= SWRM_VERSION_3_1_0)
> +		ctrl->wr_fifo_depth = FIELD_GET(SWRM_V3_COMP_PARAMS_WR_FIFO_DEPTH, val);
> +	else
> +		ctrl->wr_fifo_depth = FIELD_GET(SWRM_COMP_PARAMS_WR_FIFO_DEPTH, val);
> +

[Severity: Low]
Is re-reading SWRM_COMP_PARAMS in qcom_swrm_init() needed now that
qcom_swrm_probe() reads and validates ctrl->wr_fifo_depth before requesting
the IRQ or calling qcom_swrm_init()?

SWRM_COMP_PARAMS is a static capability register, and this second read does
not check the return status of ctrl->reg_read().  If a transient regmap
read error occurs during controller initialization or runtime resume, val
retains the value previously read from SWRM_MCP_CFG_ADDR and overwrites the
validated ctrl->wr_fifo_depth with 0, causing later command FIFO writes to
fail with -EIO.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-qcom-soundwire-fixes-v1-0-8ca94d60ddd6@gmail.com?part=2

      reply	other threads:[~2026-11-24 22:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 22:46 [PATCH 0/2] soundwire: qcom: fix WCD AHB serialization and wr_fifo_depth init order Robert Ijtsma
2026-11-24 22:46 ` Robert Ijtsma via B4 Relay
2026-11-24 22:46 ` [PATCH 1/2] soundwire: qcom: serialize WCD AHB bridge transactions Robert Ijtsma
2026-11-24 22:46   ` Robert Ijtsma via B4 Relay
2026-11-24 22:46 ` [PATCH 2/2] soundwire: qcom: populate wr_fifo_depth before enabling interrupts Robert Ijtsma
2026-11-24 22:46   ` Robert Ijtsma via B4 Relay
2026-11-24 22:54   ` sashiko-bot [this message]

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-232167@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=robertijtsma@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.