Commit d272b657 authored by Bard Liao's avatar Bard Liao Committed by Mark Brown

ASoC: SOF: Intel: replace dev_vdbg with tracepoints

This patch replaces all dev_vdbg calls with tracepoints to reduce
overhead and enable use of trace collection and analysis tools.
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: default avatarNoah Klayman <noah.klayman@intel.com>
Signed-off-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220919122108.43764-6-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 4a232cc9
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#if !defined(_TRACE_SOF_INTEL_H) || defined(TRACE_HEADER_MULTI_READ) #if !defined(_TRACE_SOF_INTEL_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_SOF_INTEL_H #define _TRACE_SOF_INTEL_H
#include <linux/tracepoint.h> #include <linux/tracepoint.h>
#include <sound/hdaudio.h>
#include "../../../sound/soc/sof/sof-audio.h" #include "../../../sound/soc/sof/sof-audio.h"
TRACE_EVENT(sof_intel_hda_irq, TRACE_EVENT(sof_intel_hda_irq,
...@@ -28,6 +29,119 @@ TRACE_EVENT(sof_intel_hda_irq, ...@@ -28,6 +29,119 @@ TRACE_EVENT(sof_intel_hda_irq,
__get_str(device_name), __get_str(source)) __get_str(device_name), __get_str(source))
); );
DECLARE_EVENT_CLASS(sof_intel_ipc_firmware_template,
TP_ARGS(struct snd_sof_dev *sdev, u32 msg, u32 msg_ext),
TP_PROTO(sdev, msg, msg_ext),
TP_STRUCT__entry(
__string(device_name, dev_name(sdev->dev))
__field(u32, msg)
__field(u32, msg_ext)
),
TP_fast_assign(
__assign_str(device_name, dev_name(sdev->dev));
__entry->msg = msg;
__entry->msg_ext = msg_ext;
),
TP_printk("device_name=%s msg=%#x msg_ext=%#x",
__get_str(device_name), __entry->msg, __entry->msg_ext)
);
DEFINE_EVENT(sof_intel_ipc_firmware_template, sof_intel_ipc_firmware_response,
TP_PROTO(struct snd_sof_dev *sdev, u32 msg, u32 msg_ext),
TP_ARGS(sdev, msg, msg_ext)
);
DEFINE_EVENT(sof_intel_ipc_firmware_template, sof_intel_ipc_firmware_initiated,
TP_PROTO(struct snd_sof_dev *sdev, u32 msg, u32 msg_ext),
TP_ARGS(sdev, msg, msg_ext)
);
TRACE_EVENT(sof_intel_D0I3C_updated,
TP_PROTO(struct snd_sof_dev *sdev, u8 reg),
TP_ARGS(sdev, reg),
TP_STRUCT__entry(
__string(device_name, dev_name(sdev->dev))
__field(u8, reg)
),
TP_fast_assign(
__assign_str(device_name, dev_name(sdev->dev));
__entry->reg = reg;
),
TP_printk("device_name=%s register=%#x",
__get_str(device_name), __entry->reg)
);
TRACE_EVENT(sof_intel_hda_irq_ipc_check,
TP_PROTO(struct snd_sof_dev *sdev, u32 irq_status),
TP_ARGS(sdev, irq_status),
TP_STRUCT__entry(
__string(device_name, dev_name(sdev->dev))
__field(u32, irq_status)
),
TP_fast_assign(
__assign_str(device_name, dev_name(sdev->dev));
__entry->irq_status = irq_status;
),
TP_printk("device_name=%s irq_status=%#x",
__get_str(device_name), __entry->irq_status)
);
TRACE_EVENT(sof_intel_hda_dsp_pcm,
TP_PROTO(struct snd_sof_dev *sdev,
struct hdac_stream *hstream,
struct snd_pcm_substream *substream,
snd_pcm_uframes_t pos
),
TP_ARGS(sdev, hstream, substream, pos),
TP_STRUCT__entry(
__string(device_name, dev_name(sdev->dev))
__field(u32, hstream_index)
__field(u32, substream)
__field(unsigned long, pos)
),
TP_fast_assign(
__assign_str(device_name, dev_name(sdev->dev));
__entry->hstream_index = hstream->index;
__entry->substream = substream->stream;
__entry->pos = pos;
),
TP_printk("device_name=%s hstream_index=%d substream=%d pos=%lu",
__get_str(device_name), __entry->hstream_index,
__entry->substream, __entry->pos)
);
TRACE_EVENT(sof_intel_hda_dsp_stream_status,
TP_PROTO(struct device *dev, struct hdac_stream *s, u32 status),
TP_ARGS(dev, s, status),
TP_STRUCT__entry(
__string(device_name, dev_name(dev))
__field(u32, stream)
__field(u32, status)
),
TP_fast_assign(
__assign_str(device_name, dev_name(dev));
__entry->stream = s->index;
__entry->status = status;
),
TP_printk("device_name=%s stream=%d status=%#x",
__get_str(device_name), __entry->stream, __entry->status)
);
TRACE_EVENT(sof_intel_hda_dsp_check_stream_irq,
TP_PROTO(struct snd_sof_dev *sdev, u32 status),
TP_ARGS(sdev, status),
TP_STRUCT__entry(
__string(device_name, dev_name(sdev->dev))
__field(u32, status)
),
TP_fast_assign(
__assign_str(device_name, dev_name(sdev->dev));
__entry->status = status;
),
TP_printk("device_name=%s status=%#x",
__get_str(device_name), __entry->status)
);
#endif /* _TRACE_SOF_INTEL_H */ #endif /* _TRACE_SOF_INTEL_H */
/* This part must be outside protection */ /* This part must be outside protection */
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <sound/sof/ext_manifest4.h> #include <sound/sof/ext_manifest4.h>
#include <sound/sof/ipc4/header.h> #include <sound/sof/ipc4/header.h>
#include <trace/events/sof_intel.h>
#include "../ipc4-priv.h" #include "../ipc4-priv.h"
#include "../ops.h" #include "../ops.h"
#include "hda.h" #include "hda.h"
...@@ -121,9 +122,7 @@ irqreturn_t cnl_ipc_irq_thread(int irq, void *context) ...@@ -121,9 +122,7 @@ irqreturn_t cnl_ipc_irq_thread(int irq, void *context)
msg_ext = hipci & CNL_DSP_REG_HIPCIDR_MSG_MASK; msg_ext = hipci & CNL_DSP_REG_HIPCIDR_MSG_MASK;
msg = hipcida & CNL_DSP_REG_HIPCIDA_MSG_MASK; msg = hipcida & CNL_DSP_REG_HIPCIDA_MSG_MASK;
dev_vdbg(sdev->dev, trace_sof_intel_ipc_firmware_response(sdev, msg, msg_ext);
"ipc: firmware response, msg:0x%x, msg_ext:0x%x\n",
msg, msg_ext);
/* mask Done interrupt */ /* mask Done interrupt */
snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR,
...@@ -153,9 +152,7 @@ irqreturn_t cnl_ipc_irq_thread(int irq, void *context) ...@@ -153,9 +152,7 @@ irqreturn_t cnl_ipc_irq_thread(int irq, void *context)
msg = hipctdr & CNL_DSP_REG_HIPCTDR_MSG_MASK; msg = hipctdr & CNL_DSP_REG_HIPCTDR_MSG_MASK;
msg_ext = hipctdd & CNL_DSP_REG_HIPCTDD_MSG_MASK; msg_ext = hipctdd & CNL_DSP_REG_HIPCTDD_MSG_MASK;
dev_vdbg(sdev->dev, trace_sof_intel_ipc_firmware_initiated(sdev, msg, msg_ext);
"ipc: firmware initiated, msg:0x%x, msg_ext:0x%x\n",
msg, msg_ext);
/* handle messages from DSP */ /* handle messages from DSP */
if ((hipctdr & SOF_IPC_PANIC_MAGIC_MASK) == SOF_IPC_PANIC_MAGIC) { if ((hipctdr & SOF_IPC_PANIC_MAGIC_MASK) == SOF_IPC_PANIC_MAGIC) {
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <sound/hdaudio_ext.h> #include <sound/hdaudio_ext.h>
#include <sound/hda_register.h> #include <sound/hda_register.h>
#include <trace/events/sof_intel.h>
#include "../sof-audio.h" #include "../sof-audio.h"
#include "../ops.h" #include "../ops.h"
#include "hda.h" #include "hda.h"
...@@ -397,8 +398,7 @@ static int hda_dsp_update_d0i3c_register(struct snd_sof_dev *sdev, u8 value) ...@@ -397,8 +398,7 @@ static int hda_dsp_update_d0i3c_register(struct snd_sof_dev *sdev, u8 value)
return ret; return ret;
} }
dev_vdbg(bus->dev, "D0I3C updated, register = 0x%x\n", trace_sof_intel_D0I3C_updated(sdev, snd_hdac_chip_readb(bus, VS_D0I3C));
snd_hdac_chip_readb(bus, VS_D0I3C));
return 0; return 0;
} }
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
*/ */
#include <sound/sof/ipc4/header.h> #include <sound/sof/ipc4/header.h>
#include <trace/events/sof_intel.h>
#include "../ops.h" #include "../ops.h"
#include "hda.h" #include "hda.h"
...@@ -212,9 +213,7 @@ irqreturn_t hda_dsp_ipc_irq_thread(int irq, void *context) ...@@ -212,9 +213,7 @@ irqreturn_t hda_dsp_ipc_irq_thread(int irq, void *context)
msg = hipci & HDA_DSP_REG_HIPCI_MSG_MASK; msg = hipci & HDA_DSP_REG_HIPCI_MSG_MASK;
msg_ext = hipcie & HDA_DSP_REG_HIPCIE_MSG_MASK; msg_ext = hipcie & HDA_DSP_REG_HIPCIE_MSG_MASK;
dev_vdbg(sdev->dev, trace_sof_intel_ipc_firmware_response(sdev, msg, msg_ext);
"ipc: firmware response, msg:0x%x, msg_ext:0x%x\n",
msg, msg_ext);
/* mask Done interrupt */ /* mask Done interrupt */
snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR,
...@@ -255,9 +254,7 @@ irqreturn_t hda_dsp_ipc_irq_thread(int irq, void *context) ...@@ -255,9 +254,7 @@ irqreturn_t hda_dsp_ipc_irq_thread(int irq, void *context)
msg = hipct & HDA_DSP_REG_HIPCT_MSG_MASK; msg = hipct & HDA_DSP_REG_HIPCT_MSG_MASK;
msg_ext = hipcte & HDA_DSP_REG_HIPCTE_MSG_MASK; msg_ext = hipcte & HDA_DSP_REG_HIPCTE_MSG_MASK;
dev_vdbg(sdev->dev, trace_sof_intel_ipc_firmware_initiated(sdev, msg, msg_ext);
"ipc: firmware initiated, msg:0x%x, msg_ext:0x%x\n",
msg, msg_ext);
/* mask BUSY interrupt */ /* mask BUSY interrupt */
snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR,
...@@ -312,7 +309,7 @@ bool hda_dsp_check_ipc_irq(struct snd_sof_dev *sdev) ...@@ -312,7 +309,7 @@ bool hda_dsp_check_ipc_irq(struct snd_sof_dev *sdev)
/* store status */ /* store status */
irq_status = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPIS); irq_status = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPIS);
dev_vdbg(sdev->dev, "irq handler: irq_status:0x%x\n", irq_status); trace_sof_intel_hda_irq_ipc_check(sdev, irq_status);
/* invalid message ? */ /* invalid message ? */
if (irq_status == 0xffffffff) if (irq_status == 0xffffffff)
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <sound/hda_register.h> #include <sound/hda_register.h>
#include <sound/pcm_params.h> #include <sound/pcm_params.h>
#include <trace/events/sof_intel.h>
#include "../sof-audio.h" #include "../sof-audio.h"
#include "../ops.h" #include "../ops.h"
#include "hda.h" #include "hda.h"
...@@ -196,8 +197,7 @@ snd_pcm_uframes_t hda_dsp_pcm_pointer(struct snd_sof_dev *sdev, ...@@ -196,8 +197,7 @@ snd_pcm_uframes_t hda_dsp_pcm_pointer(struct snd_sof_dev *sdev,
found: found:
pos = bytes_to_frames(substream->runtime, pos); pos = bytes_to_frames(substream->runtime, pos);
dev_vdbg(sdev->dev, "PCM: stream %d dir %d position %lu\n", trace_sof_intel_hda_dsp_pcm(sdev, hstream, substream, pos);
hstream->index, substream->stream, pos);
return pos; return pos;
} }
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <sound/hdaudio_ext.h> #include <sound/hdaudio_ext.h>
#include <sound/hda_register.h> #include <sound/hda_register.h>
#include <sound/sof.h> #include <sound/sof.h>
#include <trace/events/sof_intel.h>
#include "../ops.h" #include "../ops.h"
#include "../sof-audio.h" #include "../sof-audio.h"
#include "hda.h" #include "hda.h"
...@@ -697,7 +698,7 @@ bool hda_dsp_check_stream_irq(struct snd_sof_dev *sdev) ...@@ -697,7 +698,7 @@ bool hda_dsp_check_stream_irq(struct snd_sof_dev *sdev)
spin_lock_irq(&bus->reg_lock); spin_lock_irq(&bus->reg_lock);
status = snd_hdac_chip_readl(bus, INTSTS); status = snd_hdac_chip_readl(bus, INTSTS);
dev_vdbg(bus->dev, "stream irq, INTSTS status: 0x%x\n", status); trace_sof_intel_hda_dsp_check_stream_irq(sdev, status);
/* if Register inaccessible, ignore it.*/ /* if Register inaccessible, ignore it.*/
if (status != 0xffffffff) if (status != 0xffffffff)
...@@ -736,8 +737,7 @@ static bool hda_dsp_stream_check(struct hdac_bus *bus, u32 status) ...@@ -736,8 +737,7 @@ static bool hda_dsp_stream_check(struct hdac_bus *bus, u32 status)
if (status & BIT(s->index) && s->opened) { if (status & BIT(s->index) && s->opened) {
sd_status = snd_hdac_stream_readb(s, SD_STS); sd_status = snd_hdac_stream_readb(s, SD_STS);
dev_vdbg(bus->dev, "stream %d status 0x%x\n", trace_sof_intel_hda_dsp_stream_status(bus->dev, s, sd_status);
s->index, sd_status);
snd_hdac_stream_writeb(s, SD_STS, sd_status); snd_hdac_stream_writeb(s, SD_STS, sd_status);
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/firmware.h> #include <linux/firmware.h>
#include <sound/sof/ipc4/header.h> #include <sound/sof/ipc4/header.h>
#include <trace/events/sof_intel.h>
#include "../ipc4-priv.h" #include "../ipc4-priv.h"
#include "../ops.h" #include "../ops.h"
#include "hda.h" #include "hda.h"
...@@ -63,7 +64,7 @@ static bool mtl_dsp_check_ipc_irq(struct snd_sof_dev *sdev) ...@@ -63,7 +64,7 @@ static bool mtl_dsp_check_ipc_irq(struct snd_sof_dev *sdev)
hfintipptr = snd_sof_dsp_read(sdev, HDA_DSP_BAR, MTL_HFINTIPPTR) & MTL_HFINTIPPTR_PTR_MASK; hfintipptr = snd_sof_dsp_read(sdev, HDA_DSP_BAR, MTL_HFINTIPPTR) & MTL_HFINTIPPTR_PTR_MASK;
irq_status = snd_sof_dsp_read(sdev, HDA_DSP_BAR, hfintipptr + MTL_DSP_IRQSTS); irq_status = snd_sof_dsp_read(sdev, HDA_DSP_BAR, hfintipptr + MTL_DSP_IRQSTS);
dev_vdbg(sdev->dev, "irq handler: irq_status:0x%x\n", irq_status); trace_sof_intel_hda_irq_ipc_check(sdev, irq_status);
if (irq_status != U32_MAX && (irq_status & MTL_DSP_IRQSTS_IPC)) if (irq_status != U32_MAX && (irq_status & MTL_DSP_IRQSTS_IPC))
return true; return true;
......
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