mirror of https://github.com/thesofproject/sof.git
trace: dma: Help kernel and userspace detect missing trace messages.
Add message count and overflow detection to the trace position output so that kernel and userspace can detect the trace buffer has overflowed. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This commit is contained in:
parent
2b86cb3e02
commit
892ce16571
|
@ -57,6 +57,8 @@ struct dma_trace_data {
|
|||
struct dma_trace_buf dmatb;
|
||||
struct dma_copy dc;
|
||||
uint32_t host_offset;
|
||||
uint32_t overflow;
|
||||
uint32_t messages;
|
||||
uint32_t host_size;
|
||||
struct work dmat_work;
|
||||
uint32_t enabled;
|
||||
|
|
|
@ -816,6 +816,8 @@ struct sof_ipc_dma_trace_params {
|
|||
struct sof_ipc_dma_trace_posn {
|
||||
struct sof_ipc_reply rhdr;
|
||||
uint32_t host_offset; /* Offset of DMA host buffer */
|
||||
uint32_t overflow; /* overflow bytes if any */
|
||||
uint32_t messages; /* total trace messages */
|
||||
} __attribute__((packed));
|
||||
|
||||
#endif
|
||||
|
|
|
@ -648,6 +648,8 @@ int ipc_dma_trace_send_position(void)
|
|||
|
||||
posn.rhdr.hdr.cmd = SOF_IPC_GLB_TRACE_MSG | SOF_IPC_TRACE_DMA_POSITION;
|
||||
posn.host_offset = _ipc->dmat.host_offset;
|
||||
posn.overflow = _ipc->dmat.overflow;
|
||||
posn.messages = _ipc->dmat.messages;
|
||||
posn.rhdr.hdr.size = sizeof(posn);
|
||||
|
||||
return ipc_queue_host_message(_ipc, posn.rhdr.hdr.cmd, &posn,
|
||||
|
|
|
@ -60,8 +60,12 @@ static uint64_t trace_work(void *data, uint64_t delay)
|
|||
d->copy_in_progress = 1;
|
||||
|
||||
/* make sure we dont write more than buffer */
|
||||
if (avail > DMA_TRACE_LOCAL_SIZE)
|
||||
if (avail > DMA_TRACE_LOCAL_SIZE) {
|
||||
d->overflow = avail - DMA_TRACE_LOCAL_SIZE;
|
||||
avail = DMA_TRACE_LOCAL_SIZE;
|
||||
} else {
|
||||
d->overflow = 0;
|
||||
}
|
||||
|
||||
/* copy to host in sections if we wrap */
|
||||
lsize = hsize = avail;
|
||||
|
@ -134,6 +138,8 @@ int dma_trace_init_early(struct dma_trace_data *d)
|
|||
buffer->end_addr = buffer->addr + buffer->size;
|
||||
buffer->avail = 0;
|
||||
d->host_offset = 0;
|
||||
d->overflow = 0;
|
||||
d->messages = 0;
|
||||
d->enabled = 0;
|
||||
d->copy_in_progress = 0;
|
||||
|
||||
|
@ -217,6 +223,7 @@ static void dtrace_add_event(const char *e, uint32_t length)
|
|||
}
|
||||
|
||||
buffer->avail += length;
|
||||
trace_data->messages++;
|
||||
}
|
||||
|
||||
void dtrace_event(const char *e, uint32_t length)
|
||||
|
|
Loading…
Reference in New Issue