ASoC: SOF: Implement support for DMA trace free IPC command
Subsystems (3)
Peter Ujfalusi
maintainercover ASoC: SOF: Implement support for DMA trace free IPC command
Hi,
This series adds support for the new DMA_TRACE_FREE IPC message to gracefully stop and free the DMA trace related resources on the firmware side.
Regards,
Peter
---
Ranjani Sridharan (3):
ASoC: SOF: IPC: Add new IPC command to free trace DMA
ASoC: SOF: IPC: update ipc_log_header()
ASoC: SOF: trace: send DMA_TRACE_FREE IPC during release
include/sound/sof/header.h | 1 + sound/soc/sof/core.c | 2 +- sound/soc/sof/ipc.c | 17 ++++++++++++++++- sound/soc/sof/trace.c | 18 ++++++++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-)
Signature · 1 line
2.33.1
Peter Ujfalusi
maintainerPATCH 1/3 ASoC: SOF: IPC: Add new IPC command to free trace DMA
From: Ranjani Sridharan <[email protected]>
Add a new SOF_IPC_TRACE_DMA_FREE IPC command to stop and free trace DMA in the FW.
--- include/sound/sof/header.h | 1 + 1 file changed, 1 insertion(+)
include/sound/sof/header.h +1 -0
@@ -119,6 +119,7 @@#define SOF_IPC_TRACE_DMA_POSITION SOF_CMD_TYPE(0x002)#define SOF_IPC_TRACE_DMA_PARAMS_EXT SOF_CMD_TYPE(0x003)#define SOF_IPC_TRACE_FILTER_UPDATE SOF_CMD_TYPE(0x004)/**< ABI3.17 */ +#define SOF_IPC_TRACE_DMA_FREE SOF_CMD_TYPE(0x005)/**< ABI3.20 */ /* debug */ #define SOF_IPC_DEBUG_MEM_USAGE SOF_CMD_TYPE(0x001)
Signature · 1 line
2.33.1
Peter Ujfalusi
maintainerPATCH 2/3 ASoC: SOF: IPC: update ipc_log_header()
In reply to Peter UjfalusiFrom: Ranjani Sridharan <[email protected]>
Parse all the trace DMA IPC commands in ipc_log_header().
--- sound/soc/sof/ipc.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
sound/soc/sof/ipc.c +16 -1
@@ -173,7 +173,22 @@ static void ipc_log_header(struct device *dev, u8 *text, u32 cmd) }break ;case SOF_IPC_GLB_TRACE_MSG : - str ="GLB_TRACE_MSG" ;break ; + str ="GLB_TRACE_MSG" ; +switch (type) { +case SOF_IPC_TRACE_DMA_PARAMS : + str2 ="DMA_PARAMS" ;break ; +case SOF_IPC_TRACE_DMA_POSITION : + str2 ="DMA_POSITION" ;break ; +case SOF_IPC_TRACE_DMA_PARAMS_EXT : + str2 ="DMA_PARAMS_EXT" ;break ; +case SOF_IPC_TRACE_FILTER_UPDATE : + str2 ="FILTER_UPDATE" ;break ; +case SOF_IPC_TRACE_DMA_FREE : + str2 ="DMA_FREE" ;break ; +default : + str2 ="unknown type" ;break ; + } +break ;case SOF_IPC_GLB_TEST_MSG : str ="GLB_TEST_MSG" ;switch (type) {
Signature · 1 line
2.33.1
Peter Ujfalusi
maintainerPATCH 3/3 ASoC: SOF: trace: send DMA_TRACE_FREE IPC during release
In reply to Peter UjfalusiFrom: Ranjani Sridharan <[email protected]>
Send the DMA_TRACE_FREE IPC during release to stop and free the trace DMA in the DSP.
--- sound/soc/sof/core.c | 2 +- sound/soc/sof/trace.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-)
sound/soc/sof/core.c +1 -1
@@ -370,6 +370,7 @@ int snd_sof_device_remove(struct device *dev)snd_sof_machine_unregister (sdev, pdata);if (sdev->fw_state >SOF_FW_BOOT_NOT_STARTED ) { +snd_sof_free_trace (sdev); ret =snd_sof_dsp_power_down_notify (sdev);if (ret <0 ) dev_warn(dev, "error: %d failed to prepare DSP for device removal",
@@ -377,7 +378,6 @@ int snd_sof_device_remove(struct device *dev)snd_sof_ipc_free (sdev);snd_sof_free_debug (sdev); -snd_sof_free_trace (sdev); }/*
sound/soc/sof/trace.c +18 -0
@@ -539,6 +539,10 @@ EXPORT_SYMBOL(snd_sof_trace_notify_for_error);void snd_sof_release_trace (struct snd_sof_dev *sdev) { +struct sof_ipc_fw_ready *ready = &sdev->fw_ready; +struct sof_ipc_fw_version *v = &ready->version; +struct sof_ipc_cmd_hdr hdr; +struct sof_ipc_reply ipc_reply;int ret;if (!sdev->dtrace_is_supported || !sdev->dtrace_is_enabled)
@@ -549,6 +553,20 @@ void snd_sof_release_trace(struct snd_sof_dev *sdev)dev_err (sdev->dev,"error: snd_sof_dma_trace_trigger: stop: %d\n" , ret); +/* +* stop and free trace DMA in the DSP. TRACE_DMA_FREE is only supported from +* ABI 3.20.0 onwards +*/ +if (v->abi_version >=SOF_ABI_VER (3 ,20 ,0 )) { + hdr.size =sizeof (hdr); + hdr.cmd =SOF_IPC_GLB_TRACE_MSG |SOF_IPC_TRACE_DMA_FREE ; + + ret =sof_ipc_tx_message (sdev->ipc, hdr.cmd, &hdr, hdr.size, + &ipc_reply,sizeof (ipc_reply)); +if (ret <0 ) +dev_err (sdev->dev,"DMA_TRACE_FREE failed with error: %d\n" , ret); + } + ret =snd_sof_dma_trace_release (sdev);if (ret <0 ) dev_err(sdev->dev,
Signature · 1 line
2.33.1
Mark Brown
maintainerQuoted 6 lines · Peter Ujfalusi
This series adds support for the new
DMA_TRACE_FREEIPC message to gracefully stop and free the DMA trace related resources on the firmware side.Regards,
Peter
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/3] ASoC: SOF: IPC: Add new IPC command to free trace DMA
commit: 168eed447129899611098219b70ef97b605bc6e1
[2/3] ASoC: SOF: IPC: update ipc_log_header()
commit: b4e2d7ce132bc4337916662f8e699420377132d9
[3/3] ASoC: SOF: trace: send DMA_TRACE_FREE IPC during release
commit: 48b5b6a56002569881d18be56deaddad045df918All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark