Skip to content

Commit

Permalink
ASoC: SOF: Intel: hda-dsp: Make sure that no irq handler is pending b…
Browse files Browse the repository at this point in the history
…efore suspend

[ Upstream commit 576a0b7 ]

In the existing IPC support, the reply to each IPC message is handled in
an IRQ thread. The assumption is that the IRQ thread is scheduled without
significant delays.

On an experimental (iow, buggy) kernel, the IRQ thread dealing with the
reply to the last IPC message before powering-down the DSP can be delayed
by several seconds. The IRQ thread will proceed with register accesses
after the DSP is powered-down which results in a kernel crash.

While the bug which causes the delay is not in the audio stack, we must
handle such cases with defensive programming to avoid such crashes.

Call synchronize_irq() before proceeding to power down the DSP to make
sure that no irq thread is pending execution.

Closes: thesofproject/linux#4608
Reviewed-by: Guennadi Liakhovetski <[email protected]>
Signed-off-by: Peter Ujfalusi <[email protected]>
Signed-off-by: Pierre-Louis Bossart <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
ujfalusi authored and Sasha Levin committed Aug 27, 2024
1 parent cbcf8f1 commit 9cfb147
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sound/soc/sof/intel/hda-dsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,9 @@ static int hda_suspend(struct snd_sof_dev *sdev, bool runtime_suspend)
if (ret < 0)
return ret;

/* make sure that no irq handler is pending before shutdown */
synchronize_irq(sdev->ipc_irq);

hda_codec_jack_wake_enable(sdev, runtime_suspend);

/* power down all hda links */
Expand Down

0 comments on commit 9cfb147

Please sign in to comment.