mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-28 18:05:00 -04:00
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>
28 lines
597 B
C
28 lines
597 B
C
// 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;
|
|
}
|
|
}
|