diff options
author | Kai Vehmanen <kai.vehmanen@linux.intel.com> | 2023-03-07 13:08:46 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2023-03-07 13:58:20 +0000 |
commit | db97cc0f7459a2bee68e6e8bf0b2f7a286137fa8 (patch) | |
tree | 175070a1a849874636f247c80d056a51e23a085c /sound/soc/sof/ipc4-mtrace.c | |
parent | 3c50211f2d534a5b766b1ff3c6cf6f7bd0bae753 (diff) | |
download | lwn-db97cc0f7459a2bee68e6e8bf0b2f7a286137fa8.tar.gz lwn-db97cc0f7459a2bee68e6e8bf0b2f7a286137fa8.zip |
ASoC: SOF: ipc4-mtrace: process pending logs upon FW crash
If the DSP firmware has crashed, some log messages may be pending in the
mtrace buffer, but not consumed by the driver as no IPC notification has
been sent by the firmware. Check the buffer status for all mtrace slots
and ensure any pending log messages are processed before DSP is possibly
powered down and the log buffer contents is lost.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230307110846.2265-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/ipc4-mtrace.c')
-rw-r--r-- | sound/soc/sof/ipc4-mtrace.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sound/soc/sof/ipc4-mtrace.c b/sound/soc/sof/ipc4-mtrace.c index 0ec6ef681012..2b4659a1768e 100644 --- a/sound/soc/sof/ipc4-mtrace.c +++ b/sound/soc/sof/ipc4-mtrace.c @@ -609,6 +609,16 @@ static void ipc4_mtrace_free(struct snd_sof_dev *sdev) ipc4_mtrace_disable(sdev); } +static int sof_ipc4_mtrace_update_pos_all_cores(struct snd_sof_dev *sdev) +{ + int i; + + for (i = 0; i < sdev->num_cores; i++) + sof_ipc4_mtrace_update_pos(sdev, i); + + return 0; +} + int sof_ipc4_mtrace_update_pos(struct snd_sof_dev *sdev, int core) { struct sof_mtrace_priv *priv = sdev->fw_trace_data; @@ -642,6 +652,16 @@ int sof_ipc4_mtrace_update_pos(struct snd_sof_dev *sdev, int core) return 0; } +static void ipc4_mtrace_fw_crashed(struct snd_sof_dev *sdev) +{ + /* + * The DSP might not be able to send SOF_IPC4_NOTIFY_LOG_BUFFER_STATUS + * messages anymore, so check the log buffer status on all + * cores and process any pending messages. + */ + sof_ipc4_mtrace_update_pos_all_cores(sdev); +} + static int ipc4_mtrace_resume(struct snd_sof_dev *sdev) { return ipc4_mtrace_enable(sdev); @@ -655,6 +675,7 @@ static void ipc4_mtrace_suspend(struct snd_sof_dev *sdev, pm_message_t pm_state) const struct sof_ipc_fw_tracing_ops ipc4_mtrace_ops = { .init = ipc4_mtrace_init, .free = ipc4_mtrace_free, + .fw_crashed = ipc4_mtrace_fw_crashed, .suspend = ipc4_mtrace_suspend, .resume = ipc4_mtrace_resume, }; |