* [PATCH 1/2] firmware: cs_dsp: clear dsp->running on the cs_dsp_run() error path
@ 2026-10-13 10:23 Mingxuan Guo
2026-10-13 10:28 ` Richard Fitzgerald
2026-10-13 15:30 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Mingxuan Guo @ 2026-10-13 10:23 UTC (permalink / raw)
To: Simon Trimmer, Charles Keepax, Richard Fitzgerald
Cc: Mark Brown, patches, alsa-devel, linux-kernel
cs_dsp_run() sets dsp->running = true once the core has been started, but
the error path below it only stops and disables the core, leaving the flag
set. The first thing that can fail after that point is the post_run client
hook, and it is reachable in mainline: wm_adsp registers
wm_adsp_event_post_run(), which can fail in wm_adsp_buffer_init().
The core is then stopped and disabled, but dsp->running still reads true,
and that stale state is acted on elsewhere: cs_dsp_coeff_write_ctrl() and
cs_dsp_coeff_read_ctrl() talk to the DSP when ctl->dsp->running is set, and
client drivers use the flag to decide whether the firmware is up (cs35l41
checks cs_dsp.running before its early events and on hibernate/resume).
The flag cannot simply be moved below the hook: post_run hooks such as
wm_adsp_event_post_run() read controls while they run, and
cs_dsp_coeff_read_ctrl() only goes to the DSP when the flag is set.
Clear the flag on the error path, before the core is stopped - the order
cs_dsp_stop() already uses.
Fixes: f6bc909e7673 ("firmware: cs_dsp: add driver to support firmware loading on Cirrus Logic DSPs")
Signed-off-by: Mingxuan Guo <gmx472@qq.com>
---
drivers/firmware/cirrus/cs_dsp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/firmware/cirrus/cs_dsp.c b/drivers/firmware/cirrus/cs_dsp.c
--- a/drivers/firmware/cirrus/cs_dsp.c
+++ b/drivers/firmware/cirrus/cs_dsp.c
@@ -2960,6 +2960,8 @@ int cs_dsp_run(struct cs_dsp *dsp)
return 0;
err:
+ dsp->running = false;
+
if (dsp->ops->stop_core)
dsp->ops->stop_core(dsp);
if (dsp->ops->disable_core)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] firmware: cs_dsp: clear dsp->running on the cs_dsp_run() error path
2026-10-13 10:23 [PATCH 1/2] firmware: cs_dsp: clear dsp->running on the cs_dsp_run() error path Mingxuan Guo
@ 2026-10-13 10:28 ` Richard Fitzgerald
2026-10-13 15:30 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Richard Fitzgerald @ 2026-10-13 10:28 UTC (permalink / raw)
To: Mingxuan Guo, Simon Trimmer, Charles Keepax
Cc: Mark Brown, patches, alsa-devel, linux-kernel
On 13/10/2026 11:23 am, Mingxuan Guo wrote:
> cs_dsp_run() sets dsp->running = true once the core has been started, but
> the error path below it only stops and disables the core, leaving the flag
> set. The first thing that can fail after that point is the post_run client
> hook, and it is reachable in mainline: wm_adsp registers
> wm_adsp_event_post_run(), which can fail in wm_adsp_buffer_init().
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] firmware: cs_dsp: clear dsp->running on the cs_dsp_run() error path
2026-10-13 10:23 [PATCH 1/2] firmware: cs_dsp: clear dsp->running on the cs_dsp_run() error path Mingxuan Guo
2026-10-13 10:28 ` Richard Fitzgerald
@ 2026-10-13 15:30 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-10-13 15:30 UTC (permalink / raw)
To: Mingxuan Guo
Cc: Simon Trimmer, Charles Keepax, Richard Fitzgerald, patches,
alsa-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 750 bytes --]
On Tue, Oct 13, 2026 at 06:23:58PM +0800, Mingxuan Guo wrote:
> cs_dsp_run() sets dsp->running = true once the core has been started, but
> the error path below it only stops and disables the core, leaving the flag
> set. The first thing that can fail after that point is the post_run client
> hook, and it is reachable in mainline: wm_adsp registers
> wm_adsp_event_post_run(), which can fail in wm_adsp_buffer_init().
The patches in this series aren't threaded together and don't have a
cover latter which makes it hard for tools to work with them, you might
want to look at b4 to send the patches, especially it's web submission
endpoint which avoids having to configure mail:
https://b4.docs.kernel.org/en/latest/contributor/overview.html
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-13 15:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-13 10:23 [PATCH 1/2] firmware: cs_dsp: clear dsp->running on the cs_dsp_run() error path Mingxuan Guo
2026-10-13 10:28 ` Richard Fitzgerald
2026-10-13 15:30 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®