Skip to content

Commit 4b9d08c

Browse files
committed
ASoC: SOF: ipc4-mtrace: resync host_read_ptr on debugfs open
core_data->dsp_write_ptr is updated on each aging timer IPC, but there is 256ms window between DSP write and IPC. If reader opens in this window and DSP goes idle before next IPC,there wont be further writes and sof_wait_mtrace_avail() blocks until timeout. Fix by reading dsp_write_ptr directly from SRAM in open() to get current write position without waiting for the next IPC. host_read_ptr is left unchanged to preserve inter-session data. Signed-off-by: Mateusz Junkier <mateusz.junkier@intel.com>
1 parent 667770d commit 4b9d08c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

sound/soc/sof/ipc4-mtrace.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,20 @@ static int sof_ipc4_mtrace_dfs_open(struct inode *inode, struct file *file)
109109
return -ENOMEM;
110110
}
111111

112+
/*
113+
* Re-sync dsp_write_ptr from SRAM on open to avoid blocking when
114+
* DSP goes idle before next aging timer IPC arrives.
115+
*/
116+
if (core_data->slot_offset != SOF_IPC4_INVALID_SLOT_OFFSET) {
117+
struct snd_sof_dev *sdev = core_data->sdev;
118+
u32 write_ptr;
119+
120+
sof_mailbox_read(sdev, core_data->slot_offset + sizeof(u32),
121+
&write_ptr, sizeof(write_ptr));
122+
write_ptr -= write_ptr % 4;
123+
core_data->dsp_write_ptr = write_ptr;
124+
}
125+
112126
ret = simple_open(inode, file);
113127
if (ret) {
114128
kfree(core_data->log_buffer);

0 commit comments

Comments
 (0)