diff mbox series

[12/13] ASoC: Intel: avs: Adjust IPC traces

Message ID 20250109122216.3667847-13-cezary.rojewski@intel.com (mailing list archive)
State Accepted
Commit ef724707788325a53ffa4cf58fceb94654e4793a
Headers show
Series ASoC: Intel: avs: Fixes and cleanups | expand

Commit Message

Cezary Rojewski Jan. 9, 2025, 12:22 p.m. UTC
The firmware status and the firmware error registers are 4-bytes wide.
Update trace macros and their usage to reflect that.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/avs/ipc.c   | 25 ++++++++++++++----------
 sound/soc/intel/avs/trace.h | 38 +++++++++++++++++++------------------
 2 files changed, 35 insertions(+), 28 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/intel/avs/ipc.c b/sound/soc/intel/avs/ipc.c
index 4fba46e77c47..08ed9d96738a 100644
--- a/sound/soc/intel/avs/ipc.c
+++ b/sound/soc/intel/avs/ipc.c
@@ -184,10 +184,11 @@  static void avs_dsp_receive_rx(struct avs_dev *adev, u64 header)
 {
 	struct avs_ipc *ipc = adev->ipc;
 	union avs_reply_msg msg = AVS_MSG(header);
-	u64 reg;
+	u32 sts, lec;
 
-	reg = readq(avs_sram_addr(adev, AVS_FW_REGS_WINDOW));
-	trace_avs_ipc_reply_msg(header, reg);
+	sts = snd_hdac_adsp_readl(adev, AVS_FW_REG_STATUS(adev));
+	lec = snd_hdac_adsp_readl(adev, AVS_FW_REG_ERROR(adev));
+	trace_avs_ipc_reply_msg(header, sts, lec);
 
 	ipc->rx.header = header;
 	/* Abort copying payload if request processing was unsuccessful. */
@@ -209,10 +210,11 @@  static void avs_dsp_process_notification(struct avs_dev *adev, u64 header)
 	union avs_notify_msg msg = AVS_MSG(header);
 	size_t data_size = 0;
 	void *data = NULL;
-	u64 reg;
+	u32 sts, lec;
 
-	reg = readq(avs_sram_addr(adev, AVS_FW_REGS_WINDOW));
-	trace_avs_ipc_notify_msg(header, reg);
+	sts = snd_hdac_adsp_readl(adev, AVS_FW_REG_STATUS(adev));
+	lec = snd_hdac_adsp_readl(adev, AVS_FW_REG_ERROR(adev));
+	trace_avs_ipc_notify_msg(header, sts, lec);
 
 	/* Ignore spurious notifications until handshake is established. */
 	if (!adev->ipc->ready && msg.notify_msg_type != AVS_NOTIFY_FW_READY) {
@@ -367,13 +369,16 @@  static void avs_ipc_msg_init(struct avs_ipc *ipc, struct avs_ipc_msg *reply)
 static void avs_dsp_send_tx(struct avs_dev *adev, struct avs_ipc_msg *tx, bool read_fwregs)
 {
 	const struct avs_spec *const spec = adev->spec;
-	u64 reg = ULONG_MAX;
+	u32 sts = UINT_MAX;
+	u32 lec = UINT_MAX;
 
 	tx->header |= spec->hipc->req_busy_mask;
-	if (read_fwregs)
-		reg = readq(avs_sram_addr(adev, AVS_FW_REGS_WINDOW));
+	if (read_fwregs) {
+		sts = snd_hdac_adsp_readl(adev, AVS_FW_REG_STATUS(adev));
+		lec = snd_hdac_adsp_readl(adev, AVS_FW_REG_ERROR(adev));
+	}
 
-	trace_avs_request(tx, reg);
+	trace_avs_request(tx, sts, lec);
 
 	if (tx->size)
 		memcpy_toio(avs_downlink_addr(adev), tx->data, tx->size);
diff --git a/sound/soc/intel/avs/trace.h b/sound/soc/intel/avs/trace.h
index c9eaa5a60ed3..f4288d0ad5ef 100644
--- a/sound/soc/intel/avs/trace.h
+++ b/sound/soc/intel/avs/trace.h
@@ -37,60 +37,62 @@  TRACE_EVENT(avs_dsp_core_op,
 
 void trace_avs_msg_payload(const void *data, size_t size);
 
-#define trace_avs_request(msg, fwregs) \
+#define trace_avs_request(msg, sts, lec) \
 ({ \
-	trace_avs_ipc_request_msg((msg)->header, fwregs); \
+	trace_avs_ipc_request_msg((msg)->header, sts, lec); \
 	trace_avs_msg_payload((msg)->data, (msg)->size); \
 })
 
-#define trace_avs_reply(msg, fwregs) \
+#define trace_avs_reply(msg, sts, lec) \
 ({ \
-	trace_avs_ipc_reply_msg((msg)->header, fwregs); \
+	trace_avs_ipc_reply_msg((msg)->header, sts, lec); \
 	trace_avs_msg_payload((msg)->data, (msg)->size); \
 })
 
-#define trace_avs_notify(msg, fwregs) \
+#define trace_avs_notify(msg, sts, lec) \
 ({ \
-	trace_avs_ipc_notify_msg((msg)->header, fwregs); \
+	trace_avs_ipc_notify_msg((msg)->header, sts, lec); \
 	trace_avs_msg_payload((msg)->data, (msg)->size); \
 })
 #endif
 
 DECLARE_EVENT_CLASS(avs_ipc_msg_hdr,
 
-	TP_PROTO(u64 header, u64 fwregs),
+	TP_PROTO(u64 header, u32 sts, u32 lec),
 
-	TP_ARGS(header, fwregs),
+	TP_ARGS(header, sts, lec),
 
 	TP_STRUCT__entry(
 		__field(u64,	header)
-		__field(u64,	fwregs)
+		__field(u32,	sts)
+		__field(u32,	lec)
 	),
 
 	TP_fast_assign(
 		__entry->header = header;
-		__entry->fwregs = fwregs;
+		__entry->sts = sts;
+		__entry->lec = lec;
 	),
 
 	TP_printk("primary: 0x%08X, extension: 0x%08X,\n"
-		  "fwstatus: 0x%08X, fwerror: 0x%08X",
+		  "status: 0x%08X, error: 0x%08X",
 		  lower_32_bits(__entry->header), upper_32_bits(__entry->header),
-		  lower_32_bits(__entry->fwregs), upper_32_bits(__entry->fwregs))
+		  __entry->sts, __entry->lec)
 );
 
 DEFINE_EVENT(avs_ipc_msg_hdr, avs_ipc_request_msg,
-	TP_PROTO(u64 header, u64 fwregs),
-	TP_ARGS(header, fwregs)
+	TP_PROTO(u64 header, u32 sts, u32 lec),
+	TP_ARGS(header, sts, lec)
 );
 
 DEFINE_EVENT(avs_ipc_msg_hdr, avs_ipc_reply_msg,
-	TP_PROTO(u64 header, u64 fwregs),
-	TP_ARGS(header, fwregs)
+	TP_PROTO(u64 header, u32 sts, u32 lec),
+	TP_ARGS(header, sts, lec)
 );
 
 DEFINE_EVENT(avs_ipc_msg_hdr, avs_ipc_notify_msg,
-	TP_PROTO(u64 header, u64 fwregs),
-	TP_ARGS(header, fwregs)
+	TP_PROTO(u64 header, u32 sts, u32 lec),
+	TP_ARGS(header, sts, lec)
 );
 
 TRACE_EVENT_CONDITION(avs_ipc_msg_payload,