mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
ASoC: Intel: catpt: Add pretty-trace for large IPC payloads
Mimic mechanism found in the Intel's avs-driver and update the existing IPC payload tracing to allow for pretty printing even large payloads. Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://patch.msgid.link/20260528083444.1439233-3-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
7e5d59f407
commit
0ee392ea75
|
|
@ -1,7 +1,8 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
snd-soc-catpt-y := device.o dsp.o loader.o ipc.o messages.o pcm.o sysfs.o
|
||||
|
||||
snd-soc-catpt-y += trace.o
|
||||
# tell define_trace.h where to find the trace header
|
||||
CFLAGS_device.o := -I$(src)
|
||||
CFLAGS_trace.o := -I$(src)
|
||||
|
||||
obj-$(CONFIG_SND_SOC_INTEL_CATPT) += snd-soc-catpt.o
|
||||
|
|
|
|||
|
|
@ -25,9 +25,6 @@
|
|||
#include "core.h"
|
||||
#include "registers.h"
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include "trace.h"
|
||||
|
||||
static int catpt_do_suspend(struct device *dev)
|
||||
{
|
||||
struct catpt_dev *cdev = dev_get_drvdata(dev);
|
||||
|
|
|
|||
27
sound/soc/intel/catpt/trace.c
Normal file
27
sound/soc/intel/catpt/trace.c
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include "trace.h"
|
||||
|
||||
#define BYTES_PER_LINE 16
|
||||
#define MAX_CHUNK_SIZE ((PAGE_SIZE - 150) /* Place for trace header */ \
|
||||
/ (2 * BYTES_PER_LINE + 4) /* chars per line */ \
|
||||
* BYTES_PER_LINE)
|
||||
|
||||
void trace_catpt_ipc_payload(const void *data, size_t size)
|
||||
{
|
||||
size_t remaining = size;
|
||||
size_t offset = 0;
|
||||
|
||||
while (remaining > 0) {
|
||||
u32 chunk;
|
||||
|
||||
chunk = min_t(size_t, remaining, MAX_CHUNK_SIZE);
|
||||
trace_catpt_ipc_payload_chunk(data, chunk, offset, size);
|
||||
|
||||
remaining -= chunk;
|
||||
offset += chunk;
|
||||
}
|
||||
}
|
||||
|
|
@ -51,29 +51,37 @@ DEFINE_EVENT(catpt_ipc_msg, catpt_ipc_notify,
|
|||
TP_ARGS(header)
|
||||
);
|
||||
|
||||
TRACE_EVENT_CONDITION(catpt_ipc_payload,
|
||||
TRACE_EVENT_CONDITION(catpt_ipc_payload_chunk,
|
||||
|
||||
TP_PROTO(const u8 *data, size_t size),
|
||||
TP_PROTO(const u8 *data, size_t size, size_t offset, size_t total),
|
||||
|
||||
TP_ARGS(data, size),
|
||||
TP_ARGS(data, size, offset, total),
|
||||
|
||||
TP_CONDITION(data && size),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__dynamic_array(u8, buf, size)
|
||||
__dynamic_array(u8, buf, size )
|
||||
__field(size_t, offset )
|
||||
__field(size_t, pos )
|
||||
__field(size_t, total )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
memcpy(__get_dynamic_array(buf), data, size);
|
||||
memcpy(__get_dynamic_array(buf), data + offset, size);
|
||||
__entry->offset = offset;
|
||||
__entry->pos = offset + size;
|
||||
__entry->total = total;
|
||||
),
|
||||
|
||||
TP_printk("%u byte(s)%s",
|
||||
__get_dynamic_array_len(buf),
|
||||
TP_printk("range %zu-%zu out of %zu bytes%s",
|
||||
__entry->offset, __entry->pos, __entry->total,
|
||||
__print_hex_dump("", DUMP_PREFIX_NONE, 16, 4,
|
||||
__get_dynamic_array(buf),
|
||||
__get_dynamic_array_len(buf), false))
|
||||
);
|
||||
|
||||
void trace_catpt_ipc_payload(const void *data, size_t size);
|
||||
|
||||
#endif /* __SND_SOC_INTEL_CATPT_TRACE_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user