Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0EDD3EDE78 for ; Wed, 27 May 2026 09:45:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779875150; cv=none; b=qnqvVLvQgev4V14GvPa/WB3frVJEOKQV6TuMaJ+Z9GFmI9ck2D5wPZSfCPodCXECdHRjKngEgQiw02icGkAk6Jhxf/uOUaqq7o/+ci5A2wfIq7rKWOVs/Cm9y/STgQNMGeMBamR9r2czK1QRiUuYG+oFM1yuoXbwKI6D9bUWOSs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779875150; c=relaxed/simple; bh=dUgA5F7YKT0fSb50nIwqAfUOFaFWQjmaOeO1WffUhvQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PtcKrSX6Cs9XRMsohSURrpYUmUwzrO+ZzcJ3o7gpYLh4ozzEiObejmA+7WS3ok2NzWPCbFCF2+GsFJB2EEWuVD4WXqz3bX1L8MFMlXQXaPFbSpeSAdUmMpA43CbYHR57pnYfw0DakDLLZVYtOK81ArHQDL5uozP3eSkIhSk8mBQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=QPmdMZEv; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="QPmdMZEv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1779875149; x=1811411149; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dUgA5F7YKT0fSb50nIwqAfUOFaFWQjmaOeO1WffUhvQ=; b=QPmdMZEvEkZ/HpFe2CGTYl9lM2gsLQ06fsPsO8K5O9R03sVnzpcSCOs7 tlNMAM1Yb/gfPA1N+IG0/S4aclbZkN06F0sIj4lTaqf+JZ6WGp57ZqVkx Px5xWnGj3Q3sw/SaalkV81xKiscPIIqd0KBCariLc6MLwMzEc7l33yR6Q h9HHlgmYZIE7g1dLKQT3jI5pbQ80BX+XI0NE4+nNX7wiQUQpjOjHz3XPo OY+5eLt+fPIaNel3YCqGv7bTaVY7yVJeFUWeHUiHjgRoVSUYvTyuDItng zu2PUFezEOib5whguzcUlPErbm0mSC8IADnauczHqk8LdNdcK8sUNvAtu Q==; X-CSE-ConnectionGUID: 7bYVmbVbS9i0wE5zHClqww== X-CSE-MsgGUID: N8sh5wszT2Ssm7NJIAM9Yg== X-IronPort-AV: E=McAfee;i="6800,10657,11798"; a="84592692" X-IronPort-AV: E=Sophos;i="6.24,171,1774335600"; d="scan'208";a="84592692" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2026 02:45:49 -0700 X-CSE-ConnectionGUID: E1rwT/e6Q+Gdv73qCUR0pw== X-CSE-MsgGUID: QGLvv4JMSReeAo8K3HtEvA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,171,1774335600"; d="scan'208";a="272519672" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.0]) by orviesa002.jf.intel.com with ESMTP; 27 May 2026 02:45:46 -0700 From: Cezary Rojewski To: broonie@kernel.org Cc: tiwai@suse.com, perex@perex.cz, amade@asmblr.net, linux-sound@vger.kernel.org, Cezary Rojewski Subject: [PATCH 2/3] ASoC: Intel: catpt: Add pretty-trace for large IPC payloads Date: Wed, 27 May 2026 11:47:06 +0200 Message-Id: <20260527094707.1432195-3-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260527094707.1432195-1-cezary.rojewski@intel.com> References: <20260527094707.1432195-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- sound/soc/intel/catpt/Makefile | 3 ++- sound/soc/intel/catpt/device.c | 3 --- sound/soc/intel/catpt/trace.c | 27 +++++++++++++++++++++++++++ sound/soc/intel/catpt/trace.h | 22 +++++++++++++++------- 4 files changed, 44 insertions(+), 11 deletions(-) create mode 100644 sound/soc/intel/catpt/trace.c diff --git a/sound/soc/intel/catpt/Makefile b/sound/soc/intel/catpt/Makefile index e8316e33b820..8005fc677f28 100644 --- a/sound/soc/intel/catpt/Makefile +++ b/sound/soc/intel/catpt/Makefile @@ -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 diff --git a/sound/soc/intel/catpt/device.c b/sound/soc/intel/catpt/device.c index ca4fd18b6a6e..6fe212f498c6 100644 --- a/sound/soc/intel/catpt/device.c +++ b/sound/soc/intel/catpt/device.c @@ -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); diff --git a/sound/soc/intel/catpt/trace.c b/sound/soc/intel/catpt/trace.c new file mode 100644 index 000000000000..e97c372cc2af --- /dev/null +++ b/sound/soc/intel/catpt/trace.c @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include + +#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; + } +} diff --git a/sound/soc/intel/catpt/trace.h b/sound/soc/intel/catpt/trace.h index 010f57b6a7a8..6b528d933734 100644 --- a/sound/soc/intel/catpt/trace.h +++ b/sound/soc/intel/catpt/trace.h @@ -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 */ -- 2.34.1