ipc4: dma-trace: trigger log transport only when half of buffer is full

The log buffer status notifications are triggered too frequently on
small buffer chunks causing an unnecessary overhead on dma transfer.
In order to make the dma transport more effective this change
triggers the ipc4 dma transport only when half of the available buffer
is filled with log entries. The ipc3 transport is always triggered.

Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
This commit is contained in:
Rafal Redzimski 2022-03-30 12:35:24 +02:00 committed by Liam Girdwood
parent dad8a0c399
commit 5191c0ad26
4 changed files with 19 additions and 0 deletions

View File

@ -114,6 +114,12 @@ void ipc_build_stream_posn(struct sof_ipc_stream_posn *posn, uint32_t type,
void ipc_build_comp_event(struct sof_ipc_comp_event *event, uint32_t type,
uint32_t id);
/**
* \brief Check if trace buffer is ready for transmission.
* @param[in,out] avail Data available in trace buffer
*/
bool ipc_trigger_trace_xfer(uint32_t avail);
/**
* \brief Build trace position IPC message.
* @param[in,out] posn Trace position message

View File

@ -59,6 +59,11 @@ void ipc_build_comp_event(struct sof_ipc_comp_event *event, uint32_t type,
event->src_comp_id = id;
}
bool ipc_trigger_trace_xfer(uint32_t avail)
{
return true;
}
void ipc_build_trace_posn(struct sof_ipc_dma_trace_posn *posn)
{
posn->rhdr.hdr.cmd = SOF_IPC_GLB_TRACE_MSG |

View File

@ -49,6 +49,11 @@ void ipc_build_comp_event(struct sof_ipc_comp_event *event, uint32_t type,
{
}
bool ipc_trigger_trace_xfer(uint32_t avail)
{
return avail >= DMA_TRACE_LOCAL_SIZE / 2;
}
void ipc_build_trace_posn(struct sof_ipc_dma_trace_posn *posn)
{
posn->rhdr.hdr.cmd = SOF_IPC4_NOTIF_HEADER(SOF_IPC4_NOTIFY_LOG_BUFFER_STATUS);

View File

@ -67,6 +67,9 @@ static enum task_state trace_work(void *data)
if (!d->dc.chan)
return SOF_TASK_STATE_RESCHEDULE;
if (!ipc_trigger_trace_xfer(avail))
return SOF_TASK_STATE_RESCHEDULE;
/* make sure we don't write more than buffer */
if (avail > DMA_TRACE_LOCAL_SIZE) {
overflow = avail - DMA_TRACE_LOCAL_SIZE;