Skip to content

Commit 171b53b

Browse files
kv2019ibroonie
authored andcommitted
ASoC: SOF: pm: save io region state in case of errors in resume
If there are failures in DSP runtime resume, the device state will not reach active and this makes it impossible e.g. to retrieve a possible DSP panic dump via "exception" debugfs node. If CONFIG_SND_SOC_SOF_DEBUG_ENABLE_DEBUGFS_CACHE=y is set, the data in cache is stale. If debugfs cache is not used, the region simply cannot be read. To allow debugging these scenarios, update the debugfs cache contents in resume error handler. User-space can then later retrieve DSP panic and other state via debugfs (requires SOF debugfs cache to be enabled in build). Reported-by: Curtis Malainey <[email protected] Link: thesofproject#4274 Signed-off-by: Kai Vehmanen <[email protected] Reviewed-by: Pierre-Louis Bossart <[email protected] Reviewed-by: Ranjani Sridharan <[email protected] Reviewed-by: Curtis Malainey <[email protected] Reviewed-by: Péter Ujfalusi <[email protected] Signed-off-by: Peter Ujfalusi <[email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]
1 parent 647b5f5 commit 171b53b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

sound/soc/sof/pm.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ static int sof_resume(struct device *dev, bool runtime_resume)
164164
ret = tplg_ops->set_up_all_pipelines(sdev, false);
165165
if (ret < 0) {
166166
dev_err(sdev->dev, "Failed to restore pipeline after resume %d\n", ret);
167-
return ret;
167+
goto setup_fail;
168168
}
169169
}
170170

@@ -178,6 +178,18 @@ static int sof_resume(struct device *dev, bool runtime_resume)
178178
dev_err(sdev->dev, "ctx_restore IPC error during resume: %d\n", ret);
179179
}
180180

181+
setup_fail:
182+
#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_ENABLE_DEBUGFS_CACHE)
183+
if (ret < 0) {
184+
/*
185+
* Debugfs cannot be read in runtime suspend, so cache
186+
* the contents upon failure. This allows to capture
187+
* possible DSP coredump information.
188+
*/
189+
sof_cache_debugfs(sdev);
190+
}
191+
#endif
192+
181193
return ret;
182194
}
183195

0 commit comments

Comments
 (0)