Unverified Commit e5cd20e0 authored by Mark Brown's avatar Mark Brown
Browse files

ASoC: SOF: Introduce generic (in)firmware tracing infrastructure

Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
From the kernel point of view there are only few ops that needs to be exposed:

Hi,

SOF is using dma-trace (or dtrace) as a firmware tracing method, which is only
supported with IPC3 and it is not applicable for IPC4.

Currently the dtrace is 'open managed' regardless of IPC version (we do force
disable it for IPC4, but the dtrace calls remain in place).

From the kernel point of view there are only few ops that needs to be exposed
by the firmware tracing support and everything else is IPC private, should not
be known by the core.

This series converts the current dma-trace as ipc3 specific firmware tracing
sub-component and moves all private data out from generic code.

Regards,
Peter
---
Peter Ujfalusi (8):
  ASoC: SOF: Introduce IPC independent ops for firmware tracing support
  ASoC: SOF: Rename dtrace_is_supported flag to fw_trace_is_supported
  ASoC: SOF: Clone the trace code to ipc3-dtrace as fw_tracing
    implementation
  ASoC: SOF: Switch to IPC generic firmware tracing
  ASoC: SOF: ipc3-dtrace: Move host ops wrappers from generic header to
    private
  ASoC: SOF: Modify the host trace_init parameter list to include dmab
  ASoC: SOF: Introduce opaque storage of private data for firmware
    tracing
  ASoC: SOF: ipc3-dtrace: Move dtrace related variables local from
    sof_dev

 sound/soc/sof/Makefile          |   1 +
 sound/soc/sof/amd/acp-trace.c   |   4 +-
 sound/soc/sof/amd/acp.h         |   2 +-
 sound/soc/sof/core.c            |  13 +-
 sound/soc/sof/debug.c           |   2 +-
 sound/soc/sof/intel/hda-dsp.c   |   2 +-
 sound/soc/sof/intel/hda-trace.c |   4 +-
 sound/soc/sof/intel/hda.h       |   2 +-
 sound/soc/sof/ipc.c             |   6 +
 sound/soc/sof/ipc3-dtrace.c     | 649 ++++++++++++++++++++++++++++++++
 sound/soc/sof/ipc3-priv.h       |  38 ++
 sound/soc/sof/ipc3.c            |   3 +-
 sound/soc/sof/ops.c             |   2 +-
 sound/soc/sof/ops.h             |  26 --
 sound/soc/sof/pm.c              |   8 +-
 sound/soc/sof/sof-priv.h        |  53 +--
 sound/soc/sof/trace.c           | 621 ++----------------------------
 17 files changed, 767 insertions(+), 669 deletions(-)
 create mode 100644 sound/soc/sof/ipc3-dtrace.c

--
2.36.1
parents f7a34446 06835329
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
snd-sof-objs := core.o ops.o loader.o ipc.o pcm.o pm.o debug.o topology.o\
		control.o trace.o iomem-utils.o sof-audio.o stream-ipc.o\
		ipc3-topology.o ipc3-control.o ipc3.o ipc3-pcm.o ipc3-loader.o\
		ipc3-dtrace.o\
		ipc4.o ipc4-loader.o
ifneq ($(CONFIG_SND_SOC_SOF_CLIENT),)
snd-sof-objs += sof-client.o
+2 −2
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ int acp_sof_trace_release(struct snd_sof_dev *sdev)
}
EXPORT_SYMBOL_NS(acp_sof_trace_release, SND_SOC_SOF_AMD_COMMON);

int acp_sof_trace_init(struct snd_sof_dev *sdev,
int acp_sof_trace_init(struct snd_sof_dev *sdev, struct snd_dma_buffer *dmab,
		       struct sof_ipc_dma_trace_params_ext *dtrace_params)
{
	struct acp_dsp_stream *stream;
@@ -46,7 +46,7 @@ int acp_sof_trace_init(struct snd_sof_dev *sdev,
	if (!stream)
		return -ENODEV;

	stream->dmab = &sdev->dmatb;
	stream->dmab = dmab;
	stream->num_pages = NUM_PAGES;

	ret = acp_dsp_stream_config(sdev, stream);
+1 −1
Original line number Diff line number Diff line
@@ -212,7 +212,7 @@ extern struct snd_sof_dsp_ops sof_renoir_ops;
int snd_amd_acp_find_config(struct pci_dev *pci);

/* Trace */
int acp_sof_trace_init(struct snd_sof_dev *sdev,
int acp_sof_trace_init(struct snd_sof_dev *sdev, struct snd_dma_buffer *dmab,
		       struct sof_ipc_dma_trace_params_ext *dtrace_params);
int acp_sof_trace_release(struct snd_sof_dev *sdev);

+6 −7
Original line number Diff line number Diff line
@@ -250,14 +250,13 @@ static int sof_probe_continue(struct snd_sof_dev *sdev)
	}

	if (sof_debug_check_flag(SOF_DBG_ENABLE_TRACE)) {
		sdev->dtrace_is_supported = true;
		sdev->fw_trace_is_supported = true;

		/* init DMA trace */
		ret = snd_sof_init_trace(sdev);
		/* init firmware tracing */
		ret = sof_fw_trace_init(sdev);
		if (ret < 0) {
			/* non fatal */
			dev_warn(sdev->dev,
				 "warning: failed to initialize trace %d\n",
			dev_warn(sdev->dev, "failed to initialize firmware tracing %d\n",
				 ret);
		}
	} else {
@@ -308,7 +307,7 @@ static int sof_probe_continue(struct snd_sof_dev *sdev)
sof_machine_err:
	snd_sof_machine_unregister(sdev, plat_data);
fw_trace_err:
	snd_sof_free_trace(sdev);
	sof_fw_trace_free(sdev);
fw_run_err:
	snd_sof_fw_unload(sdev);
fw_load_err:
@@ -447,7 +446,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);
		sof_fw_trace_free(sdev);
		ret = snd_sof_dsp_power_down_notify(sdev);
		if (ret < 0)
			dev_warn(dev, "error: %d failed to prepare DSP for device removal",
+1 −1
Original line number Diff line number Diff line
@@ -443,6 +443,6 @@ void snd_sof_handle_fw_exception(struct snd_sof_dev *sdev)
	snd_sof_ipc_dump(sdev);
	snd_sof_dsp_dbg_dump(sdev, "Firmware exception",
			     SOF_DBG_DUMP_REGS | SOF_DBG_DUMP_MBOX);
	snd_sof_trace_notify_for_error(sdev);
	sof_fw_trace_fw_crashed(sdev);
}
EXPORT_SYMBOL(snd_sof_handle_fw_exception);
Loading