Skip to content

Commit b85459a

Browse files
ranj063broonie
authored andcommitted
ASoC: SOF: core: remove DSP after unregistering machine driver
snd_sof_remove() disables the DSP and unmaps the DSP BAR. Removing topology after disabling the DSP results in a kernel panic while unloading the pipeline widget. This is because pipeline widget unload attempts to power down the core it is scheduled on by accessing the DSP registers. So, the suggested fix here is to unregister the machine driver first to remove the topology and then disable the DSP to avoid the situation described above. Note that the kernel panic only happens in cases where the HDaudio link is not managed by the hdac library, e.g. no codec or when HDMI is not supported. When the hdac library is used, snd_sof_remove() calls snd_hdac_ext_bus_device_remove() to remove the codec which unregisters the component driver thereby also removing the topology before the DSP is disabled. Fixes: c16211d ("ASoC: SOF: Add Sound Open Firmware driver core") Reviewed-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 29040d1 commit b85459a

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎sound/soc/sof/core.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,6 @@ int snd_sof_device_remove(struct device *dev)
484484
snd_sof_ipc_free(sdev);
485485
snd_sof_free_debug(sdev);
486486
snd_sof_free_trace(sdev);
487-
snd_sof_remove(sdev);
488487

489488
/*
490489
* Unregister machine driver. This will unbind the snd_card which
@@ -494,6 +493,14 @@ int snd_sof_device_remove(struct device *dev)
494493
if (!IS_ERR_OR_NULL(pdata->pdev_mach))
495494
platform_device_unregister(pdata->pdev_mach);
496495

496+
/*
497+
* Unregistering the machine driver results in unloading the topology.
498+
* Some widgets, ex: scheduler, attempt to power down the core they are
499+
* scheduled on, when they are unloaded. Therefore, the DSP must be
500+
* removed only after the topology has been unloaded.
501+
*/
502+
snd_sof_remove(sdev);
503+
497504
/* release firmware */
498505
release_firmware(pdata->fw);
499506
pdata->fw = NULL;

0 commit comments

Comments
 (0)