Commit e5cd20e0 authored by Mark Brown's avatar Mark Brown

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
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
snd-sof-objs := core.o ops.o loader.o ipc.o pcm.o pm.o debug.o topology.o\ 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\ 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-topology.o ipc3-control.o ipc3.o ipc3-pcm.o ipc3-loader.o\
ipc3-dtrace.o\
ipc4.o ipc4-loader.o ipc4.o ipc4-loader.o
ifneq ($(CONFIG_SND_SOC_SOF_CLIENT),) ifneq ($(CONFIG_SND_SOC_SOF_CLIENT),)
snd-sof-objs += sof-client.o snd-sof-objs += sof-client.o
......
...@@ -34,7 +34,7 @@ int acp_sof_trace_release(struct snd_sof_dev *sdev) ...@@ -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); 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 sof_ipc_dma_trace_params_ext *dtrace_params)
{ {
struct acp_dsp_stream *stream; struct acp_dsp_stream *stream;
...@@ -46,7 +46,7 @@ int acp_sof_trace_init(struct snd_sof_dev *sdev, ...@@ -46,7 +46,7 @@ int acp_sof_trace_init(struct snd_sof_dev *sdev,
if (!stream) if (!stream)
return -ENODEV; return -ENODEV;
stream->dmab = &sdev->dmatb; stream->dmab = dmab;
stream->num_pages = NUM_PAGES; stream->num_pages = NUM_PAGES;
ret = acp_dsp_stream_config(sdev, stream); ret = acp_dsp_stream_config(sdev, stream);
......
...@@ -212,7 +212,7 @@ extern struct snd_sof_dsp_ops sof_renoir_ops; ...@@ -212,7 +212,7 @@ extern struct snd_sof_dsp_ops sof_renoir_ops;
int snd_amd_acp_find_config(struct pci_dev *pci); int snd_amd_acp_find_config(struct pci_dev *pci);
/* Trace */ /* 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); struct sof_ipc_dma_trace_params_ext *dtrace_params);
int acp_sof_trace_release(struct snd_sof_dev *sdev); int acp_sof_trace_release(struct snd_sof_dev *sdev);
......
...@@ -250,14 +250,13 @@ static int sof_probe_continue(struct snd_sof_dev *sdev) ...@@ -250,14 +250,13 @@ static int sof_probe_continue(struct snd_sof_dev *sdev)
} }
if (sof_debug_check_flag(SOF_DBG_ENABLE_TRACE)) { if (sof_debug_check_flag(SOF_DBG_ENABLE_TRACE)) {
sdev->dtrace_is_supported = true; sdev->fw_trace_is_supported = true;
/* init DMA trace */ /* init firmware tracing */
ret = snd_sof_init_trace(sdev); ret = sof_fw_trace_init(sdev);
if (ret < 0) { if (ret < 0) {
/* non fatal */ /* non fatal */
dev_warn(sdev->dev, dev_warn(sdev->dev, "failed to initialize firmware tracing %d\n",
"warning: failed to initialize trace %d\n",
ret); ret);
} }
} else { } else {
...@@ -308,7 +307,7 @@ static int sof_probe_continue(struct snd_sof_dev *sdev) ...@@ -308,7 +307,7 @@ static int sof_probe_continue(struct snd_sof_dev *sdev)
sof_machine_err: sof_machine_err:
snd_sof_machine_unregister(sdev, plat_data); snd_sof_machine_unregister(sdev, plat_data);
fw_trace_err: fw_trace_err:
snd_sof_free_trace(sdev); sof_fw_trace_free(sdev);
fw_run_err: fw_run_err:
snd_sof_fw_unload(sdev); snd_sof_fw_unload(sdev);
fw_load_err: fw_load_err:
...@@ -447,7 +446,7 @@ int snd_sof_device_remove(struct device *dev) ...@@ -447,7 +446,7 @@ int snd_sof_device_remove(struct device *dev)
snd_sof_machine_unregister(sdev, pdata); snd_sof_machine_unregister(sdev, pdata);
if (sdev->fw_state > SOF_FW_BOOT_NOT_STARTED) { 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); ret = snd_sof_dsp_power_down_notify(sdev);
if (ret < 0) if (ret < 0)
dev_warn(dev, "error: %d failed to prepare DSP for device removal", dev_warn(dev, "error: %d failed to prepare DSP for device removal",
......
...@@ -443,6 +443,6 @@ void snd_sof_handle_fw_exception(struct snd_sof_dev *sdev) ...@@ -443,6 +443,6 @@ void snd_sof_handle_fw_exception(struct snd_sof_dev *sdev)
snd_sof_ipc_dump(sdev); snd_sof_ipc_dump(sdev);
snd_sof_dsp_dbg_dump(sdev, "Firmware exception", snd_sof_dsp_dbg_dump(sdev, "Firmware exception",
SOF_DBG_DUMP_REGS | SOF_DBG_DUMP_MBOX); 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); EXPORT_SYMBOL(snd_sof_handle_fw_exception);
...@@ -432,7 +432,7 @@ static int hda_dsp_set_D0_state(struct snd_sof_dev *sdev, ...@@ -432,7 +432,7 @@ static int hda_dsp_set_D0_state(struct snd_sof_dev *sdev,
* when the DSP enters D0I3 while the system is in S0 * when the DSP enters D0I3 while the system is in S0
* for debug purpose. * for debug purpose.
*/ */
if (!sdev->dtrace_is_supported || if (!sdev->fw_trace_is_supported ||
!hda_enable_trace_D0I3_S0 || !hda_enable_trace_D0I3_S0 ||
sdev->system_suspend_target != SOF_SUSPEND_NONE) sdev->system_suspend_target != SOF_SUSPEND_NONE)
flags = HDA_PM_NO_DMA_TRACE; flags = HDA_PM_NO_DMA_TRACE;
......
...@@ -36,7 +36,7 @@ static int hda_dsp_trace_prepare(struct snd_sof_dev *sdev, struct snd_dma_buffer ...@@ -36,7 +36,7 @@ static int hda_dsp_trace_prepare(struct snd_sof_dev *sdev, struct snd_dma_buffer
return ret; return ret;
} }
int hda_dsp_trace_init(struct snd_sof_dev *sdev, int hda_dsp_trace_init(struct snd_sof_dev *sdev, struct snd_dma_buffer *dmab,
struct sof_ipc_dma_trace_params_ext *dtrace_params) struct sof_ipc_dma_trace_params_ext *dtrace_params)
{ {
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
...@@ -57,7 +57,7 @@ int hda_dsp_trace_init(struct snd_sof_dev *sdev, ...@@ -57,7 +57,7 @@ int hda_dsp_trace_init(struct snd_sof_dev *sdev,
* initialize capture stream, set BDL address and return corresponding * initialize capture stream, set BDL address and return corresponding
* stream tag which will be sent to the firmware by IPC message. * stream tag which will be sent to the firmware by IPC message.
*/ */
ret = hda_dsp_trace_prepare(sdev, &sdev->dmatb); ret = hda_dsp_trace_prepare(sdev, dmab);
if (ret < 0) { if (ret < 0) {
dev_err(sdev->dev, "error: hdac trace init failed: %d\n", ret); dev_err(sdev->dev, "error: hdac trace init failed: %d\n", ret);
hda_dsp_stream_put(sdev, SNDRV_PCM_STREAM_CAPTURE, hda_dsp_stream_put(sdev, SNDRV_PCM_STREAM_CAPTURE,
......
...@@ -658,7 +658,7 @@ static inline int hda_codec_i915_exit(struct snd_sof_dev *sdev) { return 0; } ...@@ -658,7 +658,7 @@ static inline int hda_codec_i915_exit(struct snd_sof_dev *sdev) { return 0; }
/* /*
* Trace Control. * Trace Control.
*/ */
int hda_dsp_trace_init(struct snd_sof_dev *sdev, int hda_dsp_trace_init(struct snd_sof_dev *sdev, struct snd_dma_buffer *dmab,
struct sof_ipc_dma_trace_params_ext *dtrace_params); struct sof_ipc_dma_trace_params_ext *dtrace_params);
int hda_dsp_trace_release(struct snd_sof_dev *sdev); int hda_dsp_trace_release(struct snd_sof_dev *sdev);
int hda_dsp_trace_trigger(struct snd_sof_dev *sdev, int cmd); int hda_dsp_trace_trigger(struct snd_sof_dev *sdev, int cmd);
......
...@@ -184,6 +184,12 @@ struct snd_sof_ipc *snd_sof_ipc_init(struct snd_sof_dev *sdev) ...@@ -184,6 +184,12 @@ struct snd_sof_ipc *snd_sof_ipc_init(struct snd_sof_dev *sdev)
return NULL; return NULL;
} }
if (ops->fw_tracing && (!ops->fw_tracing->init || !ops->fw_tracing->suspend ||
!ops->fw_tracing->resume)) {
dev_err(sdev->dev, "Missing firmware tracing ops\n");
return NULL;
}
return ipc; return ipc;
} }
EXPORT_SYMBOL(snd_sof_ipc_init); EXPORT_SYMBOL(snd_sof_ipc_init);
......
This diff is collapsed.
...@@ -16,6 +16,7 @@ extern const struct sof_ipc_pcm_ops ipc3_pcm_ops; ...@@ -16,6 +16,7 @@ extern const struct sof_ipc_pcm_ops ipc3_pcm_ops;
extern const struct sof_ipc_tplg_ops ipc3_tplg_ops; extern const struct sof_ipc_tplg_ops ipc3_tplg_ops;
extern const struct sof_ipc_tplg_control_ops tplg_ipc3_control_ops; extern const struct sof_ipc_tplg_control_ops tplg_ipc3_control_ops;
extern const struct sof_ipc_fw_loader_ops ipc3_loader_ops; extern const struct sof_ipc_fw_loader_ops ipc3_loader_ops;
extern const struct sof_ipc_fw_tracing_ops ipc3_dtrace_ops;
/* helpers for fw_ready and ext_manifest parsing */ /* helpers for fw_ready and ext_manifest parsing */
int sof_ipc3_get_ext_windows(struct snd_sof_dev *sdev, int sof_ipc3_get_ext_windows(struct snd_sof_dev *sdev,
...@@ -24,4 +25,41 @@ int sof_ipc3_get_cc_info(struct snd_sof_dev *sdev, ...@@ -24,4 +25,41 @@ int sof_ipc3_get_cc_info(struct snd_sof_dev *sdev,
const struct sof_ipc_ext_data_hdr *ext_hdr); const struct sof_ipc_ext_data_hdr *ext_hdr);
int sof_ipc3_validate_fw_version(struct snd_sof_dev *sdev); int sof_ipc3_validate_fw_version(struct snd_sof_dev *sdev);
/* dtrace position update */
int ipc3_dtrace_posn_update(struct snd_sof_dev *sdev,
struct sof_ipc_dma_trace_posn *posn);
/* dtrace platform callback wrappers */
static inline int sof_dtrace_host_init(struct snd_sof_dev *sdev,
struct snd_dma_buffer *dmatb,
struct sof_ipc_dma_trace_params_ext *dtrace_params)
{
struct snd_sof_dsp_ops *dsp_ops = sdev->pdata->desc->ops;
if (dsp_ops->trace_init)
return dsp_ops->trace_init(sdev, dmatb, dtrace_params);
return 0;
}
static inline int sof_dtrace_host_release(struct snd_sof_dev *sdev)
{
struct snd_sof_dsp_ops *dsp_ops = sdev->pdata->desc->ops;
if (dsp_ops->trace_release)
return dsp_ops->trace_release(sdev);
return 0;
}
static inline int sof_dtrace_host_trigger(struct snd_sof_dev *sdev, int cmd)
{
struct snd_sof_dsp_ops *dsp_ops = sdev->pdata->desc->ops;
if (dsp_ops->trace_trigger)
return dsp_ops->trace_trigger(sdev, cmd);
return 0;
}
#endif #endif
...@@ -946,7 +946,7 @@ static void ipc3_trace_message(struct snd_sof_dev *sdev, void *msg_buf) ...@@ -946,7 +946,7 @@ static void ipc3_trace_message(struct snd_sof_dev *sdev, void *msg_buf)
switch (msg_type) { switch (msg_type) {
case SOF_IPC_TRACE_DMA_POSITION: case SOF_IPC_TRACE_DMA_POSITION:
snd_sof_trace_update_pos(sdev, msg_buf); ipc3_dtrace_posn_update(sdev, msg_buf);
break; break;
default: default:
dev_err(sdev->dev, "unhandled trace message %#x\n", msg_type); dev_err(sdev->dev, "unhandled trace message %#x\n", msg_type);
...@@ -1070,6 +1070,7 @@ const struct sof_ipc_ops ipc3_ops = { ...@@ -1070,6 +1070,7 @@ const struct sof_ipc_ops ipc3_ops = {
.pm = &ipc3_pm_ops, .pm = &ipc3_pm_ops,
.pcm = &ipc3_pcm_ops, .pcm = &ipc3_pcm_ops,
.fw_loader = &ipc3_loader_ops, .fw_loader = &ipc3_loader_ops,
.fw_tracing = &ipc3_dtrace_ops,
.tx_msg = sof_ipc3_tx_msg, .tx_msg = sof_ipc3_tx_msg,
.rx_msg = sof_ipc3_rx_msg, .rx_msg = sof_ipc3_rx_msg,
......
...@@ -177,7 +177,7 @@ void snd_sof_dsp_panic(struct snd_sof_dev *sdev, u32 offset, bool non_recoverabl ...@@ -177,7 +177,7 @@ void snd_sof_dsp_panic(struct snd_sof_dev *sdev, u32 offset, bool non_recoverabl
snd_sof_dsp_dbg_dump(sdev, "DSP panic!", snd_sof_dsp_dbg_dump(sdev, "DSP panic!",
SOF_DBG_DUMP_REGS | SOF_DBG_DUMP_MBOX); SOF_DBG_DUMP_REGS | SOF_DBG_DUMP_MBOX);
sof_set_fw_state(sdev, SOF_FW_CRASHED); sof_set_fw_state(sdev, SOF_FW_CRASHED);
snd_sof_trace_notify_for_error(sdev); sof_fw_trace_fw_crashed(sdev);
} else { } else {
snd_sof_dsp_dbg_dump(sdev, snd_sof_dsp_dbg_dump(sdev,
"DSP panic (recovery will be attempted)", "DSP panic (recovery will be attempted)",
......
...@@ -375,32 +375,6 @@ static inline int snd_sof_dsp_send_msg(struct snd_sof_dev *sdev, ...@@ -375,32 +375,6 @@ static inline int snd_sof_dsp_send_msg(struct snd_sof_dev *sdev,
return sof_ops(sdev)->send_msg(sdev, msg); return sof_ops(sdev)->send_msg(sdev, msg);
} }
/* host DMA trace */
static inline int snd_sof_dma_trace_init(struct snd_sof_dev *sdev,
struct sof_ipc_dma_trace_params_ext *dtrace_params)
{
if (sof_ops(sdev)->trace_init)
return sof_ops(sdev)->trace_init(sdev, dtrace_params);
return 0;
}
static inline int snd_sof_dma_trace_release(struct snd_sof_dev *sdev)
{
if (sof_ops(sdev)->trace_release)
return sof_ops(sdev)->trace_release(sdev);
return 0;
}
static inline int snd_sof_dma_trace_trigger(struct snd_sof_dev *sdev, int cmd)
{
if (sof_ops(sdev)->trace_trigger)
return sof_ops(sdev)->trace_trigger(sdev, cmd);
return 0;
}
/* host PCM ops */ /* host PCM ops */
static inline int static inline int
snd_sof_pcm_platform_open(struct snd_sof_dev *sdev, snd_sof_pcm_platform_open(struct snd_sof_dev *sdev,
......
...@@ -107,7 +107,7 @@ static int sof_resume(struct device *dev, bool runtime_resume) ...@@ -107,7 +107,7 @@ static int sof_resume(struct device *dev, bool runtime_resume)
*/ */
if (!runtime_resume && sof_ops(sdev)->set_power_state && if (!runtime_resume && sof_ops(sdev)->set_power_state &&
old_state == SOF_DSP_PM_D0) { old_state == SOF_DSP_PM_D0) {
ret = snd_sof_trace_resume(sdev); ret = sof_fw_trace_resume(sdev);
if (ret < 0) if (ret < 0)
/* non fatal */ /* non fatal */
dev_warn(sdev->dev, dev_warn(sdev->dev,
...@@ -143,7 +143,7 @@ static int sof_resume(struct device *dev, bool runtime_resume) ...@@ -143,7 +143,7 @@ static int sof_resume(struct device *dev, bool runtime_resume)
} }
/* resume DMA trace */ /* resume DMA trace */
ret = snd_sof_trace_resume(sdev); ret = sof_fw_trace_resume(sdev);
if (ret < 0) { if (ret < 0) {
/* non fatal */ /* non fatal */
dev_warn(sdev->dev, dev_warn(sdev->dev,
...@@ -208,7 +208,7 @@ static int sof_suspend(struct device *dev, bool runtime_suspend) ...@@ -208,7 +208,7 @@ static int sof_suspend(struct device *dev, bool runtime_suspend)
/* Skip to platform-specific suspend if DSP is entering D0 */ /* Skip to platform-specific suspend if DSP is entering D0 */
if (target_state == SOF_DSP_PM_D0) { if (target_state == SOF_DSP_PM_D0) {
snd_sof_trace_suspend(sdev, pm_state); sof_fw_trace_suspend(sdev, pm_state);
/* Notify clients not managed by pm framework about core suspend */ /* Notify clients not managed by pm framework about core suspend */
sof_suspend_clients(sdev, pm_state); sof_suspend_clients(sdev, pm_state);
goto suspend; goto suspend;
...@@ -218,7 +218,7 @@ static int sof_suspend(struct device *dev, bool runtime_suspend) ...@@ -218,7 +218,7 @@ static int sof_suspend(struct device *dev, bool runtime_suspend)
tplg_ops->tear_down_all_pipelines(sdev, false); tplg_ops->tear_down_all_pipelines(sdev, false);
/* suspend DMA trace */ /* suspend DMA trace */
snd_sof_trace_suspend(sdev, pm_state); sof_fw_trace_suspend(sdev, pm_state);
/* Notify clients not managed by pm framework about core suspend */ /* Notify clients not managed by pm framework about core suspend */
sof_suspend_clients(sdev, pm_state); sof_suspend_clients(sdev, pm_state);
......
...@@ -254,8 +254,9 @@ struct snd_sof_dsp_ops { ...@@ -254,8 +254,9 @@ struct snd_sof_dsp_ops {
size_t size, const char *name, size_t size, const char *name,
enum sof_debugfs_access_type access_type); /* optional */ enum sof_debugfs_access_type access_type); /* optional */
/* host DMA trace initialization */ /* host DMA trace (IPC3) */
int (*trace_init)(struct snd_sof_dev *sdev, int (*trace_init)(struct snd_sof_dev *sdev,
struct snd_dma_buffer *dmatb,
struct sof_ipc_dma_trace_params_ext *dtrace_params); /* optional */ struct sof_ipc_dma_trace_params_ext *dtrace_params); /* optional */
int (*trace_release)(struct snd_sof_dev *sdev); /* optional */ int (*trace_release)(struct snd_sof_dev *sdev); /* optional */
int (*trace_trigger)(struct snd_sof_dev *sdev, int (*trace_trigger)(struct snd_sof_dev *sdev,
...@@ -357,6 +358,22 @@ struct snd_sof_ipc_msg { ...@@ -357,6 +358,22 @@ struct snd_sof_ipc_msg {
bool ipc_complete; bool ipc_complete;
}; };
/**
* struct sof_ipc_fw_tracing_ops - IPC-specific firmware tracing ops
* @init: Function pointer for initialization of the tracing
* @free: Optional function pointer for freeing of the tracing
* @fw_crashed: Optional function pointer to notify the tracing of a firmware crash
* @suspend: Function pointer for system/runtime suspend
* @resume: Function pointer for system/runtime resume
*/
struct sof_ipc_fw_tracing_ops {
int (*init)(struct snd_sof_dev *sdev);
void (*free)(struct snd_sof_dev *sdev);
void (*fw_crashed)(struct snd_sof_dev *sdev);
void (*suspend)(struct snd_sof_dev *sdev, pm_message_t pm_state);
int (*resume)(struct snd_sof_dev *sdev);
};
/** /**
* struct sof_ipc_pm_ops - IPC-specific PM ops * struct sof_ipc_pm_ops - IPC-specific PM ops
* @ctx_save: Function pointer for context save * @ctx_save: Function pointer for context save
...@@ -395,6 +412,7 @@ struct sof_ipc_pcm_ops; ...@@ -395,6 +412,7 @@ struct sof_ipc_pcm_ops;
* @pm: Pointer to PM ops * @pm: Pointer to PM ops
* @pcm: Pointer to PCM ops * @pcm: Pointer to PCM ops
* @fw_loader: Pointer to Firmware Loader ops * @fw_loader: Pointer to Firmware Loader ops
* @fw_tracing: Pointer to Firmware tracing ops
* *
* @tx_msg: Function pointer for sending a 'short' IPC message * @tx_msg: Function pointer for sending a 'short' IPC message
* @set_get_data: Function pointer for set/get data ('large' IPC message). This * @set_get_data: Function pointer for set/get data ('large' IPC message). This
...@@ -415,6 +433,7 @@ struct sof_ipc_ops { ...@@ -415,6 +433,7 @@ struct sof_ipc_ops {
const struct sof_ipc_pm_ops *pm; const struct sof_ipc_pm_ops *pm;
const struct sof_ipc_pcm_ops *pcm; const struct sof_ipc_pcm_ops *pcm;
const struct sof_ipc_fw_loader_ops *fw_loader; const struct sof_ipc_fw_loader_ops *fw_loader;
const struct sof_ipc_fw_tracing_ops *fw_tracing;
int (*tx_msg)(struct snd_sof_dev *sdev, void *msg_data, size_t msg_bytes, int (*tx_msg)(struct snd_sof_dev *sdev, void *msg_data, size_t msg_bytes,
void *reply_data, size_t reply_bytes, bool no_pm); void *reply_data, size_t reply_bytes, bool no_pm);
...@@ -442,12 +461,6 @@ struct snd_sof_ipc { ...@@ -442,12 +461,6 @@ struct snd_sof_ipc {
const struct sof_ipc_ops *ops; const struct sof_ipc_ops *ops;
}; };
enum sof_dtrace_state {
SOF_DTRACE_DISABLED,
SOF_DTRACE_STOPPED,
SOF_DTRACE_ENABLED,
};
/* /*
* SOF Device Level. * SOF Device Level.
*/ */
...@@ -528,16 +541,9 @@ struct snd_sof_dev { ...@@ -528,16 +541,9 @@ struct snd_sof_dev {
int ipc_timeout; int ipc_timeout;
int boot_timeout; int boot_timeout;
/* DMA for Trace */ /* firmwre tracing */
struct snd_dma_buffer dmatb; bool fw_trace_is_supported; /* set with Kconfig or module parameter */
struct snd_dma_buffer dmatp; void *fw_trace_data; /* private data used by firmware tracing implementation */
int dma_trace_pages;
wait_queue_head_t trace_sleep;
u32 host_offset;
bool dtrace_is_supported; /* set with Kconfig or module parameter */
bool dtrace_error;
bool dtrace_draining;
enum sof_dtrace_state dtrace_state;
bool msi_enabled; bool msi_enabled;
...@@ -640,27 +646,26 @@ static inline void snd_sof_ipc_process_reply(struct snd_sof_dev *sdev, u32 msg_i ...@@ -640,27 +646,26 @@ static inline void snd_sof_ipc_process_reply(struct snd_sof_dev *sdev, u32 msg_i
/* /*
* Trace/debug * Trace/debug
*/ */
int snd_sof_init_trace(struct snd_sof_dev *sdev);
void snd_sof_free_trace(struct snd_sof_dev *sdev);
int snd_sof_dbg_init(struct snd_sof_dev *sdev); int snd_sof_dbg_init(struct snd_sof_dev *sdev);
void snd_sof_free_debug(struct snd_sof_dev *sdev); void snd_sof_free_debug(struct snd_sof_dev *sdev);
int snd_sof_debugfs_buf_item(struct snd_sof_dev *sdev, int snd_sof_debugfs_buf_item(struct snd_sof_dev *sdev,
void *base, size_t size, void *base, size_t size,
const char *name, mode_t mode); const char *name, mode_t mode);
int snd_sof_trace_update_pos(struct snd_sof_dev *sdev,
struct sof_ipc_dma_trace_posn *posn);
void snd_sof_trace_notify_for_error(struct snd_sof_dev *sdev);
void sof_print_oops_and_stack(struct snd_sof_dev *sdev, const char *level, void sof_print_oops_and_stack(struct snd_sof_dev *sdev, const char *level,
u32 panic_code, u32 tracep_code, void *oops, u32 panic_code, u32 tracep_code, void *oops,
struct sof_ipc_panic_info *panic_info, struct sof_ipc_panic_info *panic_info,
void *stack, size_t stack_words); void *stack, size_t stack_words);
void snd_sof_trace_suspend(struct snd_sof_dev *sdev, pm_message_t pm_state);
int snd_sof_trace_resume(struct snd_sof_dev *sdev);
void snd_sof_handle_fw_exception(struct snd_sof_dev *sdev); void snd_sof_handle_fw_exception(struct snd_sof_dev *sdev);
int snd_sof_dbg_memory_info_init(struct snd_sof_dev *sdev); int snd_sof_dbg_memory_info_init(struct snd_sof_dev *sdev);
int snd_sof_debugfs_add_region_item_iomem(struct snd_sof_dev *sdev, int snd_sof_debugfs_add_region_item_iomem(struct snd_sof_dev *sdev,
enum snd_sof_fw_blk_type blk_type, u32 offset, size_t size, enum snd_sof_fw_blk_type blk_type, u32 offset, size_t size,
const char *name, enum sof_debugfs_access_type access_type); const char *name, enum sof_debugfs_access_type access_type);
/* Firmware tracing */
int sof_fw_trace_init(struct snd_sof_dev *sdev);
void sof_fw_trace_free(struct snd_sof_dev *sdev);
void sof_fw_trace_fw_crashed(struct snd_sof_dev *sdev);
void sof_fw_trace_suspend(struct snd_sof_dev *sdev, pm_message_t pm_state);
int sof_fw_trace_resume(struct snd_sof_dev *sdev);
/* /*
* DSP Architectures. * DSP Architectures.
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment